From aeaaae04ac7b17964764fdeb4a51197022879cfd Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 6 Jun 2002 00:26:42 +0000 Subject: [PATCH] Changes multihead reorganizing code for win32 support, mostly from a patch Wed Jun 5 18:34:47 2002 Owen Taylor Changes multihead reorganizing code for win32 support, mostly from a patch by Hans Breuer. * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c gdk/gdkscreen.c gdk/x11/gdkmain-x11.c gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c gdk/x11/gdkpango-x11.c gdk/gdkselection.c gdk/x11/gdkselection-x11.c gdk/gdkwindow.c gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: Move port-independent singlehead wrapper functions into port-independent part of GDK. (#80009) * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: Turn singlehead functions into "multihead" functions that ignore their GdkDisplay or GdkScreen arguments. * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: Misc multihead-compatibility changes. * gtk/gtk.def gdk/gdk.def: Update for multihead functions. * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c gdk/x11/gdkvisual-x11.c: Remove the screen fields from the public parts of the colormap/visual structures, add accessors instead. * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen for colormaps, visuals; move the fields into the private structures for the x11 backend. * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: Remove virtualization of screen and display functions. (#79990, patch from Erwann Chenede) * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: New files containing stub implementations of Display, Screen functions. * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkx.h: Clean up function exports and what headers they are in. (#79954) * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant screen->screen_num. (In the patch for #79972, Erwann Chenede) * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() to use window hooks. (#79972, patch partly from Erwann Chenede) * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix some warnings. --- ChangeLog | 67 ++++++ ChangeLog.pre-2-10 | 67 ++++++ ChangeLog.pre-2-2 | 67 ++++++ ChangeLog.pre-2-4 | 67 ++++++ ChangeLog.pre-2-6 | 67 ++++++ ChangeLog.pre-2-8 | 67 ++++++ docs/reference/gdk/tmpl/general.sgml | 34 +--- gdk/Makefile.am | 2 + gdk/gdk.def | 48 ++++- gdk/gdkcolor.c | 16 ++ gdk/gdkcolor.h | 3 +- gdk/gdkcursor.c | 18 ++ gdk/gdkdisplay.c | 160 +++++++++------ gdk/gdkevents.c | 18 ++ gdk/gdkfont.c | 26 +++ gdk/gdkimage.c | 10 + gdk/gdkinternals.h | 3 + gdk/gdkkeys.c | 13 ++ gdk/gdkpango.c | 20 ++ gdk/gdkpixbuf-render.c | 16 +- gdk/gdkpixmap.c | 5 +- gdk/gdkrgb.c | 25 ++- gdk/gdkscreen.c | 293 ++++++++------------------- gdk/gdkscreen.h | 19 -- gdk/gdkselection.c | 86 ++++++++ gdk/gdkvisual.c | 59 ++++++ gdk/gdkvisual.h | 4 +- gdk/gdkwindow.c | 31 ++- gdk/makefile.msc | 2 + gdk/win32/Makefile.am | 2 + gdk/win32/gdkcolor-win32.c | 14 +- gdk/win32/gdkcursor-win32.c | 12 +- gdk/win32/gdkdisplay-win32.c | 80 ++++++++ gdk/win32/gdkdrawable-win32.c | 9 + gdk/win32/gdkevents-win32.c | 155 +++++++------- gdk/win32/gdkfont-win32.c | 9 +- gdk/win32/gdkimage-win32.c | 22 +- gdk/win32/gdkinput-win32.c | 4 +- gdk/win32/gdkkeys-win32.c | 4 +- gdk/win32/gdkmain-win32.c | 85 +------- gdk/win32/gdkpango-win32.c | 5 +- gdk/win32/gdkprivate-win32.h | 9 + gdk/win32/gdkproperty-win32.c | 8 +- gdk/win32/gdkscreen-win32.c | 72 +++++++ gdk/win32/gdkselection-win32.c | 62 +++--- gdk/win32/gdkvisual-win32.c | 15 +- gdk/win32/gdkwindow-win32.c | 16 +- gdk/win32/makefile.msc | 2 + gdk/x11/gdkcolor-x11.c | 72 +++---- gdk/x11/gdkcursor-x11.c | 18 -- gdk/x11/gdkdisplay-x11.c | 85 ++++---- gdk/x11/gdkdisplay-x11.h | 8 +- gdk/x11/gdkevents-x11.c | 61 +----- gdk/x11/gdkfont-x11.c | 25 --- gdk/x11/gdkimage-x11.c | 14 +- gdk/x11/gdkkeys-x11.c | 12 -- gdk/x11/gdkmain-x11.c | 153 -------------- gdk/x11/gdkpango-x11.c | 19 -- gdk/x11/gdkprivate-x11.h | 1 + gdk/x11/gdkscreen-x11.c | 290 +++++++++++++------------- gdk/x11/gdkscreen-x11.h | 8 +- gdk/x11/gdkselection-x11.c | 82 -------- gdk/x11/gdkvisual-x11.c | 57 ++---- gdk/x11/gdkwindow-x11.c | 49 +++-- gdk/x11/gdkx.h | 5 +- gtk/gtk.def | 5 + gtk/gtkgc.c | 7 +- gtk/gtkstyle.c | 2 +- gtk/gtkwidget.c | 6 +- 69 files changed, 1659 insertions(+), 1218 deletions(-) create mode 100644 gdk/gdkselection.c create mode 100644 gdk/gdkvisual.c create mode 100644 gdk/win32/gdkdisplay-win32.c create mode 100644 gdk/win32/gdkscreen-win32.c diff --git a/ChangeLog b/ChangeLog index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 9b0428a047..a66d1c3ac8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,70 @@ +Wed Jun 5 18:34:47 2002 Owen Taylor + + Changes multihead reorganizing code for win32 support, + mostly from a patch by Hans Breuer. + + * gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c + gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c + gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c + gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c + gdk/gdkscreen.c gdk/x11/gdkmain-x11.c + gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c + gdk/x11/gdkpango-x11.c gdk/gdkselection.c + gdk/x11/gdkselection-x11.c gdk/gdkwindow.c + gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c: + Move port-independent singlehead wrapper functions into + port-independent part of GDK. (#80009) + + * gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c + gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c + gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c + gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c + gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c: + Turn singlehead functions into "multihead" functions that ignore + their GdkDisplay or GdkScreen arguments. + + * gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c + gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h: + Misc multihead-compatibility changes. + + * gtk/gtk.def gdk/gdk.def: Update for multihead functions. + + * gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c + gdk/x11/gdkvisual-x11.c: Remove the screen fields + from the public parts of the colormap/visual structures, add accessors + instead. + + * gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c + gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c + gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c + gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen + for colormaps, visuals; move the fields into the private + structures for the x11 backend. + + * gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c: + Remove virtualization of screen and display functions. + (#79990, patch from Erwann Chenede) + + * gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c + gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}: + New files containing stub implementations of Display, + Screen functions. + + * gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch] + gdk/x11/gdkx.h: Clean up function exports and what + headers they are in. (#79954) + + * gdk/x11/gdkx.h: Fix macro that was referring to a non-existant + screen->screen_num. (In the patch for #79972, Erwann Chenede) + + * gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h + gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer() + to use window hooks. (#79972, patch partly from Erwann Chenede) + + * gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix + some warnings. + Wed Jun 5 23:29:41 2002 Kristian Rietveld Related bugs: #76252, #76396, #80866. diff --git a/docs/reference/gdk/tmpl/general.sgml b/docs/reference/gdk/tmpl/general.sgml index 00b7d9fb79..14d6cd9a86 100644 --- a/docs/reference/gdk/tmpl/general.sgml +++ b/docs/reference/gdk/tmpl/general.sgml @@ -156,38 +156,30 @@ trapping X errors with gdk_error_trap_push() and gdk_error_trap_pop(). -Returns the width of the default screen in pixels. -@Returns: the width of the default screen in pixels. +@Returns: -Returns the height of the default screen in pixels. -@Returns: the height of the default screen in pixels. +@Returns: -Returns the width of the default screen in millimeters. -Note that on many X servers this value will not be correct. -@Returns: the width of the default screen in millimeters, though it is not always -correct. +@Returns: -Returns the height of the default screen in millimeters. -Note that on many X servers this value will not be correct. -@Returns: the height of the default screen in millimeters, though it is not always -correct. +@Returns: @@ -251,26 +243,19 @@ success or the reason for the failure of the grab attempt. -Ungrabs the pointer, if it is grabbed by this application. + -@time: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is -available. +@time: -Returns %TRUE if the pointer is currently grabbed by this application. -Note that the return value is not completely reliable since the X server may -automatically ungrab the pointer, without informing the application, if the -grab window becomes unviewable. It also does not take passive pointer grabs -into account. -@Returns: %TRUE if the pointer is currently grabbed by this application. -Though this value is not always correct. +@Returns: @@ -301,16 +286,13 @@ available. -Ungrabs the keyboard, if it is grabbed by this application. -@time: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is -available. +@time: -Emits a short beep. diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 7fbedb205e..5b89251424 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -143,6 +143,8 @@ gdk_c_sources = @STRIP_BEGIN@ \ gdkrectangle.c \ gdkregion-generic.c \ gdkregion-generic.h \ + gdkselection.c \ + gdkvisual.c \ gdkwindow.c \ gdkdisplay.c \ gdkscreen.c \ diff --git a/gdk/gdk.def b/gdk/gdk.def index 951e9184f3..51a11c938d 100644 --- a/gdk/gdk.def +++ b/gdk/gdk.def @@ -25,6 +25,7 @@ EXPORTS gdk_colormap_alloc_colors gdk_colormap_change gdk_colormap_free_colors + gdk_colormap_get_screen gdk_colormap_get_system gdk_colormap_get_system_size gdk_colormap_get_type @@ -37,8 +38,10 @@ EXPORTS gdk_colors_free gdk_colors_store gdk_crossing_mode_get_type + gdk_cursor_get_screen gdk_cursor_get_type gdk_cursor_new + gdk_cursor_new_for_screen gdk_cursor_new_from_pixmap gdk_cursor_ref gdk_cursor_type_get_type @@ -54,6 +57,15 @@ EXPORTS gdk_device_set_mode gdk_device_set_source gdk_devices_list + gdk_display_beep + gdk_display_get_default_screen + gdk_display_get_n_screens + gdk_display_get_screen + gdk_display_get_type + gdk_display_keyboard_ungrab + gdk_display_pointer_is_grabbed + gdk_display_pointer_ungrab + gdk_display_sync gdk_drag_abort gdk_drag_action_get_type gdk_drag_begin @@ -96,7 +108,9 @@ EXPORTS gdk_drawable_get_colormap gdk_drawable_get_data gdk_drawable_get_depth + gdk_drawable_get_display gdk_drawable_get_image + gdk_drawable_get_screen gdk_drawable_get_size gdk_drawable_get_type gdk_drawable_get_visible_region @@ -125,6 +139,7 @@ EXPORTS gdk_event_peek gdk_event_put gdk_event_send_client_message + gdk_event_send_client_message_for_display gdk_event_send_clientmessage_toall gdk_event_type_get_type gdk_events_pending @@ -136,11 +151,13 @@ EXPORTS gdk_flush gdk_font_equal gdk_font_from_description + gdk_font_from_description_for_display gdk_font_full_name_free gdk_font_full_name_get gdk_font_get_type gdk_font_id gdk_font_load + gdk_font_load_for_display gdk_font_ref gdk_font_type_get_type gdk_font_unref @@ -178,8 +195,11 @@ EXPORTS gdk_gc_set_values gdk_gc_unref gdk_gc_values_mask_get_type + gdk_get_default_display gdk_get_default_root_window - gdk_get_display + gdk_get_default_screen +; gdk_get_display + gdk_get_display_arg_name gdk_get_program_class gdk_get_show_events gdk_get_use_xshm @@ -215,6 +235,7 @@ EXPORTS gdk_keymap_get_direction gdk_keymap_get_entries_for_keycode gdk_keymap_get_entries_for_keyval + gdk_keymap_get_for_display gdk_keymap_get_type gdk_keymap_lookup_key gdk_keymap_translate_keyboard_state @@ -231,10 +252,12 @@ EXPORTS gdk_mbstowcs gdk_modifier_type_get_type gdk_notify_type_get_type + gdk_open_display gdk_overlap_type_get_type gdk_pango_attr_embossed_new gdk_pango_attr_stipple_new gdk_pango_context_get + gdk_pango_context_get_for_screen gdk_pango_context_set_colormap gdk_pango_layout_get_clip_region gdk_pango_layout_line_get_clip_region @@ -301,16 +324,34 @@ EXPORTS gdk_rgb_set_min_colors gdk_rgb_set_verbose gdk_rgb_xpixel_from_rgb + gdk_screen_get_default_colormap + gdk_screen_get_display + gdk_screen_get_height + gdk_screen_get_monitor_at_point + gdk_screen_get_monitor_geometry + gdk_screen_get_number + gdk_screen_get_rgb_colormap + gdk_screen_get_rgb_visual + gdk_screen_get_root_window + gdk_screen_get_setting + gdk_screen_get_system_colormap + gdk_screen_get_type + gdk_screen_get_width + gdk_screen_get_window_at_pointer gdk_screen_height gdk_screen_height_mm + gdk_screen_set_default_colormap gdk_screen_width gdk_screen_width_mm gdk_scroll_direction_get_type gdk_selection_convert gdk_selection_owner_get + gdk_selection_owner_get_for_display gdk_selection_owner_set + gdk_selection_owner_set_for_display gdk_selection_property_get gdk_selection_send_notify + gdk_selection_send_notify_for_display gdk_set_double_click_time gdk_set_locale gdk_set_pointer_hooks @@ -334,6 +375,7 @@ EXPORTS gdk_text_measure gdk_text_property_to_text_list gdk_text_property_to_utf8_list + gdk_text_property_to_utf8_list_for_display gdk_text_width gdk_text_width_wc gdk_threads_enter @@ -342,6 +384,7 @@ EXPORTS gdk_threads_mutex gdk_unicode_to_keyval gdk_utf8_to_compound_text + gdk_utf8_to_compound_text_for_display gdk_utf8_to_string_target gdk_visibility_state_get_type gdk_visual_get_best @@ -350,6 +393,7 @@ EXPORTS gdk_visual_get_best_with_both gdk_visual_get_best_with_depth gdk_visual_get_best_with_type + gdk_visual_get_screen gdk_visual_get_system gdk_visual_get_type gdk_visual_type_get_type @@ -377,6 +421,7 @@ EXPORTS gdk_window_end_paint gdk_window_focus gdk_window_foreign_new + gdk_window_foreign_new_for_display gdk_window_freeze_updates gdk_window_get_children gdk_window_get_deskrelative_origin @@ -404,6 +449,7 @@ EXPORTS gdk_window_is_viewable gdk_window_is_visible gdk_window_lookup + gdk_window_lookup_for_display gdk_window_lower gdk_window_maximize gdk_window_merge_child_shapes diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c index f1f587f2b9..d3196914e6 100644 --- a/gdk/gdkcolor.c +++ b/gdk/gdkcolor.c @@ -26,6 +26,7 @@ #include +#include "gdkscreen.h" #include "gdkcolor.h" #include "gdkinternals.h" @@ -260,3 +261,18 @@ gdk_color_parse (const gchar *spec, else return FALSE; } + +/** + * gdk_colormap_get_system: + * + * Gets the system's default colormap for the default screen. (See + * gdk_colormap_get_system_for_screen ()) + * + * Return value: the default colormap. + **/ +GdkColormap* +gdk_colormap_get_system (void) +{ + return gdk_screen_get_system_colormap (gdk_get_default_screen ()); +} + diff --git a/gdk/gdkcolor.h b/gdk/gdkcolor.h index 6e73080487..87bfc80d77 100644 --- a/gdk/gdkcolor.h +++ b/gdk/gdkcolor.h @@ -48,7 +48,6 @@ struct _GdkColormap GdkVisual *visual; gpointer windowing_data; - GdkScreen *screen; }; struct _GdkColormapClass @@ -71,6 +70,8 @@ void gdk_colormap_unref (GdkColormap *cmap); GdkColormap* gdk_colormap_get_system (void); #endif +GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap); + #ifndef GDK_DISABLE_DEPRECATED gint gdk_colormap_get_system_size (void); diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c index 4f42d0901b..dc0b5ee813 100644 --- a/gdk/gdkcursor.c +++ b/gdk/gdkcursor.c @@ -25,6 +25,7 @@ */ #include "gdkcursor.h" +#include "gdkscreen.h" #include "gdkinternals.h" GType @@ -78,3 +79,20 @@ gdk_cursor_unref (GdkCursor *cursor) _gdk_cursor_destroy (cursor); } +/** + * gdk_cursor_new: + * @cursor_type: cursor to create + * + * Creates a new cursor from the set of builtin cursors for the default screen. + * See gdk_cursor_new_for_screen(). + * + * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create + * a cursor with no pixels in it. + * + * Return value: a new #GdkCursor + **/ +GdkCursor* +gdk_cursor_new (GdkCursorType cursor_type) +{ + return gdk_cursor_new_for_screen (gdk_get_default_screen(), cursor_type); +} diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 309784732d..f1c8691786 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -22,8 +22,10 @@ */ #include +#include "gdk.h" /* gdk_event_send_client_message() */ #include "gdkdisplay.h" #include "gdkinternals.h" +#include "gdkscreen.h" static void gdk_display_class_init (GdkDisplayClass *class); static void gdk_display_init (GdkDisplay *display); @@ -94,70 +96,6 @@ gdk_display_finalize (GObject *object) parent_class->finalize (object); } -/** - * gdk_display_get_name: - * @display: a #GdkDisplay - * - * Gets the name of the display. - * - * Returns: a string representing the display name. - */ -G_CONST_RETURN gchar * -gdk_display_get_name (GdkDisplay * display) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_DISPLAY_GET_CLASS (display)->get_display_name (display); -} - -/** - * gdk_display_get_n_screens: - * @display: a #GdkDisplay - * - * Gets the number of screen managed by the @display. - * - * Returns: number of screens. - */ - -gint -gdk_display_get_n_screens (GdkDisplay * display) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); - return GDK_DISPLAY_GET_CLASS (display)->get_n_screens (display); -} - -/** - * gdk_display_get_screen: - * @display: a #GdkDisplay - * @screen_num: the screen number - * - * Returns a screen object for one of the screens of the display. - * - * Returns: the #GdkScreen object - */ - -GdkScreen * -gdk_display_get_screen (GdkDisplay * display, gint screen_num) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_DISPLAY_GET_CLASS (display)->get_screen (display, screen_num); -} - -/** - * gdk_display_get_default_screen: - * @display: a #GdkDisplay - * - * Get the default #GdkScreen for @display. - * - * Returns: the default #GdkScreen object for @display - */ - -GdkScreen * -gdk_display_get_default_screen (GdkDisplay * display) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return GDK_DISPLAY_GET_CLASS (display)->get_default_screen (display); -} - /** * gdk_display_close: * @display: a #GdkDisplay @@ -291,3 +229,97 @@ gdk_display_put_event (GdkDisplay *display, _gdk_event_queue_append (display, gdk_event_copy (event)); } + +/** + * gdk_pointer_ungrab: + * @time: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no timestamp is + * available. + * Ungrabs the pointer, if it is grabbed by this application. + **/ +void +gdk_pointer_ungrab (guint32 time) +{ + gdk_display_pointer_ungrab (gdk_get_default_display (), time); +} + +/** + * gdk_pointer_is_grabbed: + * + * Returns %TRUE if the pointer is currently grabbed by this application. + * + * Note that this does not take the inmplicit pointer grab on button + * presses into account. + + * Return value: %TRUE if the pointer is currently grabbed by this application.* + **/ +gboolean +gdk_pointer_is_grabbed (void) +{ + return gdk_display_pointer_is_grabbed (gdk_get_default_display ()); +} + +/** + * gdk_keyboard_ungrab: + * @time: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no + * timestamp is available. + * + * Ungrabs the keyboard, if it is grabbed by this application. + **/ +void +gdk_keyboard_ungrab (guint32 time) +{ + gdk_display_keyboard_ungrab (gdk_get_default_display (), time); +} + +/** + * gdk_beep: + * + * Emits a short beep. + **/ +void +gdk_beep (void) +{ + gdk_display_beep (gdk_get_default_display ()); +} + +/** + * gdk_event_send_client_message: + * @event: the #GdkEvent to send, which should be a #GdkEventClient. + * @xid: the window to send the X ClientMessage event to. + * + * Sends an X ClientMessage event to a given window (which must be + * on the default #GdkDisplay.) + * This could be used for communicating between different applications, + * though the amount of data is limited to 20 bytes. + * + * Return value: non-zero on success. + **/ +gboolean +gdk_event_send_client_message (GdkEvent *event, guint32 xid) +{ + g_return_val_if_fail (event != NULL, FALSE); + + return gdk_event_send_client_message_for_display (gdk_get_default_display (), + event, xid); +} + +/** + * gdk_event_send_clientmessage_toall: + * @event: the #GdkEvent to send, which should be a #GdkEventClient. + * + * Sends an X ClientMessage event to all toplevel windows on the default + * #GdkScreen. + * + * Toplevel windows are determined by checking for the WM_STATE property, as + * described in the Inter-Client Communication Conventions Manual (ICCCM). + * If no windows are found with the WM_STATE property set, the message is sent + * to all children of the root window. + **/ +void +gdk_event_send_clientmessage_toall (GdkEvent *event) +{ + g_return_if_fail (event != NULL); + + gdk_screen_broadcast_client_message (gdk_get_default_screen (), event); +} + diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 0e0e95e6dc..45e4237d13 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -1024,3 +1024,21 @@ gdk_device_get_core_pointer (void) { return _gdk_core_pointer; } + +/** + * gdk_setting_get: + * @name: the name of the setting. + * @value: location to store the value of the setting. + * + * Obtains a desktop-wide setting, such as the double-click time, + * for the default screen. See gdk_screen_get_setting(). + * + * Returns : %TRUE if the setting existed and a value was stored + * in @value, %FALSE otherwise. + **/ +gboolean +gdk_setting_get (const gchar *name, + GValue *value) +{ + return gdk_screen_get_setting (gdk_get_default_screen (), name, value); +} diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c index 9c017840d4..06a3e19eb8 100644 --- a/gdk/gdkfont.c +++ b/gdk/gdkfont.c @@ -24,6 +24,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#include "gdkdisplay.h" #include "gdkfont.h" #include "gdkinternals.h" @@ -174,3 +175,28 @@ gdk_char_height (GdkFont *font, return gdk_text_height (font, &character, 1); } + +/** + * gdk_font_from_description: + * @font_desc: a #PangoFontDescription. + * + * Load a #GdkFont based on a Pango font description. This font will + * only be an approximation of the Pango font, and + * internationalization will not be handled correctly. This function + * should only be used for legacy code that cannot be easily converted + * to use Pango. Using Pango directly will produce better results. + * + * Return value: the newly loaded font, or %NULL if the font + * cannot be loaded. + **/ +GdkFont* +gdk_font_from_description (PangoFontDescription *font_desc) +{ + return gdk_font_from_description_for_display (gdk_get_default_display (),font_desc); +} + +GdkFont* +gdk_font_load (const gchar *font_name) +{ + return gdk_font_load_for_display (gdk_get_default_display(), font_name); +} diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c index d5b145cfb2..1d1c09c5ef 100644 --- a/gdk/gdkimage.c +++ b/gdk/gdkimage.c @@ -411,3 +411,13 @@ _gdk_image_get_scratch (GdkScreen *screen, #endif return image; } + +GdkImage* +gdk_image_new (GdkImageType type, + GdkVisual *visual, + gint width, + gint height) +{ + return _gdk_image_new_for_depth (gdk_visual_get_screen (visual), type, + visual, width, height, -1); +} diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index a582b51691..80826b359e 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -27,6 +27,7 @@ /* Uninstalled header defining types and functions internal to GDK */ #include +#include #include #ifndef __GDK_INTERNALS_H__ @@ -151,6 +152,8 @@ extern GdkDevice *_gdk_core_pointer; extern GSList *_gdk_displays; extern gchar *_gdk_display_name; +extern const GdkPointerHooks *_gdk_current_pointer_hooks; + GdkEvent* _gdk_event_new (void); diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c index 192fa9a2ea..02f08eed4e 100644 --- a/gdk/gdkkeys.c +++ b/gdk/gdkkeys.c @@ -26,6 +26,7 @@ #include +#include "gdkdisplay.h" #include "gdkkeys.h" enum { @@ -271,3 +272,15 @@ gdk_keyval_is_lower (guint keyval) } return FALSE; } + +/** + * gdk_keymap_get_default: + * @returns: the #GdkKeymap attached to the default display. + * + * Returns the #GdkKeymap attached to the default display. + **/ +GdkKeymap* +gdk_keymap_get_default (void) +{ + return gdk_keymap_get_for_display (gdk_get_default_display ()); +} diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c index 1422401ac0..68433b1745 100644 --- a/gdk/gdkpango.c +++ b/gdk/gdkpango.c @@ -22,6 +22,7 @@ #include "gdkpango.h" #include "gdkrgb.h" #include "gdkprivate.h" +#include "gdkscreen.h" #define GDK_INFO_KEY "gdk-info" @@ -823,3 +824,22 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout, return clip_region; } + +/** + * gdk_pango_context_get: + * + * Creates a #PangoContext for the default GDK screen. + * + * The context must be freed when you're finished with it. + * + * When using GTK+, normally you should use gtk_widget_get_pango_context() + * instead of this function, to get the appropriate context for + * the widget you intend to render text onto. + * + * Return value: a new #PangoContext for the default display + **/ +PangoContext * +gdk_pango_context_get (void) +{ + return gdk_pango_context_get_for_screen (gdk_get_default_screen ()); +} diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c index d4a417bcb2..3f24da390e 100644 --- a/gdk/gdkpixbuf-render.c +++ b/gdk/gdkpixbuf-render.c @@ -304,15 +304,19 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, GdkBitmap **mask_return, int alpha_threshold) { - g_return_if_fail (pixbuf != NULL); + GdkScreen *screen; + + g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); + g_return_if_fail (GDK_IS_COLORMAP (colormap)); + + screen = gdk_colormap_get_screen (colormap); if (pixmap_return) { GdkGC *gc; - - *pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window (colormap->screen), + *pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window (screen), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), - gdk_screen_get_rgb_visual (colormap->screen)->depth); + gdk_screen_get_rgb_visual (screen)->depth); gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap); gc = gdk_gc_new (*pixmap_return); @@ -328,7 +332,9 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, { if (gdk_pixbuf_get_has_alpha (pixbuf)) { - *mask_return = gdk_pixmap_new (gdk_screen_get_root_window (colormap->screen), + GdkScreen *screen = gdk_colormap_get_screen (colormap); + + *mask_return = gdk_pixmap_new (gdk_screen_get_root_window (screen), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), 1); gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return, diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index f2bf19e199..6327c21a53 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -507,8 +507,9 @@ gdk_pixmap_colormap_new_from_pixbuf (GdkColormap *colormap, GdkPixmap *pixmap; GdkPixbuf *render_pixbuf; GdkGC *tmp_gc; + GdkScreen *screen = gdk_colormap_get_screen (colormap); - pixmap = gdk_pixmap_new (gdk_screen_get_root_window (colormap->screen), + pixmap = gdk_pixmap_new (gdk_screen_get_root_window (screen), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), gdk_colormap_get_visual (colormap)->depth); @@ -540,7 +541,7 @@ gdk_pixmap_colormap_new_from_pixbuf (GdkColormap *colormap, gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf, colormap, NULL, mask, 128); if (mask && !*mask) - *mask = make_solid_mask (colormap->screen, + *mask = make_solid_mask (screen, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf)); diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c index 93f260578c..8868583109 100644 --- a/gdk/gdkrgb.c +++ b/gdk/gdkrgb.c @@ -222,14 +222,17 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force, gint colors_needed; gint idx; gint best[256]; + GdkScreen *screen; if (!force && nr * ng * nb < gdk_rgb_min_colors) return FALSE; + screen = gdk_visual_get_screen (image_info->visual); + if (image_info->cmap) cmap = image_info->cmap; else - cmap = gdk_screen_get_system_colormap (image_info->visual->screen); + cmap = gdk_screen_get_system_colormap (screen); colors_needed = nr * ng * nb; for (i = 0; i < 256; i++) @@ -239,7 +242,7 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force, } #ifndef GAMMA - if (cmap == gdk_screen_get_system_colormap (image_info->visual->screen)) + if (cmap == gdk_screen_get_system_colormap (screen)) /* find color cube colors that are already present */ for (i = 0; i < MIN (256, cmap->size); i++) { @@ -458,7 +461,7 @@ gdk_rgb_score_visual (GdkVisual *visual) if (quality == 0) return 0; - sys = (visual == gdk_screen_get_system_visual (visual->screen)); + sys = (visual == gdk_screen_get_system_visual (gdk_visual_get_screen (visual))); pseudo = (visual->type == GDK_VISUAL_PSEUDO_COLOR || visual->type == GDK_VISUAL_TRUE_COLOR); @@ -590,6 +593,7 @@ static GdkRgbInfo * gdk_rgb_create_info (GdkVisual *visual, GdkColormap *colormap) { GdkRgbInfo *image_info; + GdkScreen *screen = gdk_visual_get_screen (visual); image_info = g_new0 (GdkRgbInfo, 1); @@ -634,14 +638,14 @@ gdk_rgb_create_info (GdkVisual *visual, GdkColormap *colormap) image_info->visual->depth >= 3)) { if (!image_info->cmap) - image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (visual->screen)); + image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (screen)); gdk_rgb_colorcube_222 (image_info); } else if (image_info->visual->type == GDK_VISUAL_PSEUDO_COLOR) { if (!image_info->cmap && - (gdk_rgb_install_cmap || image_info->visual != gdk_screen_get_system_visual (visual->screen))) + (gdk_rgb_install_cmap || image_info->visual != gdk_screen_get_system_visual (screen))) { image_info->cmap = gdk_colormap_new (image_info->visual, FALSE); image_info->cmap_alloced = TRUE; @@ -659,7 +663,7 @@ gdk_rgb_create_info (GdkVisual *visual, GdkColormap *colormap) image_info->nblue_shades); if (!image_info->cmap) - image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (visual->screen)); + image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (screen)); } #ifdef ENABLE_GRAYSCALE else if (image_info->visual->type == GDK_VISUAL_GRAYSCALE) @@ -679,8 +683,8 @@ gdk_rgb_create_info (GdkVisual *visual, GdkColormap *colormap) { /* Always install colormap in direct color. */ if (image_info->visual->type != GDK_VISUAL_DIRECT_COLOR && - image_info->visual == gdk_screen_get_system_visual (visual->screen)) - image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (visual->screen)); + image_info->visual == gdk_screen_get_system_visual (screen)) + image_info->cmap = gdk_colormap_ref (gdk_screen_get_system_colormap (screen)); else { image_info->cmap = gdk_colormap_new (image_info->visual, FALSE); @@ -691,7 +695,7 @@ gdk_rgb_create_info (GdkVisual *visual, GdkColormap *colormap) image_info->bitmap = (image_info->visual->depth == 1); - image_info->bpp = (_gdk_windowing_get_bits_for_depth (gdk_screen_get_display (visual->screen), image_info->visual->depth) + 7) / 8; + image_info->bpp = (_gdk_windowing_get_bits_for_depth (gdk_screen_get_display (screen), image_info->visual->depth) + 7) / 8; gdk_rgb_select_conv (image_info); if (!gdk_rgb_quark) @@ -2881,10 +2885,11 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info) GdkRgbConvFunc conv_gray, conv_gray_d; GdkRgbConvFunc conv_indexed, conv_indexed_d; gboolean mask_rgb, mask_bgr; + GdkScreen *screen = gdk_visual_get_screen (image_info->visual); depth = image_info->visual->depth; - bpp = _gdk_windowing_get_bits_for_depth (gdk_screen_get_display (image_info->visual->screen), + bpp = _gdk_windowing_get_bits_for_depth (gdk_screen_get_display (screen), image_info->visual->depth); byte_order = image_info->visual->byte_order; diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c index 078134d07f..294273783e 100644 --- a/gdk/gdkscreen.c +++ b/gdk/gdkscreen.c @@ -21,8 +21,11 @@ * Boston, MA 02111-1307, USA. */ -#include "gdkscreen.h" +#include "gdk.h" /* For gdk_rectangle_intersect() */ #include "gdkcolor.h" +#include "gdkinternals.h" +#include "gdkwindow.h" +#include "gdkscreen.h" GType gdk_screen_get_type (void) @@ -51,176 +54,6 @@ gdk_screen_get_type (void) return object_type; } -/** - * gdk_screen_get_default_colormap: - * @screen: a #GdkScreen - * - * Gets the default colormap for @screen. - * - * Returns: the default #GdkColormap. - **/ -GdkColormap * -gdk_screen_get_default_colormap (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_default_colormap (screen); -} - -/** - * gdk_screen_set_default_colormap: - * @screen: a #GdkScreen - * @colormap: a #GdkColormap - * - * Sets the default @colormap for @screen. - **/ -void -gdk_screen_set_default_colormap (GdkScreen *screen, - GdkColormap *colormap) -{ - g_return_if_fail (GDK_IS_SCREEN (screen)); - g_return_if_fail (GDK_IS_COLORMAP (colormap)); - - GDK_SCREEN_GET_CLASS (screen)->set_default_colormap (screen, colormap); -} - -/** - * gdk_screen_get_root_window: - * @screen: a #GdkScreen - * - * Gets the root window of @screen. - * - * Returns: the root window - **/ -GdkWindow * -gdk_screen_get_root_window (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_root_window (screen); -} - -/** - * gdk_screen_get_display: - * @screen: a #GdkScreen - * - * Gets the display to which the @screen belongs. - * - * Returns: the display to which @screen belongs - **/ -GdkDisplay * -gdk_screen_get_display (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_display (screen); -} - -/** - * gdk_screen_get_number: - * @screen: a #GdkScreen - * - * Gets the index of @screen among the screens in the display - * to which it belongs. (See gdk_screen_get_display()) - * - * Returns: the index - **/ -gint -gdk_screen_get_number (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_screen_num (screen); -} - -/** - * gdk_screen_get_window_at_pointer: - * @screen: a #GdkScreen - * @win_x: return location for origin of the window under the pointer - * @win_y: return location for origin of the window under the pointer - * - * Obtains the window underneath the mouse pointer, returning the location - * of that window in @win_x, @win_y for @screen. Returns %NULL if the window - * under the mouse pointer is not known to GDK (for example, belongs to - * another application). - * - * Returns: the window under the mouse pointer, or %NULL - **/ -GdkWindow * -gdk_screen_get_window_at_pointer (GdkScreen *screen, - gint *win_x, - gint *win_y) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_window_at_pointer (screen, win_x, win_y); -} - -/** - * gdk_screen_get_width: - * @screen: a #GdkScreen - * - * Gets the width of @screen in pixels - * - * Returns: the width of @screen in pixels. - **/ -gint -gdk_screen_get_width (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_width (screen); -} - -/** - * gdk_screen_get_height: - * @screen: a #GdkScreen - * - * Gets the height of @screen in pixels - * - * Returns: the height of @screen in pixels. - **/ -gint -gdk_screen_get_height (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_height (screen); -} - -/** - * gdk_screen_get_width_mm: - * @screen: a #GdkScreen - * - * Gets the width of @screen in millimeters. - * Note that on some X servers this value will not be correct. - * - * Returns: the width of @screen in pixels. - **/ -gint -gdk_screen_get_width_mm (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_width_mm (screen); -} - -/** - * gdk_screen_get_height_mm: - * @screen: a #GdkScreen - * - * Returns the height of @screen in millimeters. - * Note that on some X servers this value will not be correct. - * - * Returns: the heigth of @screen in pixels. - **/ -gint -gdk_screen_get_height_mm (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_height_mm (screen); -} /** * gdk_screen_close: @@ -237,47 +70,6 @@ gdk_screen_close (GdkScreen *screen) g_object_run_dispose (G_OBJECT (screen)); } -/** - * gdk_screen_get_n_monitors: - * @screen : a #GdkScreen. - * - * Returns the number of monitors being part of the virtual screen - * - * Returns: number of monitors part of the virtual screen or - * 0 if @screen is not in virtual screen mode. - **/ -gint -gdk_screen_get_n_monitors (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - - return GDK_SCREEN_GET_CLASS (screen)->get_n_monitors (screen); -} - -/** - * gdk_screen_get_monitor_geometry: - * @screen : a #GdkScreen. - * @monitor_num: the monitor number. - * @dest : a #GdkRectangle to be filled with the monitor geometry - * - * Retrieves the #GdkRectangle representing the size and start - * coordinates of the individual monitor within the the entire virtual - * screen. - * - * Note that the virtual screen coordinates can be retrieved via - * gdk_screen_get_width() and gdk_screen_get_height(). - * - **/ -void -gdk_screen_get_monitor_geometry (GdkScreen *screen, - gint monitor_num, - GdkRectangle *dest) -{ - g_return_if_fail (GDK_IS_SCREEN (screen)); - - GDK_SCREEN_GET_CLASS (screen)->get_monitor_geometry (screen, monitor_num, dest); -} - /** * gdk_screen_get_monitor_at_point: * @screen : a #GdkScreen. @@ -353,3 +145,80 @@ gdk_screen_get_monitor_at_window (GdkScreen *screen, } return screen_num; } + +/** + * gdk_screen_width: + * + * Returns the width of the default screen in pixels. + * + * Return value: the width of the default screen in pixels. + **/ +gint +gdk_screen_width (void) +{ + return gdk_screen_get_width (gdk_get_default_screen()); +} + +/** + * gdk_screen_height: + * + * Returns the height of the default screen in pixels. + * + * Return value: the height of the default screen in pixels. + **/ +gint +gdk_screen_height (void) +{ + return gdk_screen_get_height (gdk_get_default_screen()); +} + +/** + * gdk_screen_width_mm: + * + * Returns the width of the default screen in millimeters. + * Note that on many X servers this value will not be correct. + * + * Return value: the width of the default screen in millimeters, + * though it is not always correct. + **/ +gint +gdk_screen_width_mm (void) +{ + return gdk_screen_get_width_mm (gdk_get_default_screen()); +} + +/** + * gdk_screen_height_mm: + * + * Returns the height of the default screen in millimeters. + * Note that on many X servers this value will not be correct. + * + * Return value: the height of the default screen in millimeters, + * though it is not always correct. + **/ +gint +gdk_screen_height_mm (void) +{ + return gdk_screen_get_height_mm (gdk_get_default_screen ()); +} + +/** + * gdk_screen_get_window_at_pointer: + * @screen: a #GdkScreen + * @win_x: return location for origin of the window under the pointer + * @win_y: return location for origin of the window under the pointer + * + * Obtains the window underneath the mouse pointer, returning the location + * of that window in @win_x, @win_y for @screen. Returns %NULL if the window + * under the mouse pointer is not known to GDK (for example, belongs to + * another application). + * + * Returns: the window under the mouse pointer, or %NULL + **/ +GdkWindow * +gdk_screen_get_window_at_pointer (GdkScreen *screen, + gint *win_x, + gint *win_y) +{ + return _gdk_current_pointer_hooks->window_at_pointer (screen, win_x, win_y); +} diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h index 1fd5ffcab3..8c6e6fff92 100644 --- a/gdk/gdkscreen.h +++ b/gdk/gdkscreen.h @@ -46,25 +46,6 @@ struct _GdkScreen struct _GdkScreenClass { GObjectClass parent_class; - - GdkDisplay * (*get_display) (GdkScreen *screen); - gint (*get_width) (GdkScreen *screen); - gint (*get_height) (GdkScreen *screen); - gint (*get_width_mm) (GdkScreen *screen); - gint (*get_height_mm) (GdkScreen *screen); - gint (*get_root_depth) (GdkScreen *screen); - gint (*get_screen_num) (GdkScreen *screen); - GdkWindow * (*get_root_window) (GdkScreen *screen); - GdkColormap * (*get_default_colormap) (GdkScreen *screen); - void (*set_default_colormap) (GdkScreen *screen, - GdkColormap *colormap); - GdkWindow * (*get_window_at_pointer) (GdkScreen *screen, - gint *win_x, - gint *win_y); - gint (*get_n_monitors) (GdkScreen *screen); - void (*get_monitor_geometry) (GdkScreen *screen, - gint monitor_num, - GdkRectangle *dest); }; GType gdk_screen_get_type (void); diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c new file mode 100644 index 0000000000..d5c1729b40 --- /dev/null +++ b/gdk/gdkselection.c @@ -0,0 +1,86 @@ +#include "gdkproperty.h" +#include "gdkdisplay.h" +#include "gdkselection.h" + +gboolean +gdk_selection_owner_set (GdkWindow *owner, + GdkAtom selection, + guint32 time, + gboolean send_event) +{ + return gdk_selection_owner_set_for_display (gdk_get_default_display (), + owner, selection, + time, send_event); +} + +GdkWindow* +gdk_selection_owner_get (GdkAtom selection) +{ + return gdk_selection_owner_get_for_display (gdk_get_default_display (), + selection); +} + +void +gdk_selection_send_notify (guint32 requestor, + GdkAtom selection, + GdkAtom target, + GdkAtom property, + guint32 time) +{ + gdk_selection_send_notify_for_display (gdk_get_default_display (), + requestor, selection, + target, property, time); +} + +/** + * gdk_text_property_to_utf8_list: + * @encoding: an atom representing the encoding of the text + * @format: the format of the property + * @text: the text to convert + * @length: the length of @text, in bytes + * @list: location to store the list of strings or %NULL. The + * list should be freed with g_strfreev(). + * + * Convert a text property in the giving encoding to + * a list of UTF-8 strings. + * + * Return value: the number of strings in the resulting + * list. + **/ +gint +gdk_text_property_to_utf8_list (GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list) +{ + return gdk_text_property_to_utf8_list_for_display (gdk_get_default_display (), + encoding, format, text, length, list); +} + +/** + * gdk_utf8_to_compound_text: + * @str: a UTF-8 string + * @encoding: location to store resulting encoding + * @format: location to store format of the result + * @ctext: location to store the data of the result + * @length: location to store the length of the data + * stored in @ctext + * + * Convert from UTF-8 to compound text. + * + * Return value: %TRUE if the conversion succeeded, otherwise + * false. + **/ +gboolean +gdk_utf8_to_compound_text (const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length) +{ + return gdk_utf8_to_compound_text_for_display (gdk_get_default_display (), + str, encoding, format, + ctext, length); +} + diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c new file mode 100644 index 0000000000..3873ec115b --- /dev/null +++ b/gdk/gdkvisual.c @@ -0,0 +1,59 @@ +/* GDK - The GIMP Drawing Kit + * gdkvisual.c + * + * Copyright 2001 Sun Microsystems Inc. + * + * Erwann Chenede + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gdkvisual.h" +#include "gdkscreen.h" + +/** + * gdk_list_visuals: + * + * Lists the available visuals for the default screen. + * (See gdk_screen_list_visuals()) + * A visual describes a hardware image data format. + * For example, a visual might support 24-bit color, or 8-bit color, + * and might expect pixels to be in a certain format. + * + * Call g_list_free() on the return value when you're finished with it. + * + * Return value: a list of visuals; the list must be freed, but not its contents + **/ +GList* +gdk_list_visuals (void) +{ + return gdk_screen_list_visuals (gdk_get_default_screen ()); +} + +/** + * gdk_visual_get_system: + * + * Get the system'sdefault visual for the default GDK screen. + * This is the visual for the root window of the display. + * The return value should not be freed. + * + * Return value: system visual + **/ +GdkVisual* +gdk_visual_get_system (void) +{ + return gdk_screen_get_system_visual (gdk_get_default_screen()); +} diff --git a/gdk/gdkvisual.h b/gdk/gdkvisual.h index a97adbb462..0bca535568 100644 --- a/gdk/gdkvisual.h +++ b/gdk/gdkvisual.h @@ -65,8 +65,6 @@ struct _GdkVisual guint32 blue_mask; gint blue_shift; gint blue_prec; - - GdkScreen *screen; }; GType gdk_visual_get_type (void); @@ -89,6 +87,8 @@ void gdk_query_visual_types (GdkVisualType **visual_types, GList* gdk_list_visuals (void); #endif +GdkScreen *gdk_visual_get_screen (GdkVisual *visual); + #ifndef GDK_DISABLE_DEPRECATED #define gdk_visual_ref(v) g_object_ref(v) #define gdk_visual_unref(v) g_object_unref(v) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 0c0fb2e7e9..32f286dc48 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -49,7 +49,7 @@ static const GdkPointerHooks default_pointer_hooks = { _gdk_windowing_window_at_pointer }; -static const GdkPointerHooks *current_pointer_hooks = &default_pointer_hooks; +const GdkPointerHooks *_gdk_current_pointer_hooks = &default_pointer_hooks; static GdkGC *gdk_window_create_gc (GdkDrawable *drawable, GdkGCValues *values, @@ -2713,12 +2713,12 @@ gdk_window_constrain_size (GdkGeometry *geometry, GdkPointerHooks * gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks) { - const GdkPointerHooks *result = current_pointer_hooks; + const GdkPointerHooks *result = _gdk_current_pointer_hooks; if (new_hooks) - current_pointer_hooks = new_hooks; + _gdk_current_pointer_hooks = new_hooks; else - current_pointer_hooks = &default_pointer_hooks; + _gdk_current_pointer_hooks = &default_pointer_hooks; return (GdkPointerHooks *)result; } @@ -2745,7 +2745,7 @@ gdk_window_get_pointer (GdkWindow *window, { g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL); - return current_pointer_hooks->get_pointer (window, x, y, mask); + return _gdk_current_pointer_hooks->get_pointer (window, x, y, mask); } /** @@ -2767,7 +2767,7 @@ GdkWindow* gdk_window_at_pointer (gint *win_x, gint *win_y) { - return current_pointer_hooks->window_at_pointer (gdk_get_default_screen (), win_x, win_y); + return gdk_screen_get_window_at_pointer (gdk_get_default_screen (), win_x, win_y); } /** @@ -2784,3 +2784,22 @@ gdk_get_default_root_window (void) return gdk_screen_get_root_window (gdk_get_default_screen ()); } +/** + * gdk_window_foreign_new: + * @anid: a native window handle. + * + * Wraps a native window for the default display in a #GdkWindow. + * This may fail if the window has been destroyed. + * + * For example in the X backend, a native window handle is an Xlib + * XID. + * + * Return value: the newly-created #GdkWindow wrapper for the + * native window or %NULL if the window has been destroyed. + **/ +GdkWindow * +gdk_window_foreign_new (GdkNativeWindow anid) +{ + return gdk_window_foreign_new_for_display (gdk_get_default_display (), anid); +} + diff --git a/gdk/makefile.msc b/gdk/makefile.msc index b904e0f4a1..831f9b3c80 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -83,6 +83,8 @@ gdk_OBJECTS = \ gdkrectangle.obj \ gdkregion-generic.obj \ gdkrgb.obj \ + gdkselection.obj \ + gdkvisual.obj \ gdkwindow.obj gdk_public_h_sources = \ diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am index a17397f1cc..92c7a35d48 100644 --- a/gdk/win32/Makefile.am +++ b/gdk/win32/Makefile.am @@ -49,6 +49,7 @@ libgdk_win32_la_SOURCES = \ xcursors.h \ gdkcolor-win32.c \ gdkcursor-win32.c \ + gdkdisplay-win32.c \ gdkdnd-win32.c \ gdkdrawable-win32.c \ gdkdrawable-win32.h \ @@ -69,6 +70,7 @@ libgdk_win32_la_SOURCES = \ gdkpixmap-win32.h \ gdkprivate-win32.h \ gdkproperty-win32.c \ + gdkscreen-win32.c \ gdkselection-win32.c \ gdkvisual-win32.c \ gdkwin32.h \ diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c index 2259857c07..e5b9af66a7 100644 --- a/gdk/win32/gdkcolor-win32.c +++ b/gdk/win32/gdkcolor-win32.c @@ -30,6 +30,7 @@ #include #include "gdkcolor.h" +#include "gdkscreen.h" /* gdk_get_default_screen() */ #include "gdkinternals.h" #include "gdkprivate-win32.h" @@ -679,11 +680,13 @@ gdk_colormap_new (GdkVisual *visual, } GdkColormap* -gdk_colormap_get_system (void) +gdk_screen_get_system_colormap (GdkScreen *screen) { static GdkColormap *colormap = NULL; GdkColormapPrivateWin32 *private; + g_return_val_if_fail (screen == gdk_get_default_screen (), NULL); + if (!colormap) { colormap = g_object_new (gdk_colormap_get_type (), NULL); @@ -1384,3 +1387,12 @@ gdk_colormap_match_color (GdkColormap *cmap, return index; } + +GdkScreen* +gdk_colormap_get_screen (GdkColormap *cmap) +{ + g_return_val_if_fail (cmap != NULL, NULL); + + return gdk_get_default_screen (); +} + diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c index 85e040c089..aeac1a7a87 100644 --- a/gdk/win32/gdkcursor-win32.c +++ b/gdk/win32/gdkcursor-win32.c @@ -18,6 +18,7 @@ * Boston, MA 02111-1307, USA. */ +#include "gdkscreen.h" #include "gdkcursor.h" #include "gdkprivate-win32.h" @@ -83,12 +84,15 @@ _gdk_win32_data_to_wcursor (GdkCursorType cursor_type) } GdkCursor* -gdk_cursor_new (GdkCursorType cursor_type) +gdk_cursor_new_for_screen (GdkScreen *screen, + GdkCursorType cursor_type) { GdkCursorPrivate *private; GdkCursor *cursor; HCURSOR hcursor; + g_return_val_if_fail (screen == gdk_get_default_screen (), NULL); + hcursor = _gdk_win32_data_to_wcursor (cursor_type); if (hcursor == NULL) @@ -302,3 +306,9 @@ _gdk_cursor_destroy (GdkCursor *cursor) g_free (private); } + +GdkScreen * +gdk_cursor_get_screen (GdkCursor *cursor) +{ + return gdk_get_default_screen (); +} diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c new file mode 100644 index 0000000000..54dbe24c62 --- /dev/null +++ b/gdk/win32/gdkdisplay-win32.c @@ -0,0 +1,80 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2002 Hans Breuer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "gdkdisplay.h" +#include "gdkscreen.h" +#include "gdkprivate-win32.h" + +GdkDisplay *_gdk_display = NULL; +GdkScreen *_gdk_screen = NULL; + +void +_gdk_windowing_set_default_display (GdkDisplay *display) +{ + g_assert (_gdk_display == display); +} + +GdkDisplay * +gdk_open_display (const gchar *display_name) +{ + if (_gdk_display != NULL) + return NULL; /* single display only */ + + _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); + _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); + + gdk_set_default_display (_gdk_display); + + _gdk_visual_init (); + _gdk_windowing_window_init (); + _gdk_windowing_image_init (); + _gdk_events_init (); + _gdk_input_init (); + _gdk_dnd_init (); + + return _gdk_display; +} + +G_CONST_RETURN gchar* +gdk_display_get_display_name (GdkDisplay *display) +{ + return gdk_get_display_arg_name (); +} + +static gint +gdk_display_get_n_screens (GdkDisplay * display) +{ + return 1; +} + +static GdkScreen * +gdk_display_get_screen (GdkDisplay *display, + gint screen_num) +{ + g_return_if_fail (screen_num == 0); + + return _gdk_screen; +} + +static GdkScreen * +gdk_display_get_default_screen (GdkDisplay * display) +{ + return _gdk_screen; +} + diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 62b9c3f9d4..5bc3d186c8 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -112,6 +112,8 @@ static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable); static gint gdk_win32_get_depth (GdkDrawable *drawable); +static GdkScreen * gdk_win32_get_screen (GdkDrawable *drawable); + static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable); static void gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass); @@ -208,6 +210,7 @@ gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass) drawable_class->get_colormap = gdk_win32_get_colormap; drawable_class->get_depth = gdk_win32_get_depth; + drawable_class->get_screen = gdk_win32_get_screen; drawable_class->get_visual = gdk_win32_get_visual; drawable_class->_copy_to_image = _gdk_win32_copy_to_image; @@ -1444,6 +1447,12 @@ gdk_win32_get_depth (GdkDrawable *drawable) return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper); } +static GdkScreen* +gdk_win32_get_screen (GdkDrawable *drawable) +{ + return gdk_get_default_screen (); +} + static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable) { diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 1189f95247..7d0c939fb9 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -88,7 +88,8 @@ static GdkFilterReturn gdk_event_apply_filters(MSG *msg, GdkEvent *event, GList *filters); -static gboolean gdk_event_translate (GdkEvent *event, +static gboolean gdk_event_translate (GdkDisplay *display, + GdkEvent *event, MSG *msg, gboolean *ret_val_flagp, gint *ret_valp, @@ -152,6 +153,8 @@ real_window_procedure (HWND hwnd, WPARAM wparam, LPARAM lparam) { + /* any way to have more than one display on win32 ? */ + GdkDisplay *display = gdk_get_default_display (); GdkEventPrivate event; GdkEvent *eventp; MSG msg; @@ -172,14 +175,14 @@ real_window_procedure (HWND hwnd, msg.pt.y = HIWORD (pos); event.flags = GDK_EVENT_PENDING; - if (gdk_event_translate (&event.event, &msg, &ret_val_flag, &ret_val, FALSE)) + if (gdk_event_translate (display, &event.event, &msg, &ret_val_flag, &ret_val, FALSE)) { event.flags &= ~GDK_EVENT_PENDING; #if 1 if (event.event.any.type == GDK_CONFIGURE) { /* Compress configure events */ - GList *list = _gdk_queued_events; + GList *list = display->queued_events; while (list != NULL && (((GdkEvent *)list->data)->any.type != GDK_CONFIGURE @@ -199,7 +202,7 @@ real_window_procedure (HWND hwnd, else if (event.event.any.type == GDK_EXPOSE) { /* Compress expose events */ - GList *list = _gdk_queued_events; + GList *list = display->queued_events; while (list != NULL && (((GdkEvent *)list->data)->any.type != GDK_EXPOSE @@ -243,7 +246,7 @@ real_window_procedure (HWND hwnd, } else { - _gdk_event_queue_append (eventp); + _gdk_event_queue_append (display, eventp); #if 1 /* Wake up WaitMessage */ PostMessage (NULL, gdk_ping_msg, 0, 0); @@ -386,8 +389,9 @@ gboolean gdk_events_pending (void) { MSG msg; + GdkDisplay *display = gdk_get_default_display (); - return (_gdk_event_queue_find_first() || + return (_gdk_event_queue_find_first (display) || PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)); } @@ -425,7 +429,8 @@ gdk_event_get_graphics_expose (GdkWindow *window) { event = _gdk_event_new (); - if (gdk_event_translate (event, &msg, NULL, NULL, TRUE)) + if (gdk_event_translate (gdk_drawable_get_display (window), + event, &msg, NULL, NULL, TRUE)) return event; else gdk_event_free (event); @@ -560,25 +565,13 @@ gdk_pointer_grab (GdkWindow *window, return return_val; } -/* - *-------------------------------------------------------------- - * gdk_pointer_ungrab - * - * Releases any pointer grab - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - void -gdk_pointer_ungrab (guint32 time) +gdk_display_pointer_ungrab (GdkDisplay *display, + guint32 time) { GDK_NOTE (EVENTS, g_print ("gdk_pointer_ungrab\n")); + g_return_if_fail (display == gdk_get_default_display ()); + #if 0 _gdk_input_ungrab_pointer (time); #endif @@ -648,45 +641,22 @@ find_window_for_pointer_event (GdkWindow* reported_window, return other_window; } -/* - *-------------------------------------------------------------- - * gdk_pointer_is_grabbed - * - * Tell wether there is an active x pointer grab in effect - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - gboolean -gdk_pointer_is_grabbed (void) +gdk_display_pointer_is_grabbed (GdkDisplay *display) { + g_return_val_if_fail (display == gdk_get_default_display (), FALSE); GDK_NOTE (EVENTS, g_print ("gdk_pointer_is_grabbed: %s\n", p_grab_window != NULL ? "TRUE" : "FALSE")); return p_grab_window != NULL; } -/** - * gdk_pointer_grab_info_libgtk_only: - * @grab_window: location to store current grab window - * @owner_events: location to store boolean indicating whether - * the @owner_events flag to gdk_pointer_grab() was %TRUE. - * - * Determines information about the current pointer grab. - * This is not public API and must not be used by applications. - * - * Return value: %TRUE if this application currently has the - * pointer grabbed. - **/ gboolean -gdk_pointer_grab_info_libgtk_only (GdkWindow **grab_window, +gdk_pointer_grab_info_libgtk_only (GdkDisplay *display, + GdkWindow **grab_window, gboolean *owner_events) { + g_return_val_if_fail (display == gdk_get_default_display (), FALSE); + if (p_grab_window != NULL) { if (grab_window) @@ -747,24 +717,12 @@ gdk_keyboard_grab (GdkWindow *window, return return_val; } -/* - *-------------------------------------------------------------- - * gdk_keyboard_ungrab - * - * Releases any keyboard grab - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - void -gdk_keyboard_ungrab (guint32 time) +gdk_display_keyboard_ungrab (GdkDisplay *display, + guint32 time) { + g_return_if_fail (display == gdk_get_default_display ()); + GDK_NOTE (EVENTS, g_print ("gdk_keyboard_ungrab\n")); k_grab_window = NULL; @@ -783,9 +741,12 @@ gdk_keyboard_ungrab (guint32 time) * keyboard grabbed. **/ gboolean -gdk_keyboard_grab_info_libgtk_only (GdkWindow **grab_window, +gdk_keyboard_grab_info_libgtk_only (GdkDisplay *display, + GdkWindow **grab_window, gboolean *owner_events) { + g_return_val_if_fail (display == gdk_get_default_display (), FALSE); + if (k_grab_window) { if (grab_window) @@ -1212,7 +1173,7 @@ synthesize_enter_or_leave_event (GdkWindow *window, event->crossing.focus = TRUE; /* ??? */ event->crossing.state = 0; /* ??? */ - _gdk_event_queue_append (event); + _gdk_event_queue_append (gdk_drawable_get_display (window), event); if (type == GDK_ENTER_NOTIFY && GDK_WINDOW_OBJECT (window)->extension_events != 0) @@ -1428,7 +1389,7 @@ synthesize_expose_events (GdkWindow *window) event->expose.region = gdk_region_rectangle (&(event->expose.area)); event->expose.count = 0; - _gdk_event_queue_append (event); + _gdk_event_queue_append (gdk_drawable_get_display (window), event); GDK_NOTE (EVENTS_OR_COLORMAP, print_event (event)); } @@ -1860,7 +1821,8 @@ _gdk_win32_hrgn_to_region (HRGN hrgn) } static gboolean -gdk_event_translate (GdkEvent *event, +gdk_event_translate (GdkDisplay *display, + GdkEvent *event, MSG *msg, gboolean *ret_val_flagp, gint *ret_valp, @@ -2472,7 +2434,7 @@ gdk_event_translate (GdkEvent *event, build_keypress_event (event2, msg); event2->key.window = window; gdk_drawable_ref (window); - _gdk_event_queue_append (event2); + _gdk_event_queue_append (display, event2); GDK_NOTE (EVENTS, print_event (event2)); } /* Return the key release event. */ @@ -2560,7 +2522,7 @@ gdk_event_translate (GdkEvent *event, event->button.button = button; event->button.device = _gdk_core_pointer; - _gdk_event_button_generate (event); + _gdk_event_button_generate (display, event); return_val = !GDK_WINDOW_DESTROYED (window); break; @@ -2947,7 +2909,7 @@ gdk_event_translate (GdkEvent *event, return_val = !GDK_WINDOW_DESTROYED (window); if (return_val) { - GList *list = _gdk_queued_events; + GList *list = display->queued_events; while (list != NULL ) { if ((((GdkEvent *)list->data)->any.type == GDK_EXPOSE) && @@ -3367,13 +3329,13 @@ done: } void -_gdk_events_queue (void) +_gdk_events_queue (GdkDisplay *display) { MSG msg; GdkEvent *event; GList *node; - while (!_gdk_event_queue_find_first () + while (!_gdk_event_queue_find_first (display) && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { #ifndef HAVE_DIMM_H @@ -3395,16 +3357,16 @@ _gdk_events_queue (void) ((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING; - _gdk_event_queue_append (event); + _gdk_event_queue_append (display, event); node = _gdk_queued_tail; - if (gdk_event_translate (event, &msg, NULL, NULL, FALSE)) + if (gdk_event_translate (display, event, &msg, NULL, NULL, FALSE)) { ((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING; } else { - _gdk_event_queue_remove_link (node); + _gdk_event_queue_remove_link (display, node); g_list_free_1 (node); gdk_event_free (event); DispatchMessage (&msg); @@ -3420,12 +3382,13 @@ gdk_event_prepare (GSource *source, { MSG msg; gboolean retval; + GdkDisplay *display = gdk_get_default_display (); GDK_THREADS_ENTER (); *timeout = -1; - retval = (_gdk_event_queue_find_first () != NULL) + retval = (_gdk_event_queue_find_first (display) != NULL) || PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); GDK_THREADS_LEAVE (); @@ -3438,11 +3401,12 @@ gdk_event_check (GSource *source) { MSG msg; gboolean retval; + GdkDisplay *display = gdk_get_default_display (); GDK_THREADS_ENTER (); if (event_poll_fd.revents & G_IO_IN) - retval = (_gdk_event_queue_find_first () != NULL) + retval = (_gdk_event_queue_find_first (display) != NULL) || PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); else retval = FALSE; @@ -3458,11 +3422,12 @@ gdk_event_dispatch (GSource *source, gpointer user_data) { GdkEvent *event; + GdkDisplay *display = gdk_get_default_display (); GDK_THREADS_ENTER (); - _gdk_events_queue(); - event = _gdk_event_unqueue(); + _gdk_events_queue (display); + event = _gdk_event_unqueue (display); if (event) { @@ -3479,14 +3444,17 @@ gdk_event_dispatch (GSource *source, /* Sends a ClientMessage to all toplevel client windows */ gboolean -gdk_event_send_client_message (GdkEvent *event, guint32 xid) +gdk_event_send_client_message_for_display (GdkDisplay *display, + GdkEvent *event, + guint32 xid) { /* XXX */ return FALSE; } void -gdk_event_send_clientmessage_toall (GdkEvent *event) +gdk_screen_broadcast_client_message (GdkScreen *screen, + GdkEvent *event) { /* XXX */ } @@ -3508,6 +3476,21 @@ gdk_flush (void) GdiFlush (); } +void +gdk_display_sync (GdkDisplay * display) +{ + MSG msg; + + g_return_if_fail (display == gdk_get_default_display ()); + + /* Process all messages currently available */ + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage (&msg); + DispatchMessage (&msg); + } +} + #ifdef G_ENABLE_DEBUG gchar * diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c index 87aab50b52..29639eff62 100644 --- a/gdk/win32/gdkfont-win32.c +++ b/gdk/win32/gdkfont-win32.c @@ -33,6 +33,7 @@ #include "gdkfont.h" #include "gdkpango.h" /* gdk_pango_context_get() */ +#include "gdkdisplay.h" #include "gdkprivate-win32.h" static GHashTable *font_name_hash = NULL; @@ -1515,7 +1516,8 @@ gdk_font_from_one_singlefont (GdkWin32SingleFont *singlefont) } GdkFont* -gdk_font_load (const gchar *font_name) +gdk_font_load_for_display (GdkDisplay *display, + const gchar *font_name) { GdkFont *font; GdkFontPrivateWin32 *private; @@ -1524,6 +1526,7 @@ gdk_font_load (const gchar *font_name) TEXTMETRIC textmetric; g_return_val_if_fail (font_name != NULL, NULL); + g_return_val_if_fail (display == gdk_get_default_display (), NULL); font = gdk_font_hash_lookup (GDK_FONT_FONTSET, font_name); if (font) @@ -1571,13 +1574,15 @@ gdk_font_load (const gchar *font_name) * cannot be loaded. **/ GdkFont* -gdk_font_from_description (PangoFontDescription *font_desc) +gdk_font_from_description_for_display (GdkDisplay *display, + PangoFontDescription *font_desc) { PangoFontMap *font_map; PangoFont *font; GdkFont *result = NULL; g_return_val_if_fail (font_desc != NULL, NULL); + g_return_val_if_fail (display == gdk_get_default_display (), NULL); font_map = pango_win32_font_map_for_display (); font = pango_font_map_load_font (font_map, gdk_pango_context_get (), font_desc); diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index c6d3075223..026b158ba8 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -27,6 +27,7 @@ #include "gdkimage.h" #include "gdkpixmap.h" +#include "gdkscreen.h" /* gdk_get_default_screen() */ #include "gdkprivate-win32.h" static GList *image_list = NULL; @@ -196,7 +197,8 @@ _gdk_windowing_image_init (void) } GdkImage* -_gdk_image_new_for_depth (GdkImageType type, +_gdk_image_new_for_depth (GdkScreen *screen, + GdkImageType type, GdkVisual *visual, gint width, gint height, @@ -206,6 +208,7 @@ _gdk_image_new_for_depth (GdkImageType type, g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL); g_return_val_if_fail (visual || depth != -1, NULL); + g_return_val_if_fail (screen == gdk_get_default_screen (), NULL); if (visual) depth = visual->depth; @@ -221,15 +224,6 @@ _gdk_image_new_for_depth (GdkImageType type, return GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->image; } -GdkImage* -gdk_image_new (GdkImageType type, - GdkVisual *visual, - gint width, - gint height) -{ - return _gdk_image_new_for_depth (type, visual, width, height, -1); -} - GdkImage* _gdk_win32_copy_to_image (GdkDrawable *drawable, GdkImage *image, @@ -241,6 +235,7 @@ _gdk_win32_copy_to_image (GdkDrawable *drawable, gint height) { GdkGC *gc; + GdkScreen *screen = gdk_drawable_get_screen (drawable); g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable), NULL); g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL); @@ -249,7 +244,7 @@ _gdk_win32_copy_to_image (GdkDrawable *drawable, GDK_DRAWABLE_HANDLE (drawable))); if (!image) - image = _gdk_image_new_for_depth (GDK_IMAGE_FASTEST, NULL, width, height, + image = _gdk_image_new_for_depth (screen, GDK_IMAGE_FASTEST, NULL, width, height, gdk_drawable_get_depth (drawable)); gc = gdk_gc_new ((GdkDrawable *) image->windowing_data); @@ -384,8 +379,11 @@ gdk_win32_image_destroy (GdkImage *image) } gint -_gdk_windowing_get_bits_for_depth (gint depth) +_gdk_windowing_get_bits_for_depth (GdkDisplay *display, + gint depth) { + g_return_val_if_fail (display == gdk_get_default_display (), 0); + switch (depth) { case 1: diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index d98dd46d2c..0657449a6c 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -696,6 +696,7 @@ _gdk_input_other_event (GdkEvent *event, #if !USE_SYSCONTEXT GdkWindow *current_window; #endif + GdkDisplay *display; GdkWindowObject *obj; GdkWindowImplWin32 *impl; GdkInputWindow *input_window; @@ -719,6 +720,7 @@ _gdk_input_other_event (GdkEvent *event, window = _gdk_parent_root; gdk_drawable_ref (window); + display = gdk_drawable_get_display (window); GDK_NOTE (EVENTS_OR_INPUT, g_print ("gdk_input_win32_other_event: window=%p (%d,%d)\n", @@ -928,7 +930,7 @@ _gdk_input_other_event (GdkEvent *event, event2->button.button, event2->button.x, event2->button.y)); - _gdk_event_queue_append (event2); + _gdk_event_queue_append (display, event2); } } return TRUE; diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c index a2858cbde5..bd2f7adecc 100644 --- a/gdk/win32/gdkkeys-win32.c +++ b/gdk/win32/gdkkeys-win32.c @@ -287,8 +287,10 @@ update_keymap (void) } GdkKeymap* -gdk_keymap_get_default (void) +gdk_keymap_get_for_display (GdkDisplay *display) { + g_return_val_if_fail (display == gdk_get_default_display (), NULL); + if (default_keymap == NULL) default_keymap = g_object_new (gdk_keymap_get_type (), NULL); diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c index b5503a5191..980ed1f382 100644 --- a/gdk/win32/gdkmain-win32.c +++ b/gdk/win32/gdkmain-win32.c @@ -66,9 +66,8 @@ DllMain(HINSTANCE hinstDLL, return TRUE; } -gboolean -_gdk_windowing_init_check (int argc, - char **argv) +void +_gdk_windowing_init (void) { gchar buf[10]; @@ -111,8 +110,6 @@ _gdk_windowing_init_check (int argc, _gdk_selection_property = gdk_atom_intern ("GDK_SELECTION", FALSE); _gdk_win32_selection_init (); - - return TRUE; } void @@ -159,86 +156,25 @@ gdk_get_use_xshm (void) return TRUE; } -/* - *-------------------------------------------------------------- - * gdk_screen_width - * - * Return the width of the screen. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - gint -gdk_screen_width (void) +gdk_screen_get_width (GdkScreen *screen) { return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_parent_root)->impl)->width; } -/* - *-------------------------------------------------------------- - * gdk_screen_height - * - * Return the height of the screen. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - gint -gdk_screen_height (void) +gdk_screen_get_height (GdkScreen *screen) { return GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (_gdk_parent_root)->impl)->height; } - -/* - *-------------------------------------------------------------- - * gdk_screen_width_mm - * - * Return the width of the screen in millimetres. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - gint -gdk_screen_width_mm (void) +gdk_screen_get_width_mm (GdkScreen *screen) { return GetDeviceCaps (gdk_display_hdc, HORZSIZE); } -/* - *-------------------------------------------------------------- - * gdk_screen_height - * - * Return the height of the screen in millimetres. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - gint -gdk_screen_height_mm (void) +gdk_screen_get_height_mm (GdkScreen *screen) { return GetDeviceCaps (gdk_display_hdc, VERTSIZE); } @@ -250,8 +186,9 @@ gdk_set_sm_client_id (const gchar* sm_client_id) } void -gdk_beep (void) +gdk_display_beep (GdkDisplay *display) { + g_return_if_fail (display == gdk_get_default_display()); Beep(1000, 50); } @@ -264,12 +201,6 @@ _gdk_windowing_exit (void) gdk_display_hdc = NULL; } -gchar * -gdk_get_display (void) -{ - return "Win32"; -} - void gdk_error_trap_push (void) { diff --git a/gdk/win32/gdkpango-win32.c b/gdk/win32/gdkpango-win32.c index 6b5b5d3ab8..e209721adf 100644 --- a/gdk/win32/gdkpango-win32.c +++ b/gdk/win32/gdkpango-win32.c @@ -18,11 +18,14 @@ */ #include "gdkprivate-win32.h" +#include "gdkscreen.h" #include "gdkpango.h" #include PangoContext * -gdk_pango_context_get (void) +gdk_pango_context_get_for_screen (GdkScreen *screen) { + g_return_val_if_fail (screen == gdk_get_default_screen (), NULL); + return pango_win32_get_context (); } diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index 4b50fb5183..2e5f18fe54 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -441,6 +441,7 @@ void gdk_win32_gdi_failed (const gchar *where, extern LRESULT CALLBACK _gdk_win32_window_procedure (HWND, UINT, WPARAM, LPARAM); extern HWND gdk_root_window; +extern GdkWindow *_gdk_parent_root; extern HDC gdk_display_hdc; extern HINSTANCE gdk_dll_hinstance; @@ -480,4 +481,12 @@ extern gint gdk_max_colors; #define GDK_WIN32_COLORMAP_DATA(cmap) ((GdkColormapPrivateWin32 *) GDK_COLORMAP (cmap)->windowing_data) +/* Initialization */ +void _gdk_windowing_window_init (void); +void _gdk_visual_init (void); +void _gdk_dnd_init (void); +void _gdk_windowing_image_init (void); +void _gdk_events_init (void); +void _gdk_input_init (void); + #endif /* __GDK_PRIVATE_WIN32_H__ */ diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c index 1609d90ff9..f25130a205 100644 --- a/gdk/win32/gdkproperty-win32.c +++ b/gdk/win32/gdkproperty-win32.c @@ -29,6 +29,7 @@ #include #include +#include "gdkscreen.h" #include "gdkproperty.h" #include "gdkselection.h" #include "gdkprivate-win32.h" @@ -481,9 +482,12 @@ gdk_property_delete (GdkWindow *window, } gboolean -gdk_setting_get (const gchar *name, - GValue *value) +gdk_screen_get_setting (GdkScreen *screen, + const gchar *name, + GValue *value) { + g_return_val_if_fail (screen == gdk_get_default_screen (), FALSE); + /* * XXX : if these values get changed through the Windoze UI the * respective gdk_events are not generated yet. diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c new file mode 100644 index 0000000000..0e723395d5 --- /dev/null +++ b/gdk/win32/gdkscreen-win32.c @@ -0,0 +1,72 @@ +/* GDK - The GIMP Drawing Kit + * Copyright (C) 2002 Hans Breuer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +static GdkColormap *default_colormap; + +GdkDisplay * +gdk_screen_get_display (GdkScreen *screen) +{ + return gdk_get_default_display (); +} + +gint +gdk_screen_get_screen_num (GdkScreen *screen) +{ + return 1; +} + +GdkWindow * +gdk_screen_get_root_window (GdkScreen *screen) +{ + return _gdk_parent_root; +} + +GdkColormap * +gdk_screen_get_default_colormap (GdkScreen *screen) +{ + return default_colormap; +} + +void +gdk_screen_set_default_colormap (GdkScreen *screen, + GdkColormap *colormap) +{ + default_coloramp = colormap; +} + +gint +gdk_screen_get_n_monitors (GdkScreen *screen) +{ + g_return_val_if_fail (GDK_IS_SCREEN (screen), 1); + + return 1; +} + +void +gdk_screen_get_monitor_geometry (GdkScreen *screen, + gint num_monitor, + GdkRectangle *dest) +{ + dest->x = 0; + dest->y = 0; + dest->width = gdk_screen_width (); + dest->height = gdk_screen_height (); +} diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c index 4a80fef234..bf5269a961 100644 --- a/gdk/win32/gdkselection-win32.c +++ b/gdk/win32/gdkselection-win32.c @@ -30,6 +30,7 @@ #include "gdkproperty.h" #include "gdkselection.h" +#include "gdkdisplay.h" #include "gdkprivate-win32.h" /* We emulate the GDK_SELECTION window properties of windows (as used @@ -108,15 +109,18 @@ _gdk_dropfiles_store (gchar *data) } gboolean -gdk_selection_owner_set (GdkWindow *owner, - GdkAtom selection, - guint32 time, - gboolean send_event) +gdk_selection_owner_set_for_display (GdkDisplay *display, + GdkWindow *owner, + GdkAtom selection, + guint32 time, + gboolean send_event) { HWND xwindow; GdkEvent tmp_event; gchar *sel_name; + g_return_val_if_fail (display == gdk_get_default_display (), FALSE); + GDK_NOTE (DND, (sel_name = gdk_atom_name (selection), g_print ("gdk_selection_owner_set: %#x %#x (%s)\n", @@ -189,11 +193,14 @@ gdk_selection_owner_set (GdkWindow *owner, } GdkWindow* -gdk_selection_owner_get (GdkAtom selection) +gdk_selection_owner_get_for_display (GdkDisplay *display, + GdkAtom selection) { GdkWindow *window; gchar *sel_name; + g_return_val_if_fail (display == gdk_get_default_display (), NULL); + /* Return NULL for CLIPBOARD, because otherwise cut&paste * inside the same application doesn't work. We must pretend to gtk * that we don't have the selection, so that we always fetch it from @@ -499,15 +506,18 @@ _gdk_selection_property_delete (GdkWindow *window) } void -gdk_selection_send_notify (guint32 requestor, - GdkAtom selection, - GdkAtom target, - GdkAtom property, - guint32 time) +gdk_selection_send_notify_for_display (GdkDisplay *display, + guint32 requestor, + GdkAtom selection, + GdkAtom target, + GdkAtom property, + guint32 time) { GdkEvent tmp_event; gchar *sel_name, *tgt_name, *prop_name; + g_return_if_fail (display == gdk_get_default_display ()); + GDK_NOTE (DND, (sel_name = gdk_atom_name (selection), tgt_name = gdk_atom_name (target), @@ -687,7 +697,8 @@ make_list (const gchar *text, } /** - * gdk_text_property_to_utf8_list: + * gdk_text_property_to_utf8_list_for_display: + * @display: currently ignored * @encoding: an atom representing the encoding of the text * @format: the format of the property * @text: the text to convert @@ -702,15 +713,17 @@ make_list (const gchar *text, * list. **/ gint -gdk_text_property_to_utf8_list (GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list) +gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, + GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list) { g_return_val_if_fail (text != NULL, 0); g_return_val_if_fail (length >= 0, 0); - + g_return_val_if_fail (display == gdk_get_default_display (), 0); + if (encoding == GDK_TARGET_STRING) { return make_list ((gchar *)text, length, TRUE, list); @@ -840,7 +853,8 @@ gdk_utf8_to_string_target (const gchar *str) } /** - * gdk_utf8_to_compound_text: + * gdk_utf8_to_compound_text_for_display : + * @display: currently not used on win32 * @str: a UTF-8 string * @encoding: location to store resulting encoding * @format: location to store format of the result @@ -854,11 +868,12 @@ gdk_utf8_to_string_target (const gchar *str) * %FALSE. **/ gboolean -gdk_utf8_to_compound_text (const gchar *str, - GdkAtom *encoding, - gint *format, - guchar **ctext, - gint *length) +gdk_utf8_to_compound_text_for_display (GdkDisplay *display, + const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length) { gboolean need_conversion; const gchar *charset; @@ -867,6 +882,7 @@ gdk_utf8_to_compound_text (const gchar *str, gboolean result; g_return_val_if_fail (str != NULL, FALSE); + g_return_val_if_fail (display == gdk_get_default_display (), FALSE); need_conversion = !g_get_charset (&charset); diff --git a/gdk/win32/gdkvisual-win32.c b/gdk/win32/gdkvisual-win32.c index c05f5525ac..917e961140 100644 --- a/gdk/win32/gdkvisual-win32.c +++ b/gdk/win32/gdkvisual-win32.c @@ -28,6 +28,7 @@ #include #include "gdkvisual.h" +#include "gdkscreen.h" /* gdk_get_default_screen() */ #include "gdkprivate-win32.h" static void gdk_visual_decompose_mask (gulong mask, @@ -300,8 +301,10 @@ gdk_visual_get_best_type (void) } GdkVisual* -gdk_visual_get_system (void) +gdk_screen_get_system_visual (GdkScreen *screen) { + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); + return ((GdkVisual*) system_visual); } @@ -356,11 +359,19 @@ gdk_query_visual_types (GdkVisualType **visual_types, } GList* -gdk_list_visuals (void) +gdk_screen_list_visuals (GdkScreen *screen) { return g_list_append (NULL, (gpointer) system_visual); } +GdkScreen * +gdk_visual_get_screen (GdkVisual *visual) +{ + g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL); + + return gdk_get_default_screen (); +} + static void gdk_visual_decompose_mask (gulong mask, gint *shift, diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index f46dd666f5..9e23a87b9c 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -31,6 +31,7 @@ #include "gdkevents.h" #include "gdkpixmap.h" #include "gdkwindow.h" +#include "gdkdisplay.h" #include "gdkprivate-win32.h" #include "gdkinput-win32.h" @@ -51,6 +52,8 @@ static void gdk_window_impl_win32_finalize (GObject *object); static gpointer parent_class = NULL; +GdkWindow *_gdk_parent_root = NULL; + GType _gdk_window_impl_win32_get_type (void) { @@ -668,7 +671,8 @@ gdk_window_new (GdkWindow *parent, } GdkWindow * -gdk_window_foreign_new (GdkNativeWindow anid) +gdk_window_foreign_new_for_display (GdkDisplay *display, + GdkNativeWindow anid) { GdkWindow *window; GdkWindowObject *private; @@ -679,6 +683,8 @@ gdk_window_foreign_new (GdkNativeWindow anid) RECT rect; POINT point; + g_return_val_if_fail (display == gdk_get_default_display (), NULL); + window = g_object_new (GDK_TYPE_WINDOW, NULL); private = (GdkWindowObject *)window; impl = GDK_WINDOW_IMPL_WIN32 (private->impl); @@ -2588,3 +2594,11 @@ gdk_window_begin_move_drag (GdkWindow *window, /* XXX: isn't all this default on win32 ... */ } + +GdkWindow * +gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) +{ + g_return_val_if_fail (display == gdk_get_default_display(), NULL); + + return gdk_window_lookup (anid); +} diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index 48947efec9..3f03b3b777 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -28,6 +28,7 @@ gdk_win32_OBJECTS = \ gdkcolor-win32.obj \ gdkcursor-win32.obj \ gdkdnd-win32.obj \ + gdkdisplay-win32.obj \ gdkdrawable-win32.obj \ gdkevents-win32.obj \ gdkfont-win32.obj \ @@ -44,6 +45,7 @@ gdk_win32_OBJECTS = \ gdkpixmap-win32.obj \ gdkproperty-win32.obj \ # gdkregion-win32.obj \ + gdkscreen-win32.obj \ gdkselection-win32.obj \ gdkvisual-win32.obj \ gdkwin32id.obj \ diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index 3e2d202fe4..81ef19e8fd 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -36,6 +36,7 @@ typedef struct _GdkColormapPrivateX11 GdkColormapPrivateX11; struct _GdkColormapPrivateX11 { + GdkScreen *screen; Colormap xcolormap; Display *xdisplay; gint private_val; @@ -101,9 +102,9 @@ gdk_colormap_init (GdkColormap *colormap) private = g_new (GdkColormapPrivateX11, 1); - colormap->screen = NULL; colormap->windowing_data = private; + private->screen = NULL; private->hash = NULL; private->last_sync_time = 0; private->info = NULL; @@ -130,7 +131,7 @@ gdk_colormap_finalize (GObject *object) gdk_colormap_remove (colormap); - XFreeColormap (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap); + XFreeColormap (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap); if (private->hash) g_hash_table_destroy (private->hash); @@ -163,11 +164,11 @@ gdk_colormap_new (GdkVisual *visual, private = GDK_COLORMAP_PRIVATE_DATA (colormap); colormap->visual = visual; - colormap->screen = visual->screen; + private->screen = gdk_visual_get_screen (visual); xvisual = ((GdkVisualPrivate*) visual)->xvisual; - xdisplay = GDK_SCREEN_XDISPLAY (visual->screen); - xrootwin = GDK_SCREEN_XROOTWIN (visual->screen); + xdisplay = GDK_SCREEN_XDISPLAY (private->screen); + xrootwin = GDK_SCREEN_XROOTWIN (private->screen); colormap->size = visual->colormap_size; @@ -195,7 +196,7 @@ gdk_colormap_new (GdkVisual *visual, default_colors[i].pixel = i; XQueryColors (xdisplay, - DefaultColormapOfScreen (GDK_SCREEN_X11 (visual->screen)->xscreen), + DefaultColormapOfScreen (GDK_SCREEN_X11 (private->screen)->xscreen), default_colors, colormap->size); for (i = 0; i < colormap->size; i++) @@ -290,7 +291,7 @@ gdk_colormap_sync (GdkColormap *colormap, } } - XQueryColors (GDK_SCREEN_XDISPLAY (colormap->screen), + XQueryColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, xpalette, nlookup); for (i = 0; i < nlookup; i++) @@ -329,7 +330,7 @@ gdk_screen_get_system_colormap (GdkScreen *screen) colormap = g_object_new (gdk_colormap_get_type (), NULL); private = GDK_COLORMAP_PRIVATE_DATA (colormap); - colormap->screen = screen; + private->screen = screen; colormap->visual = gdk_screen_get_system_visual (screen); private->xcolormap = DefaultColormapOfScreen (screen_x11->xscreen); @@ -366,20 +367,6 @@ gdk_screen_get_system_colormap (GdkScreen *screen) return colormap; } -/** - * gdk_colormap_get_system: - * - * Gets the system's default colormap for the default screen. (See - * gdk_colormap_get_system_for_screen ()) - * - * Return value: the default colormap. - **/ -GdkColormap* -gdk_colormap_get_system (void) -{ - return gdk_screen_get_system_colormap (gdk_get_default_screen ()); -} - gint gdk_colormap_get_system_size (void) { @@ -402,10 +389,11 @@ gdk_colormap_change (GdkColormap *colormap, g_return_if_fail (GDK_IS_COLORMAP (colormap)); - xdisplay = GDK_SCREEN_XDISPLAY (colormap->screen); + private = GDK_COLORMAP_PRIVATE_DATA (colormap); + + xdisplay = GDK_SCREEN_XDISPLAY (private->screen); palette = g_new (XColor, ncolors); - private = GDK_COLORMAP_PRIVATE_DATA (colormap); switch (colormap->visual->type) { case GDK_VISUAL_GRAYSCALE: @@ -488,7 +476,7 @@ gdk_colors_alloc (GdkColormap *colormap, private = GDK_COLORMAP_PRIVATE_DATA (colormap); - return_val = XAllocColorCells (GDK_SCREEN_XDISPLAY (colormap->screen), + return_val = XAllocColorCells (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap,contiguous, planes, nplanes, pixels, npixels); if (return_val) @@ -547,7 +535,7 @@ gdk_colors_free (GdkColormap *colormap, } if (npixels) - XFreeColors (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, + XFreeColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, pixels, npixels, planes); g_free (pixels); } @@ -595,7 +583,7 @@ gdk_colormap_free_colors (GdkColormap *colormap, } if (npixels) - XFreeColors (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, + XFreeColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, pixels, npixels, 0); g_free (pixels); @@ -624,7 +612,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap, xcolor.pixel = color->pixel; xcolor.flags = DoRed | DoGreen | DoBlue; - if (XAllocColor (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, &xcolor)) + if (XAllocColor (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor)) { ret->pixel = xcolor.pixel; ret->red = xcolor.red; @@ -635,7 +623,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap, { if (private->info[ret->pixel].ref_count) /* got a duplicate */ { - XFreeColors (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, + XFreeColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor.pixel, 1, 0); } else @@ -697,7 +685,7 @@ gdk_colormap_alloc_colors_writeable (GdkColormap *colormap, pixels = g_new (gulong, ncolors); /* Allocation of a writeable color cells */ - status = XAllocColorCells (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, + status = XAllocColorCells (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, FALSE, NULL, 0, pixels, ncolors); if (status) { @@ -760,7 +748,7 @@ gdk_colormap_alloc_colors_private (GdkColormap *colormap, } } - XStoreColors (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, + XStoreColors (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, store, nstore); g_free (store); @@ -993,7 +981,7 @@ gdk_colormap_alloc_colors (GdkColormap *colormap, xcolor.pixel = colors[i].pixel; xcolor.flags = DoRed | DoGreen | DoBlue; - if (XAllocColor (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, &xcolor)) + if (XAllocColor (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor)) { colors[i].pixel = xcolor.pixel; success[i] = TRUE; @@ -1052,7 +1040,7 @@ gdk_colormap_query_color (GdkColormap *colormap, break; case GDK_VISUAL_STATIC_COLOR: xcolor.pixel = pixel; - XQueryColor (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, &xcolor); + XQueryColor (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor); result->red = xcolor.red; result->green = xcolor.green; result->blue = xcolor.blue; @@ -1086,7 +1074,7 @@ gdk_color_change (GdkColormap *colormap, xcolor.flags = DoRed | DoGreen | DoBlue; private = GDK_COLORMAP_PRIVATE_DATA (colormap); - XStoreColor (GDK_SCREEN_XDISPLAY (colormap->screen), private->xcolormap, &xcolor); + XStoreColor (GDK_SCREEN_XDISPLAY (private->screen), private->xcolormap, &xcolor); return TRUE; } @@ -1266,3 +1254,19 @@ gdk_x11_colormap_get_xcolormap (GdkColormap *colormap) return private->xcolormap; } + +/** + * gdk_colormap_get_screen: + * @colormap: a #GdkColormap + * + * Gets the screen for which this colormap was created. + * + * Return value: the screen for which this colormap was created. + **/ +GdkScreen * +gdk_colormap_get_screen (GdkColormap *colormap) +{ + g_return_val_if_fail (GDK_IS_COLORMAP (colormap), NULL); + + return GDK_COLORMAP_PRIVATE_DATA (colormap)->screen; +} diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index b9a06c75c6..5b995ec689 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -121,24 +121,6 @@ gdk_cursor_new_for_screen (GdkScreen *screen, return cursor; } -/** - * gdk_cursor_new: - * @cursor_type: cursor to create - * - * Creates a new cursor from the set of builtin cursors for the default screen. - * See gdk_cursor_new_for_screen(). - * - * To make the cursor invisible, use gdk_cursor_new_from_pixmap() to create - * a cursor with no pixels in it. - * - * Return value: a new #GdkCursor - **/ -GdkCursor* -gdk_cursor_new (GdkCursorType cursor_type) -{ - return gdk_cursor_new_for_screen (gdk_get_default_screen(), cursor_type); -} - GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index b1daea8143..ad89332dfb 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -42,11 +42,6 @@ #endif static void gdk_display_x11_class_init (GdkDisplayX11Class *class); -static gint gdk_display_x11_get_n_screens (GdkDisplay *display); -static GdkScreen * gdk_display_x11_get_screen (GdkDisplay *display, - gint screen_num); -G_CONST_RETURN static char *gdk_display_x11_get_display_name (GdkDisplay *display); -static GdkScreen * gdk_display_x11_get_default_screen (GdkDisplay *display); static void gdk_display_x11_finalize (GObject *object); static void gdk_internal_connection_watch (Display *display, @@ -58,7 +53,7 @@ static void gdk_internal_connection_watch (Display *display, static gpointer parent_class = NULL; GType -gdk_display_x11_get_type () +_gdk_display_x11_get_type (void) { static GType object_type = 0; @@ -88,13 +83,6 @@ gdk_display_x11_get_type () static void gdk_display_x11_class_init (GdkDisplayX11Class * class) { - GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class); - - display_class->get_display_name = gdk_display_x11_get_display_name; - display_class->get_n_screens = gdk_display_x11_get_n_screens; - display_class->get_screen = gdk_display_x11_get_screen; - display_class->get_default_screen = gdk_display_x11_get_default_screen; - G_OBJECT_CLASS (class)->finalize = gdk_display_x11_finalize; parent_class = g_type_class_peek_parent (class); @@ -285,39 +273,70 @@ gdk_internal_connection_watch (Display *display, gdk_remove_connection_handler ((GdkInternalConnection *)*watch_data); } -static G_CONST_RETURN gchar* -gdk_display_x11_get_display_name (GdkDisplay * display) +/** + * gdk_display_get_name: + * @display: a #GdkDisplay + * + * Gets the name of the display. + * + * Returns: a string representing the display name. + */ +G_CONST_RETURN gchar * +gdk_display_get_name (GdkDisplay * display) { - GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); + g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return (gchar *) DisplayString (display_x11->xdisplay); + return (gchar *) DisplayString (GDK_DISPLAY_X11 (display)->xdisplay); } -static gint -gdk_display_x11_get_n_screens (GdkDisplay * display) +/** + * gdk_display_get_n_screens: + * @display: a #GdkDisplay + * + * Gets the number of screen managed by the @display. + * + * Returns: number of screens. + */ +gint +gdk_display_get_n_screens (GdkDisplay * display) { - GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); + g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); - return ScreenCount (display_x11->xdisplay); + return ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay); } -static GdkScreen * -gdk_display_x11_get_screen (GdkDisplay *display, - gint screen_num) +/** + * gdk_display_get_screen: + * @display: a #GdkDisplay + * @screen_num: the screen number + * + * Returns a screen object for one of the screens of the display. + * + * Returns: the #GdkScreen object + */ +GdkScreen * +gdk_display_get_screen (GdkDisplay * display, gint screen_num) { - GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); - - g_return_val_if_fail (ScreenCount (display_x11->xdisplay) > screen_num, NULL); + g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); + g_return_val_if_fail (ScreenCount (GDK_DISPLAY_X11 (display)->xdisplay) > screen_num, NULL); - return display_x11->screens[screen_num]; + return GDK_DISPLAY_X11 (display)->screens[screen_num]; } -static GdkScreen * -gdk_display_x11_get_default_screen (GdkDisplay * display) +/** + * gdk_display_get_default_screen: + * @display: a #GdkDisplay + * + * Get the default #GdkScreen for @display. + * + * Returns: the default #GdkScreen object for @display + */ +GdkScreen * +gdk_display_get_default_screen (GdkDisplay * display) { - GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); + g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return display_x11->default_screen; + return GDK_DISPLAY_X11 (display)->default_screen; } gboolean @@ -325,7 +344,6 @@ _gdk_x11_display_is_root_window (GdkDisplay *display, Window xroot_window) { GdkDisplayX11 *display_x11; - GSList *tmp_list; gint i; g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); @@ -462,7 +480,6 @@ gdk_display_x11_finalize (GObject *object) GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (object); int i; GList *tmp; - GSList *stmp; /* FIXME need to write GdkKeymap finalize fct g_object_unref (display_x11->keymap); */ diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h index fd41638428..84b3b9022d 100644 --- a/gdk/x11/gdkdisplay-x11.h +++ b/gdk/x11/gdkdisplay-x11.h @@ -37,7 +37,7 @@ G_BEGIN_DECLS typedef struct _GdkDisplayX11 GdkDisplayX11; typedef struct _GdkDisplayX11Class GdkDisplayX11Class; -#define GDK_TYPE_DISPLAY_X11 (gdk_display_x11_get_type()) +#define GDK_TYPE_DISPLAY_X11 (_gdk_display_x11_get_type()) #define GDK_DISPLAY_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_X11, GdkDisplayX11)) #define GDK_DISPLAY_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class)) #define GDK_IS_DISPLAY_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_X11)) @@ -129,11 +129,7 @@ struct _GdkDisplayX11Class GdkDisplayClass parent_class; }; -GType gdk_display_x11_get_type (void); - -void gdk_x11_display_grab (GdkDisplay *display); -void gdk_x11_display_ungrab (GdkDisplay *display); - +GType _gdk_display_x11_get_type (void); GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display, Window xrootwin); diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 4ad531baa2..9b6cfb2561 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -1823,27 +1823,6 @@ gdk_event_dispatch (GSource *source, return TRUE; } -/** - * gdk_event_send_client_message: - * @event: the #GdkEvent to send, which should be a #GdkEventClient. - * @xid: the window to send the X ClientMessage event to. - * - * Sends an X ClientMessage event to a given window (which must be - * on the default #GdkDisplay.) - * This could be used for communicating between different applications, - * though the amount of data is limited to 20 bytes. - * - * Return value: non-zero on success. - **/ -gboolean -gdk_event_send_client_message (GdkEvent *event, guint32 xid) -{ - g_return_val_if_fail (event != NULL, FALSE); - - return gdk_event_send_client_message_for_display (gdk_get_default_display (), - event, xid); -} - /** * gdk_event_send_client_message_for_display : * @display : the #GdkDisplay for the window where the message is to be sent. @@ -1939,26 +1918,6 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display, return result; } -/** - * gdk_event_send_clientmessage_toall: - * @event: the #GdkEvent to send, which should be a #GdkEventClient. - * - * Sends an X ClientMessage event to all toplevel windows on the default - * #GdkScreen. - * - * Toplevel windows are determined by checking for the WM_STATE property, as - * described in the Inter-Client Communication Conventions Manual (ICCCM). - * If no windows are found with the WM_STATE property set, the message is sent - * to all children of the root window. - **/ -void -gdk_event_send_clientmessage_toall (GdkEvent *event) -{ - g_return_if_fail (event != NULL); - - gdk_screen_broadcast_client_message (gdk_get_default_screen (), event); -} - /** * gdk_screen_broadcast_client_message: * @screen : the #GdkScreen where the event will be broadcasted. @@ -2257,7 +2216,7 @@ gdk_xsettings_notify_cb (const char *name, for (i = 0; i < G_N_ELEMENTS (settings_map) ; i++) if (strcmp (settings_map[i].xsettings_name, name) == 0) { - new_event.setting.name = settings_map[i].gdk_name; + new_event.setting.name = (char *)settings_map[i].gdk_name; break; } @@ -2297,24 +2256,6 @@ check_transform (const gchar *xsettings_name, return TRUE; } -/** - * gdk_setting_get: - * @name: the name of the setting. - * @value: location to store the value of the setting. - * - * Obtains a desktop-wide setting, such as the double-click time, - * for the default screen. See gdk_screen_get_setting(). - * - * Returns : %TRUE if the setting existed and a value was stored - * in @value, %FALSE otherwise. - **/ -gboolean -gdk_setting_get (const gchar *name, - GValue *value) -{ - return gdk_screen_get_setting (gdk_get_default_screen (), name, value); -} - /** * gdk_screen_get_setting: * @screen: the #GdkScreen where the setting is located diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index df962da1ab..b64d55a933 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -222,12 +222,6 @@ gdk_font_load_for_display (GdkDisplay *display, return font; } -GdkFont* -gdk_font_load (const gchar *font_name) -{ - return gdk_font_load_for_display (gdk_get_default_display(), font_name); -} - static char * gdk_font_charset_for_locale (void) { @@ -321,25 +315,6 @@ gdk_font_from_description_for_display (GdkDisplay *display, return result; } -/** - * gdk_font_from_description: - * @font_desc: a #PangoFontDescription. - * - * Load a #GdkFont based on a Pango font description. This font will - * only be an approximation of the Pango font, and - * internationalization will not be handled correctly. This function - * should only be used for legacy code that cannot be easily converted - * to use Pango. Using Pango directly will produce better results. - * - * Return value: the newly loaded font, or %NULL if the font - * cannot be loaded. - **/ -GdkFont* -gdk_font_from_description (PangoFontDescription *font_desc) -{ - return gdk_font_from_description_for_display (gdk_get_default_display (),font_desc); -} - /** * gdk_fontset_load_for_display: * @display: a #GdkDisplay diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c index 3fd26d4806..7836c06bd5 100644 --- a/gdk/x11/gdkimage-x11.c +++ b/gdk/x11/gdkimage-x11.c @@ -153,7 +153,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h) GdkImagePrivateX11 *private; image = g_object_new (gdk_image_get_type (), NULL); private = PRIVATE_DATA (image); - private->screen = visual->screen; + private->screen = gdk_visual_get_screen (visual); image->type = GDK_IMAGE_NORMAL; image->visual = visual; image->width = w; @@ -161,7 +161,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h) image->depth = 1; image->bits_per_pixel = 1; xvisual = ((GdkVisualPrivate*) visual)->xvisual; - private->ximage = XCreateImage (GDK_SCREEN_XDISPLAY (visual->screen), + private->ximage = XCreateImage (GDK_SCREEN_XDISPLAY (private->screen), xvisual, 1, XYBitmap, 0, 0, w ,h, 8, 0); private->ximage->data = data; @@ -428,16 +428,6 @@ _gdk_x11_image_get_shm_pixmap (GdkImage *image) #endif } -GdkImage* -gdk_image_new (GdkImageType type, - GdkVisual *visual, - gint width, - gint height) -{ - return _gdk_image_new_for_depth (visual->screen, type, - visual, width, height, -1); -} - static GdkImage* get_full_image (GdkDrawable *drawable, gint src_x, diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c index 5ddbaa3091..36a05ec907 100644 --- a/gdk/x11/gdkkeys-x11.c +++ b/gdk/x11/gdkkeys-x11.c @@ -194,18 +194,6 @@ gdk_keymap_get_for_display (GdkDisplay *display) return display_x11->keymap; } -/** - * gdk_keymap_get_default: - * @returns: the #GdkKeymap attached to the default display. - * - * Returns the #GdkKeymap attached to the default display. - **/ -GdkKeymap* -gdk_keymap_get_default (void) -{ - return gdk_keymap_get_for_display (gdk_get_default_display ()); -} - /* Find the index of the group/level pair within the keysyms for a key. */ #define KEYSYM_INDEX(keymap_impl, group, level) \ diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index aeee70a001..d41fc1699a 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -251,48 +251,6 @@ gdk_pointer_grab (GdkWindow * window, return gdk_x11_convert_grab_status (return_val); } -/* - *-------------------------------------------------------------- - * gdk_pointer_ungrab - * - * Releases any pointer grab - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -void -gdk_pointer_ungrab (guint32 time) -{ - gdk_display_pointer_ungrab (gdk_get_default_display (), time); -} - -/* - *-------------------------------------------------------------- - * gdk_pointer_is_grabbed - * - * Tell wether there is an active x pointer grab in effect - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -gboolean -gdk_pointer_is_grabbed (void) -{ - return gdk_display_pointer_is_grabbed (gdk_get_default_display ()); -} - /** * gdk_pointer_grab_info_libgtk_only: * @display: the #GdkDisplay for which to get the grab information @@ -390,27 +348,6 @@ gdk_keyboard_grab (GdkWindow * window, return gdk_x11_convert_grab_status (return_val); } -/* - *-------------------------------------------------------------- - * gdk_keyboard_ungrab - * - * Releases any keyboard grab - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -void -gdk_keyboard_ungrab (guint32 time) -{ - gdk_display_keyboard_ungrab (gdk_get_default_display (), time); -} - /** * gdk_keyboard_grab_info_libgtk_only: * @display: the display for which to get the grab information @@ -511,90 +448,6 @@ _gdk_xgrab_check_destroy (GdkWindow *window) display_x11->keyboard_xgrab_window = NULL; } -/* - *-------------------------------------------------------------- - * gdk_screen_width - * - * Return the width of the screen. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -gint -gdk_screen_width (void) -{ - return gdk_screen_get_width (gdk_get_default_screen()); -} - -/* - *-------------------------------------------------------------- - * gdk_screen_height - * - * Return the height of the screen. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -gint -gdk_screen_height (void) -{ - return gdk_screen_get_height (gdk_get_default_screen()); -} - -/* - *-------------------------------------------------------------- - * gdk_screen_width_mm - * - * Return the width of the screen in millimeters. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -gint -gdk_screen_width_mm (void) -{ - return gdk_screen_get_width_mm (gdk_get_default_screen()); -} - -/* - *-------------------------------------------------------------- - * gdk_screen_height - * - * Return the height of the screen in millimeters. - * - * Arguments: - * - * Results: - * - * Side effects: - * - *-------------------------------------------------------------- - */ - -gint -gdk_screen_height_mm (void) -{ - return gdk_screen_get_height_mm (gdk_get_default_screen ()); -} - /** * gdk_set_sm_client_id: * @sm_client_id: the client id assigned by the session manager when the @@ -648,12 +501,6 @@ gdk_display_set_sm_client_id (GdkDisplay *display, gdk_x11_get_xatom_by_name_for_display (display, "SM_CLIENT_ID")); } -void -gdk_beep (void) -{ - gdk_display_beep (gdk_get_default_display ()); -} - /* Close all open displays */ void diff --git a/gdk/x11/gdkpango-x11.c b/gdk/x11/gdkpango-x11.c index bec7b59810..6432e99fc0 100644 --- a/gdk/x11/gdkpango-x11.c +++ b/gdk/x11/gdkpango-x11.c @@ -72,22 +72,3 @@ gdk_pango_context_get_for_screen (GdkScreen *screen) return context; } - -/** - * gdk_pango_context_get: - * - * Creates a #PangoContext for the default GDK screen. - * - * The context must be freed when you're finished with it. - * - * When using GTK+, normally you should use gtk_widget_get_pango_context() - * instead of this function, to get the appropriate context for - * the widget you intend to render text onto. - * - * Return value: a new #PangoContext for the default display - **/ -PangoContext * -gdk_pango_context_get (void) -{ - return gdk_pango_context_get_for_screen (gdk_get_default_screen ()); -} diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 5b0447c3ba..e67968938f 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -88,6 +88,7 @@ struct _GdkVisualPrivate { GdkVisual visual; Visual *xvisual; + GdkScreen *screen; }; void _gdk_xid_table_insert (GdkDisplay *display, diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 61f7e6a989..91b7d6858d 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -35,35 +35,15 @@ #include #endif -static void gdk_screen_x11_class_init (GdkScreenX11Class *klass); -static GdkDisplay * gdk_screen_x11_get_display (GdkScreen *screen); -static gint gdk_screen_x11_get_width (GdkScreen *screen); -static gint gdk_screen_x11_get_height (GdkScreen *screen); -static gint gdk_screen_x11_get_width_mm (GdkScreen *screen); -static gint gdk_screen_x11_get_height_mm (GdkScreen *screen); -static gint gdk_screen_x11_get_default_depth (GdkScreen *screen); -static GdkWindow * gdk_screen_x11_get_root_window (GdkScreen *screen); -static gint gdk_screen_x11_get_screen_num (GdkScreen *screen); -static GdkColormap *gdk_screen_x11_get_default_colormap (GdkScreen *screen); -static void gdk_screen_x11_set_default_colormap (GdkScreen *screen, - GdkColormap *colormap); -static GdkWindow * gdk_screen_x11_get_window_at_pointer (GdkScreen *screen, - gint *win_x, - gint *win_y); -static void gdk_screen_x11_finalize (GObject *object); - -static gint gdk_screen_x11_get_n_monitors (GdkScreen *screen); -static void gdk_screen_x11_get_monitor_geometry (GdkScreen *screen, - gint num_monitor, - GdkRectangle *dest); -static void init_xinerama_support (GdkScreen * screen); +static void gdk_screen_x11_class_init (GdkScreenX11Class *klass); +static void gdk_screen_x11_finalize (GObject *object); +static void init_xinerama_support (GdkScreen *screen); -GType gdk_screen_x11_get_type (); static gpointer parent_class = NULL; GType -gdk_screen_x11_get_type () +_gdk_screen_x11_get_type () { static GType object_type = 0; @@ -91,141 +71,155 @@ gdk_screen_x11_get_type () void gdk_screen_x11_class_init (GdkScreenX11Class * klass) { - GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass); - - screen_class->get_display = gdk_screen_x11_get_display; - screen_class->get_width = gdk_screen_x11_get_width; - screen_class->get_height = gdk_screen_x11_get_height; - screen_class->get_width_mm = gdk_screen_x11_get_width_mm; - screen_class->get_height_mm = gdk_screen_x11_get_height_mm; - screen_class->get_root_depth = gdk_screen_x11_get_default_depth; - screen_class->get_screen_num = gdk_screen_x11_get_screen_num; - screen_class->get_root_window = gdk_screen_x11_get_root_window; - screen_class->get_default_colormap = gdk_screen_x11_get_default_colormap; - screen_class->set_default_colormap = gdk_screen_x11_set_default_colormap; - screen_class->get_window_at_pointer = gdk_screen_x11_get_window_at_pointer; - screen_class->get_n_monitors = gdk_screen_x11_get_n_monitors; - screen_class->get_monitor_geometry = gdk_screen_x11_get_monitor_geometry; - G_OBJECT_CLASS (klass)->finalize = gdk_screen_x11_finalize; parent_class = g_type_class_peek_parent (klass); } -static GdkDisplay * -gdk_screen_x11_get_display (GdkScreen *screen) +/** + * gdk_screen_get_display: + * @screen: a #GdkScreen + * + * Gets the display to which the @screen belongs. + * + * Returns: the display to which @screen belongs + **/ +GdkDisplay * +gdk_screen_get_display (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return screen_x11->display; + return GDK_SCREEN_X11 (screen)->display; +} +/** + * gdk_screen_get_width: + * @screen: a #GdkScreen + * + * Gets the width of @screen in pixels + * + * Returns: the width of @screen in pixels. + **/ +gint +gdk_screen_get_width (GdkScreen *screen) +{ + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); + + return WidthOfScreen (GDK_SCREEN_X11 (screen)->xscreen); } -static gint -gdk_screen_x11_get_width (GdkScreen *screen) +/** + * gdk_screen_get_height: + * @screen: a #GdkScreen + * + * Gets the height of @screen in pixels + * + * Returns: the height of @screen in pixels. + **/ +gint +gdk_screen_get_height (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return WidthOfScreen (screen_x11->xscreen); + return HeightOfScreen (GDK_SCREEN_X11 (screen)->xscreen); } -static gint -gdk_screen_x11_get_height (GdkScreen *screen) +/** + * gdk_screen_get_width_mm: + * @screen: a #GdkScreen + * + * Gets the width of @screen in millimeters. + * Note that on some X servers this value will not be correct. + * + * Returns: the width of @screen in pixels. + **/ +gint +gdk_screen_get_width_mm (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return HeightOfScreen (screen_x11->xscreen); + return WidthMMOfScreen (GDK_SCREEN_X11 (screen)->xscreen); } -static gint -gdk_screen_x11_get_width_mm (GdkScreen *screen) +/** + * gdk_screen_get_height_mm: + * @screen: a #GdkScreen + * + * Returns the height of @screen in millimeters. + * Note that on some X servers this value will not be correct. + * + * Returns: the heigth of @screen in pixels. + **/ +gint +gdk_screen_get_height_mm (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return WidthMMOfScreen (screen_x11->xscreen); + return HeightMMOfScreen (GDK_SCREEN_X11 (screen)->xscreen); } -static gint -gdk_screen_x11_get_height_mm (GdkScreen *screen) +/** + * gdk_screen_get_number: + * @screen: a #GdkScreen + * + * Gets the index of @screen among the screens in the display + * to which it belongs. (See gdk_screen_get_display()) + * + * Returns: the index + **/ +gint +gdk_screen_get_number (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); - - return HeightMMOfScreen (screen_x11->xscreen); -} - -static gint -gdk_screen_x11_get_default_depth (GdkScreen *screen) -{ - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); - - return DefaultDepthOfScreen (screen_x11->xscreen); -} - -static gint -gdk_screen_x11_get_screen_num (GdkScreen *screen) -{ - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - return screen_x11->screen_num; + return GDK_SCREEN_X11 (screen)->screen_num; } -static GdkWindow * -gdk_screen_x11_get_root_window (GdkScreen *screen) +/** + * gdk_screen_get_root_window: + * @screen: a #GdkScreen + * + * Gets the root window of @screen. + * + * Returns: the root window + **/ +GdkWindow * +gdk_screen_get_root_window (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return screen_x11->root_window; + return GDK_SCREEN_X11 (screen)->root_window; } -static GdkColormap * -gdk_screen_x11_get_default_colormap (GdkScreen *screen) +/** + * gdk_screen_get_default_colormap: + * @screen: a #GdkScreen + * + * Gets the default colormap for @screen. + * + * Returns: the default #GdkColormap. + **/ +GdkColormap * +gdk_screen_get_default_colormap (GdkScreen *screen) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - return screen_x11->default_colormap; + return GDK_SCREEN_X11 (screen)->default_colormap; } -static void -gdk_screen_x11_set_default_colormap (GdkScreen *screen, - GdkColormap * colormap) +/** + * gdk_screen_set_default_colormap: + * @screen: a #GdkScreen + * @colormap: a #GdkColormap + * + * Sets the default @colormap for @screen. + **/ +void +gdk_screen_set_default_colormap (GdkScreen *screen, + GdkColormap *colormap) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); + g_return_if_fail (GDK_IS_SCREEN (screen)); + g_return_if_fail (GDK_IS_COLORMAP (colormap)); - screen_x11->default_colormap = colormap; -} - -static GdkWindow * -gdk_screen_x11_get_window_at_pointer (GdkScreen *screen, - gint *win_x, - gint *win_y) -{ - GdkWindow *window; - Window root; - Window xwindow; - Window xwindow_last = 0; - Display *xdisplay; - int rootx = -1, rooty = -1; - int winx, winy; - unsigned int xmask; - - xwindow = GDK_SCREEN_XROOTWIN (screen); - xdisplay = GDK_SCREEN_XDISPLAY (screen); - - XGrabServer (xdisplay); - while (xwindow) - { - xwindow_last = xwindow; - XQueryPointer (xdisplay, xwindow, - &root, &xwindow, &rootx, &rooty, &winx, &winy, &xmask); - } - XUngrabServer (xdisplay); - - window = gdk_window_lookup_for_display (GDK_SCREEN_DISPLAY(screen), - xwindow_last); - if (win_x) - *win_x = window ? winx : -1; - if (win_y) - *win_y = window ? winy : -1; - - return window; + GDK_SCREEN_X11 (screen)->default_colormap = colormap; } static void @@ -246,22 +240,46 @@ gdk_screen_x11_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } -static gint -gdk_screen_x11_get_n_monitors (GdkScreen *screen) +/** + * gdk_screen_get_n_monitors: + * @screen : a #GdkScreen. + * + * Returns the number of monitors being part of the virtual screen + * + * Returns: number of monitors part of the virtual screen or + * 0 if @screen is not in virtual screen mode. + **/ +gint +gdk_screen_get_n_monitors (GdkScreen *screen) { - g_return_val_if_fail (GDK_IS_SCREEN (screen), 1); + g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); + return GDK_SCREEN_X11 (screen)->num_monitors; } -static void -gdk_screen_x11_get_monitor_geometry (GdkScreen *screen, - gint num_monitor, - GdkRectangle *dest) +/** + * gdk_screen_get_monitor_geometry: + * @screen : a #GdkScreen. + * @monitor_num: the monitor number. + * @dest : a #GdkRectangle to be filled with the monitor geometry + * + * Retrieves the #GdkRectangle representing the size and start + * coordinates of the individual monitor within the the entire virtual + * screen. + * + * Note that the virtual screen coordinates can be retrieved via + * gdk_screen_get_width() and gdk_screen_get_height(). + * + **/ +void +gdk_screen_get_monitor_geometry (GdkScreen *screen, + gint monitor_num, + GdkRectangle *dest) { - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); - g_return_if_fail (num_monitor < GDK_SCREEN_X11 (screen)->num_monitors); + g_return_if_fail (GDK_IS_SCREEN (screen)); + g_return_if_fail (monitor_num < GDK_SCREEN_X11 (screen)->num_monitors); - *dest = screen_x11->monitors[num_monitor]; + *dest = GDK_SCREEN_X11 (screen)->monitors[monitor_num]; } /** @@ -329,7 +347,7 @@ check_solaris_xinerama (GdkScreen *screen) gdk_screen_get_number (screen))) { XRectangle monitors[MAXFRAMEBUFFERS]; - char hints[16]; + unsigned char hints[16]; gint result; GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen); diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h index 483cc93cb7..4b6ed33a77 100644 --- a/gdk/x11/gdkscreen-x11.h +++ b/gdk/x11/gdkscreen-x11.h @@ -36,7 +36,7 @@ G_BEGIN_DECLS typedef struct _GdkScreenX11 GdkScreenX11; typedef struct _GdkScreenX11Class GdkScreenX11Class; -#define GDK_TYPE_SCREEN_X11 (gdk_screen_x11_get_type ()) +#define GDK_TYPE_SCREEN_X11 (_gdk_screen_x11_get_type ()) #define GDK_SCREEN_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SCREEN_X11, GdkScreenX11)) #define GDK_SCREEN_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SCREEN_X11, GdkScreenX11Class)) #define GDK_IS_SCREEN_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SCREEN_X11)) @@ -82,9 +82,9 @@ struct _GdkScreenX11Class GdkScreenClass parent_class; }; -GType gdk_screen_x11_get_type (); -GdkScreen * _gdk_x11_screen_new (GdkDisplay *display, - gint screen_number); +GType _gdk_screen_x11_get_type (void); +GdkScreen * _gdk_x11_screen_new (GdkDisplay *display, + gint screen_number); G_END_DECLS #endif /* __GDK_SCREEN_X11_H__ */ diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 0fa62be75b..43451abd18 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -175,17 +175,6 @@ gdk_selection_owner_set_for_display (GdkDisplay *display, return (XGetSelectionOwner (xdisplay, xselection) == xwindow); } -gboolean -gdk_selection_owner_set (GdkWindow *owner, - GdkAtom selection, - guint32 time, - gboolean send_event) -{ - return gdk_selection_owner_set_for_display (gdk_get_default_display (), - owner, selection, - time, send_event); -} - /** * gdk_selection_owner_get_for_display : * @display : a #GdkDisplay. @@ -218,13 +207,6 @@ gdk_selection_owner_get_for_display (GdkDisplay *display, return gdk_window_lookup_for_display (display, xwindow); } -GdkWindow* -gdk_selection_owner_get (GdkAtom selection) -{ - return gdk_selection_owner_get_for_display (gdk_get_default_display (), - selection); -} - void gdk_selection_convert (GdkWindow *requestor, GdkAtom selection, @@ -382,18 +364,6 @@ gdk_selection_send_notify_for_display (GdkDisplay *display, _gdk_send_xevent (display, requestor, False, NoEventMask, (XEvent*) & xevent); } -void -gdk_selection_send_notify (guint32 requestor, - GdkAtom selection, - GdkAtom target, - GdkAtom property, - guint32 time) -{ - gdk_selection_send_notify_for_display (gdk_get_default_display (), - requestor, selection, - target, property, time); -} - /** * gdk_text_property_to_text_list_for_display: * @display: The #GdkDisplay where the encoding is defined. @@ -640,32 +610,6 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display, } } -/** - * gdk_text_property_to_utf8_list: - * @encoding: an atom representing the encoding of the text - * @format: the format of the property - * @text: the text to convert - * @length: the length of @text, in bytes - * @list: location to store the list of strings or %NULL. The - * list should be freed with g_strfreev(). - * - * Convert a text property in the giving encoding to - * a list of UTF-8 strings. - * - * Return value: the number of strings in the resulting - * list. - **/ -gint -gdk_text_property_to_utf8_list (GdkAtom encoding, - gint format, - const guchar *text, - gint length, - gchar ***list) -{ - return gdk_text_property_to_utf8_list_for_display (gdk_get_default_display (), - encoding, format, text, length, list); -} - /** * gdk_string_to_compound_text_for_display: * @display : the #GdkDisplay where the encoding is defined. @@ -880,32 +824,6 @@ gdk_utf8_to_compound_text_for_display (GdkDisplay *display, return result; } -/** - * gdk_utf8_to_compound_text: - * @str: a UTF-8 string - * @encoding: location to store resulting encoding - * @format: location to store format of the result - * @ctext: location to store the data of the result - * @length: location to store the length of the data - * stored in @ctext - * - * Convert from UTF-8 to compound text. - * - * Return value: %TRUE if the conversion succeeded, otherwise - * false. - **/ -gboolean -gdk_utf8_to_compound_text (const gchar *str, - GdkAtom *encoding, - gint *format, - guchar **ctext, - gint *length) -{ - return gdk_utf8_to_compound_text_for_display (gdk_get_default_display (), - str, encoding, format, - ctext, length); -} - void gdk_free_compound_text (guchar *ctext) { if (ctext) diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index 83ecab4ace..ff210ee635 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -141,7 +141,7 @@ _gdk_visual_init (GdkScreen *screen) nvisuals = 0; for (i = 0; i < nxvisuals; i++) { - visuals[nvisuals]->visual.screen = screen; + visuals[nvisuals]->screen = screen; if (visual_list[i].depth >= 1) { @@ -357,21 +357,6 @@ gdk_screen_get_system_visual (GdkScreen * screen) return ((GdkVisual *) GDK_SCREEN_X11 (screen)->system_visual); } -/** - * gdk_visual_get_system: - * - * Get the system'sdefault visual for the default GDK screen. - * This is the visual for the root window of the display. - * The return value should not be freed. - * - * Return value: system visual - **/ -GdkVisual* -gdk_visual_get_system (void) -{ - return gdk_screen_get_system_visual (gdk_get_default_screen()); -} - /** * gdk_visual_get_best: * @@ -551,25 +536,6 @@ gdk_screen_list_visuals (GdkScreen *screen) return list; } -/** - * gdk_list_visuals: - * - * Lists the available visuals for the default screen. - * (See gdk_screen_list_visuals()) - * A visual describes a hardware image data format. - * For example, a visual might support 24-bit color, or 8-bit color, - * and might expect pixels to be in a certain format. - * - * Call g_list_free() on the return value when you're finished with it. - * - * Return value: a list of visuals; the list must be freed, but not its contents - **/ -GList* -gdk_list_visuals (void) -{ - return gdk_screen_list_visuals (gdk_get_default_screen ()); -} - GdkVisual* gdk_visual_lookup (Visual *xvisual) { @@ -615,14 +581,13 @@ gdkx_visual_get (VisualID xvisualid) static void gdk_visual_add (GdkVisual *visual) { - GdkVisualPrivate *private; - GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (visual->screen); + GdkVisualPrivate *private = (GdkVisualPrivate *) visual; + GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (private->screen); if (!screen_x11->visual_hash) screen_x11->visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash, (GEqualFunc) gdk_visual_equal); - private = (GdkVisualPrivate *) visual; g_hash_table_insert (screen_x11->visual_hash, private->xvisual, visual); } @@ -667,3 +632,19 @@ gdk_x11_visual_get_xvisual (GdkVisual *visual) return ((GdkVisualPrivate*) visual)->xvisual; } + +/** + * gdk_visual_get_screen: + * @visual: a #GdkVisual + * + * Gets the screen to which this visual belongs + * + * Return value: the screen to which this visual belongs. + **/ +GdkScreen * +gdk_visual_get_screen (GdkVisual *visual) +{ + g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL); + + return ((GdkVisualPrivate*) visual)->screen; +} diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 91ec8fe084..d50f03c26a 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -762,25 +762,6 @@ gdk_window_foreign_new_for_display (GdkDisplay *display, return window; } -/** - * gdk_window_foreign_new: - * @anid: a native window handle. - * - * Wraps a native window for the default display in a #GdkWindow. - * This may fail if the window has been destroyed. - * - * For example in the X backend, a native window handle is an Xlib - * XID. - * - * Return value: the newly-created #GdkWindow wrapper for the - * native window or %NULL if the window has been destroyed. - **/ -GdkWindow * -gdk_window_foreign_new (GdkNativeWindow anid) -{ - return gdk_window_foreign_new_for_display (gdk_get_default_display (), anid); -} - /** * gdk_window_lookup_for_display: * @display: the #GdkDisplay corresponding to the window handle @@ -2537,7 +2518,35 @@ _gdk_windowing_window_at_pointer (GdkScreen *screen, gint *win_x, gint *win_y) { - return gdk_screen_get_window_at_pointer (screen, win_x, win_y); + GdkWindow *window; + Window root; + Window xwindow; + Window xwindow_last = 0; + Display *xdisplay; + int rootx = -1, rooty = -1; + int winx, winy; + unsigned int xmask; + + xwindow = GDK_SCREEN_XROOTWIN (screen); + xdisplay = GDK_SCREEN_XDISPLAY (screen); + + XGrabServer (xdisplay); + while (xwindow) + { + xwindow_last = xwindow; + XQueryPointer (xdisplay, xwindow, + &root, &xwindow, &rootx, &rooty, &winx, &winy, &xmask); + } + XUngrabServer (xdisplay); + + window = gdk_window_lookup_for_display (GDK_SCREEN_DISPLAY(screen), + xwindow_last); + if (win_x) + *win_x = window ? winx : -1; + if (win_y) + *win_y = window ? winy : -1; + + return window; } /** diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index 8985a97fc7..e279d3350d 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -87,7 +87,7 @@ gint gdk_x11_get_default_screen (void); #define GDK_GC_XGC(gc) (GDK_GC_X11(gc)->xgc) #define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay) #define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen) -#define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_number) +#define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num) #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual) #define GDK_GC_GET_XGC(gc) (GDK_GC_X11(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : ((GdkGCX11 *)(gc))->xgc) #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID @@ -178,6 +178,9 @@ G_CONST_RETURN char *gdk_x11_font_get_name (GdkFont *font); #endif /* GDK_MULTIHEAD_SAFE */ #define gdk_font_lookup_for_display(display, xid) ((GdkFont*) gdk_xid_table_lookup_for_display (display, xid)) +void gdk_x11_display_grab (GdkDisplay *display); +void gdk_x11_display_ungrab (GdkDisplay *display); + #endif /* GDK_DISABLE_DEPRECATED */ G_END_DECLS diff --git a/gtk/gtk.def b/gtk/gtk.def index 0f6d394040..08b620cda6 100755 --- a/gtk/gtk.def +++ b/gtk/gtk.def @@ -906,6 +906,7 @@ EXPORTS gtk_menu_set_accel_group gtk_menu_set_accel_path gtk_menu_set_active + gtk_menu_set_screen gtk_menu_set_tearoff_state gtk_menu_set_title gtk_menu_shell_activate_item @@ -1997,6 +1998,7 @@ EXPORTS gtk_widget_get_default_direction gtk_widget_get_default_style gtk_widget_get_default_visual + gtk_widget_get_display gtk_widget_get_direction gtk_widget_get_events gtk_widget_get_extension_events @@ -2066,6 +2068,7 @@ EXPORTS gtk_widget_set_parent gtk_widget_set_parent_window gtk_widget_set_redraw_on_allocate + gtk_widget_get_screen gtk_widget_set_scroll_adjustments gtk_widget_set_sensitive gtk_widget_set_size_request @@ -2111,6 +2114,7 @@ EXPORTS gtk_window_get_position gtk_window_get_resizable gtk_window_get_role + gtk_window_get_screen gtk_window_get_size gtk_window_get_title gtk_window_get_transient_for @@ -2152,6 +2156,7 @@ EXPORTS gtk_window_set_position gtk_window_set_resizable gtk_window_set_role + gtk_window_set_screen gtk_window_set_title gtk_window_set_transient_for gtk_window_set_type_hint diff --git a/gtk/gtkgc.c b/gtk/gtkgc.c index 78481a6c0d..a5e1e9954f 100644 --- a/gtk/gtkgc.c +++ b/gtk/gtkgc.c @@ -164,15 +164,18 @@ gtk_gc_new (gpointer key) GtkGCDrawable *drawable; GdkGC *gc; GHashTable *ht; + GdkScreen *screen; keyval = key; - ht = gtk_gc_get_drawable_ht (keyval->colormap->screen); + screen = gdk_colormap_get_screen (keyval->colormap); + + ht = gtk_gc_get_drawable_ht (screen); drawable = g_hash_table_lookup (ht, &keyval->depth); if (!drawable) { drawable = g_new (GtkGCDrawable, 1); drawable->depth = keyval->depth; - drawable->drawable = gdk_pixmap_new (gdk_screen_get_root_window (keyval->colormap->screen), + drawable->drawable = gdk_pixmap_new (gdk_screen_get_root_window (screen), 1, 1, drawable->depth); g_hash_table_insert (ht, &drawable->depth, drawable); } diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 5d3979bd60..654abed96b 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -774,7 +774,7 @@ gtk_style_attach (GtkStyle *style, if (!new_style) { new_style = gtk_style_duplicate (style); - if (style->colormap->screen != colormap->screen && + if (gdk_colormap_get_screen (style->colormap) != gdk_colormap_get_screen (colormap) && new_style->private_font) { gdk_font_unref (new_style->private_font); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 463f765e97..e8a93780e7 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5558,14 +5558,14 @@ gtk_widget_pop_colormap (void) * Sets the default colormap to use when creating widgets. * gtk_widget_push_colormap() is a better function to use if * you only want to affect a few widgets, rather than all widgets. - * **/ void gtk_widget_set_default_colormap (GdkColormap *colormap) { g_return_if_fail (GDK_IS_COLORMAP (colormap)); - - gdk_screen_set_default_colormap (colormap->screen, colormap); + + gdk_screen_set_default_colormap (gdk_colormap_get_screen (colormap), + colormap); } /**