After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 547920 - Deprecate non-multihead API in Gdk and Gtk
Deprecate non-multihead API in Gdk and Gtk
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: [obsolete] multihead
2.21.x
Other All
: Normal normal
: ---
Assigned To: Erwann Chenede
gtk-bugs
deprecations
Depends on:
Blocks:
 
 
Reported: 2008-08-15 15:15 UTC by Christian Dywan
Modified: 2012-05-04 01:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Initial attempt at the Gtk parts (8.40 KB, patch)
2008-08-15 16:03 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk events code (2.35 KB, patch)
2008-08-20 15:22 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk pixbuf code (1.56 KB, patch)
2008-08-20 15:23 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk property code (5.97 KB, patch)
2008-08-20 15:24 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk rgb code (6.26 KB, patch)
2008-08-20 15:28 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk screen code (6.40 KB, patch)
2008-08-20 15:30 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk selection code (4.83 KB, patch)
2008-08-20 15:31 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk key code (898 bytes, patch)
2008-08-20 16:01 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk pixmap code (1.94 KB, patch)
2008-08-20 16:19 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk cursor code (1.38 KB, patch)
2008-08-20 16:33 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk pango code (1.59 KB, patch)
2008-08-21 15:41 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk x11 code (11.21 KB, patch)
2008-08-22 10:14 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk drag code (1.93 KB, patch)
2008-08-22 10:32 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk colour code (1.36 KB, patch)
2008-08-22 14:45 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk visual code (4.48 KB, patch)
2008-08-22 14:49 UTC, Christian Dywan
none Details | Review
Deprecate non-multihead safe gdk window code (4.57 KB, patch)
2008-08-22 15:18 UTC, Christian Dywan
none Details | Review

Description Christian Dywan 2008-08-15 15:15:51 UTC
As per the description on the Gtk 3.0 tasks page in the wiki:

Gdk and Gtk contain some backwards compatibility API from before it was multihead safe. Deprecating this for 2.16 wil enable us to get rid of it for 3.x.

I'm working on this.
Comment 1 Christian Dywan 2008-08-15 16:03:54 UTC
Created attachment 116680 [details] [review]
Initial attempt at the Gtk parts

This is an initial attempt at deprecating the non multihead safe functions in the Gtk layer. Particularly the few places where unsafe functions are used inside Gtk are worth looking at when reviewing.
Comment 2 David Zeuthen (not reading bugmail) 2008-08-15 16:12:15 UTC
Keep in mind that even gdk_screen_get_resolution() shouldn't be considered multi-head safe - resolution/font-options is really per-monitor.

FWIW, the RI patchset fixes this; see 

 bug 546711 comment 7
 http://people.freedesktop.org/~david/gtk-ri-patches/gdk/GdkScreen.html#gdk-screen-get-resolution-for-monitor
 http://people.freedesktop.org/~david/gtk-ri-patches/gtk/gtk-Themeable-Stock-Images.html#gtk-icon-size-lookup-for-settings-for-monitor
 http://gitweb.freedesktop.org/?p=users/david/gtk%2B.git;a=commit;h=7c42b63bcd90242f59f06d38ddee5a2096a89e22 [1]

[1] : URL might change when I rebase the tree from time to time; 

http://gitweb.freedesktop.org/?p=users/david/gtk%2B.git;a=shortlog;h=resolution-independence



 and this patch

 
Comment 3 Christian Dywan 2008-08-20 15:22:11 UTC
Created attachment 117064 [details] [review]
Deprecate non-multihead safe gdk events code

This patch deprecates the following:

gdk_add_client_message_filter
gdk_setting_get
Comment 4 Christian Dywan 2008-08-20 15:23:17 UTC
Created attachment 117065 [details] [review]
Deprecate non-multihead safe gdk pixbuf code

This patch deprecates gdk_pixbuf_render_pixmap_and_mask
Comment 5 Christian Dywan 2008-08-20 15:24:44 UTC
Created attachment 117066 [details] [review]
Deprecate non-multihead safe gdk property code

This patch deprecates the following functions:

gdk_string_to_compound_text
gdk_text_property_to_text_list
gdk_text_property_to_utf8_list
gdk_utf8_to_compound_text
Comment 6 Christian Dywan 2008-08-20 15:28:08 UTC
Created attachment 117067 [details] [review]
Deprecate non-multihead safe gdk rgb code

This patch deprecates the following functions:

gdk_screen_get_rgb_colormap
gdk_screen_get_rgb_visual
gdk_rgb_get_colormap
gdk_rgb_get_visual
gdk_rgb_colormap_ditherable
gdk_rgb_ditherable

All these functions are actually deprecated with the note "The functionality is obsolete." because the current documentation already explains that they are not useful anymore.
Comment 7 Christian Dywan 2008-08-20 15:30:04 UTC
Created attachment 117068 [details] [review]
Deprecate non-multihead safe gdk screen code

This patch deprecates the following functions:

gdk_beep
gdk_keyboard_ungrab
gdk_pointer_is_grabbed
gdk_pointer_ungrab
gdk_set_double_click_time
gdk_screen_width
gdk_screen_width_mm
gdk_screen_height
gdk_screen_height_mm
Comment 8 Christian Dywan 2008-08-20 15:31:27 UTC
Created attachment 117069 [details] [review]
Deprecate non-multihead safe gdk selection code

This patch deprecates the following functions:

gdk_selection_owner_set
gdk_selection_owner_get
Comment 9 Christian Dywan 2008-08-20 16:01:56 UTC
Created attachment 117072 [details] [review]
Deprecate non-multihead safe gdk key code

This patch deprecates gdk_keymap_get_default
Comment 10 Christian Dywan 2008-08-20 16:19:32 UTC
Created attachment 117075 [details] [review]
Deprecate non-multihead safe gdk pixmap code

This patch deprecates the following functions:

gdk_pixmap_foreign_new
gdk_pixmap_lookup
Comment 11 Christian Dywan 2008-08-20 16:33:50 UTC
Created attachment 117076 [details] [review]
Deprecate non-multihead safe gdk cursor code

This patch deprecates gdk_cursor_new.
Comment 12 Owen Taylor 2008-08-20 20:03:57 UTC
I see little virtue in this. Most apps don't open multiple displays.
Why force app authors to replace gdk_pointer_ungrab() with 
gdk_display_pointer_ungrab(gdk_display_get_default()) ?

Though admitttedly this change does reduce the number entry points
in GDK, which has some inherent value in making the API understandable,
so I'm not 101% opposed.
Comment 13 Michael Natterer 2008-08-20 22:23:52 UTC
App writers should say gdk_pointer_ungrab(gtk_widget_get_display(widget)),
not gdk_pointer_ungrab(gdk_display_get_default()).

I would say there is little doubt that the latter is useless nonsense
while the former is what works on both multi-display and normal apps,
so the former should be the preferred one in any case.

It's just a matter of documenting so people see what do use when
they get the warning about gdk_pointer_ungrab() being unknown.
Comment 14 Christian Dywan 2008-08-21 15:41:04 UTC
Created attachment 117144 [details] [review]
Deprecate non-multihead safe gdk pango code

This patch deprecates the function gdk_pango_context_get.
Comment 15 Christian Dywan 2008-08-22 10:14:12 UTC
Created attachment 117204 [details] [review]
Deprecate non-multihead safe gdk x11 code

This patch deprecates the following functions:

gdk_net_wm_supports
gdk_x11_atom_to_xatom
gdk_x11_get_xatom_by_name
gdk_x11_get_xatom_name
gdk_x11_xatom_to_atom
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
gdk_x11_grab_server
gdk_x11_ungrab_server
gdk_xid_table_lookup

Plus, the following global variable is deprecated:

extern Display *gdk_display;
Comment 16 Christian Dywan 2008-08-22 10:32:24 UTC
Created attachment 117206 [details] [review]
Deprecate non-multihead safe gdk drag code

This patch deprecates the following functions:

gdk_drag_find_window
gdk_drag_get_protocol
Comment 17 Christian Dywan 2008-08-22 14:45:20 UTC
Created attachment 117222 [details] [review]
Deprecate non-multihead safe gdk colour code

This patch deprecates the function gdk_colormap_get_system.
Comment 18 Christian Dywan 2008-08-22 14:49:15 UTC
Created attachment 117223 [details] [review]
Deprecate non-multihead safe gdk visual code

This patch deprecates the following functions:

gdk_list_visuals
gdk_visual_get_system
gdk_query_depths
gdk_query_visual_types
gdk_visual_get_best
gdk_visual_get_best_depth
gdk_visual_get_best_type
gdk_visual_get_best_with_both
gdk_visual_get_best_with_depth
gdk_visual_get_best_with_type

Most of these functions are actually pure convenience, apart from not being able to work on a non-default screen.
Comment 19 Christian Dywan 2008-08-22 15:18:09 UTC
Created attachment 117229 [details] [review]
Deprecate non-multihead safe gdk window code

This patch deprecates the following functions:

gdk_window_foreign_new
gdk_window_lookup
gdk_set_pointer_hooks
gdk_window_get_toplevels
Comment 20 Matthias Clasen 2008-09-27 04:16:00 UTC
Comment on attachment 116680 [details] [review]
Initial attempt at the Gtk parts

@@ -404,12 +404,7 @@ gtk_style_init (GtkStyle *style)
 {
   gint i;
   
-  GtkSettings *settings = gtk_settings_get_default ();
-  
-  if (settings)
-    _gtk_style_init_for_settings (style, settings);
-  else
-    style->font_desc = pango_font_description_from_string ("Sans 10");
+  style->font_desc = pango_font_description_from_string ("Sans 10");
   
   style->attach_count = 0;
   style->colormap = NULL;


If we do this, we'll need to call _gtk_style_init_settings later when attaching it to a widget, no ?
Comment 21 Christian Dywan 2008-09-30 11:27:18 UTC
(In reply to comment #20)
> (From update of attachment 116680 [details] [review] [edit])
> @@ -404,12 +404,7 @@ gtk_style_init (GtkStyle *style)
>  {
>    gint i;
> 
> -  GtkSettings *settings = gtk_settings_get_default ();
> -  
> -  if (settings)
> -    _gtk_style_init_for_settings (style, settings);
> -  else
> -    style->font_desc = pango_font_description_from_string ("Sans 10");
> +  style->font_desc = pango_font_description_from_string ("Sans 10");
> 
>    style->attach_count = 0;
>    style->colormap = NULL;
> 
> 
> If we do this, we'll need to call _gtk_style_init_settings later when attaching
> it to a widget, no ?

I don't think so. _gtk_style_init_settings is called as soon as we have a screen. That is what the comment above the function says and I actually inserted debug lines to gtk_style_init and _gtk_style_init_settings to verify that. I see an equal number of lines for each function here.

The only purpose of trying to retrieve the font of the default screen might be to have something better than the default font - is that useful?

I guess I can restore the old behaviour if you think it makes any sense.
Comment 22 Cody Russell 2009-04-15 20:40:20 UTC
What's the status of this right now?
Comment 23 Christian Dywan 2009-05-08 14:55:49 UTC
The status is, that we need an agreement. The patches are there, and work as far as I can say. I wouldn't mind somebody going through them and saying yes, no or please-improve-this :)
Comment 24 Matthias Clasen 2009-05-10 04:31:56 UTC
I must say I'm somewhat torn on this. The 'multihead'-ness that we are fortifying our api against here is a dying breed.  
Comment 25 Javier Jardón (IRC: jjardon) 2010-09-24 15:23:44 UTC
2.22 has been released. Change target milestore to 2.24
Comment 26 Matthias Clasen 2012-05-04 01:16:29 UTC
I don't think this makes sense; multiple screens are an obsolescent X concept, we shouldn't complicate our api for it at this point