2009-02-24 05:09:13 +00:00
|
|
|
/*
|
2002-04-25 22:29:14 +00:00
|
|
|
* gdkscreen-x11.c
|
|
|
|
*
|
|
|
|
* Copyright 2001 Sun Microsystems Inc.
|
|
|
|
*
|
|
|
|
* Erwann Chenede <erwann.chenede@sun.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2004-03-06 03:38:59 +00:00
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
#include "gdkscreen-x11.h"
|
2002-04-25 22:29:14 +00:00
|
|
|
#include "gdkdisplay-x11.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
#include "gdkprivate-x11.h"
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-11-10 12:09:42 +00:00
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
2002-05-03 19:03:03 +00:00
|
|
|
#ifdef HAVE_SOLARIS_XINERAMA
|
|
|
|
#include <X11/extensions/xinerama.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_XFREE_XINERAMA
|
|
|
|
#include <X11/extensions/Xinerama.h>
|
|
|
|
#endif
|
|
|
|
|
2003-10-27 23:50:34 +00:00
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
#include <X11/extensions/Xrandr.h>
|
|
|
|
#endif
|
|
|
|
|
2006-04-25 14:27:32 +00:00
|
|
|
#ifdef HAVE_XFIXES
|
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
#endif
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
#include "gdksettings.c"
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
static void gdk_x11_screen_dispose (GObject *object);
|
|
|
|
static void gdk_x11_screen_finalize (GObject *object);
|
2002-10-04 15:58:19 +00:00
|
|
|
static void init_randr_support (GdkScreen *screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
static void deinit_multihead (GdkScreen *screen);
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
|
2002-09-25 19:16:46 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
WINDOW_MANAGER_CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
|
2002-09-25 19:16:46 +00:00
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:40:45 +00:00
|
|
|
G_DEFINE_TYPE (GdkX11Screen, gdk_x11_screen, GDK_TYPE_SCREEN)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
typedef struct _NetWmSupportedAtoms NetWmSupportedAtoms;
|
|
|
|
|
|
|
|
struct _NetWmSupportedAtoms
|
|
|
|
{
|
|
|
|
Atom *atoms;
|
|
|
|
gulong n_atoms;
|
|
|
|
};
|
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
struct _GdkX11Monitor
|
|
|
|
{
|
|
|
|
GdkRectangle geometry;
|
|
|
|
XID output;
|
|
|
|
int width_mm;
|
|
|
|
int height_mm;
|
|
|
|
char * output_name;
|
|
|
|
char * manufacturer;
|
|
|
|
};
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2006-04-04 14:02:03 +00:00
|
|
|
static void
|
2010-12-21 01:40:45 +00:00
|
|
|
gdk_x11_screen_init (GdkX11Screen *screen)
|
2006-04-04 14:02:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static GdkDisplay *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_display (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->display;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
2010-12-06 21:05:13 +00:00
|
|
|
|
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_width (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_height (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_width_mm (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return WidthMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_height_mm (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return HeightMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_number (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
2009-11-27 23:39:15 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->screen_num;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static GdkWindow *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_root_window (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->root_window;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
static void
|
2010-12-21 01:32:13 +00:00
|
|
|
_gdk_x11_screen_events_uninit (GdkScreen *screen)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->xsettings_client)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
xsettings_client_destroy (x11_screen->xsettings_client);
|
|
|
|
x11_screen->xsettings_client = NULL;
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
static void
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_dispose (GObject *object)
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (object);
|
2010-07-22 00:26:05 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 32; ++i)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->subwindow_gcs[i])
|
2010-07-22 00:26:05 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
XFreeGC (x11_screen->xdisplay, x11_screen->subwindow_gcs[i]);
|
|
|
|
x11_screen->subwindow_gcs[i] = 0;
|
2010-07-22 00:26:05 +00:00
|
|
|
}
|
|
|
|
}
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
_gdk_x11_screen_events_uninit (GDK_SCREEN (object));
|
2002-11-25 22:52:36 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->root_window)
|
|
|
|
_gdk_window_destroy (x11_screen->root_window, TRUE);
|
2005-11-10 12:09:42 +00:00
|
|
|
|
2010-12-21 01:40:45 +00:00
|
|
|
G_OBJECT_CLASS (gdk_x11_screen_parent_class)->dispose (object);
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xdisplay = NULL;
|
|
|
|
x11_screen->xscreen = NULL;
|
|
|
|
x11_screen->screen_num = -1;
|
|
|
|
x11_screen->xroot_window = None;
|
|
|
|
x11_screen->wmspec_check_window = None;
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
}
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
static void
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_finalize (GObject *object)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (object);
|
2005-11-10 12:09:42 +00:00
|
|
|
gint i;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->root_window)
|
|
|
|
g_object_unref (x11_screen->root_window);
|
2004-11-21 16:24:01 +00:00
|
|
|
|
2005-11-10 12:09:42 +00:00
|
|
|
/* Visual Part */
|
2010-12-21 01:32:13 +00:00
|
|
|
for (i = 0; i < x11_screen->nvisuals; i++)
|
|
|
|
g_object_unref (x11_screen->visuals[i]);
|
|
|
|
g_free (x11_screen->visuals);
|
|
|
|
g_hash_table_destroy (x11_screen->visual_hash);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
g_free (x11_screen->window_manager_name);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
deinit_multihead (GDK_SCREEN (object));
|
|
|
|
|
2010-12-21 01:40:45 +00:00
|
|
|
G_OBJECT_CLASS (gdk_x11_screen_parent_class)->finalize (object);
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_n_monitors (GdkScreen *screen)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
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.
2002-06-06 00:26:42 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->n_monitors;
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_primary_monitor (GdkScreen *screen)
|
2009-12-08 17:27:02 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->primary_monitor;
|
2009-12-08 17:27:02 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
gint monitor_num)
|
2007-12-13 18:27:05 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
|
|
|
g_return_val_if_fail (monitor_num >= 0, -1);
|
2010-12-21 01:32:13 +00:00
|
|
|
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->monitors[monitor_num].width_mm;
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gint
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_monitor_height_mm (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
gint monitor_num)
|
2007-12-13 18:27:05 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
|
|
|
g_return_val_if_fail (monitor_num >= 0, -1);
|
2010-12-21 01:32:13 +00:00
|
|
|
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->monitors[monitor_num].height_mm;
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gchar *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_monitor_plug_name (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
gint monitor_num)
|
2007-12-13 18:27:05 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
|
|
|
g_return_val_if_fail (monitor_num >= 0, NULL);
|
2010-12-21 01:32:13 +00:00
|
|
|
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, NULL);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return g_strdup (x11_screen->monitors[monitor_num].output_name);
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_x11_screen_get_monitor_output:
|
|
|
|
* @screen: a #GdkScreen
|
2009-11-27 23:39:15 +00:00
|
|
|
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
|
2007-12-13 18:27:05 +00:00
|
|
|
*
|
|
|
|
* Gets the XID of the specified output/monitor.
|
2009-11-27 23:39:15 +00:00
|
|
|
* If the X server does not support version 1.2 of the RANDR
|
2007-12-13 18:27:05 +00:00
|
|
|
* extension, 0 is returned.
|
|
|
|
*
|
|
|
|
* Returns: the XID of the monitor
|
|
|
|
*
|
|
|
|
* Since: 2.14
|
|
|
|
*/
|
|
|
|
XID
|
|
|
|
gdk_x11_screen_get_monitor_output (GdkScreen *screen,
|
|
|
|
gint monitor_num)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), None);
|
|
|
|
g_return_val_if_fail (monitor_num >= 0, None);
|
2010-12-21 01:32:13 +00:00
|
|
|
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, None);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->monitors[monitor_num].output;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static void
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_monitor_geometry (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
gint monitor_num,
|
|
|
|
GdkRectangle *dest)
|
2002-04-25 22:29:14 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2002-05-01 17:22:54 +00:00
|
|
|
|
2009-11-27 23:39:15 +00:00
|
|
|
g_return_if_fail (GDK_IS_SCREEN (screen));
|
|
|
|
g_return_if_fail (monitor_num >= 0);
|
2010-12-21 01:32:13 +00:00
|
|
|
g_return_if_fail (monitor_num < x11_screen->n_monitors);
|
2009-11-27 23:39:15 +00:00
|
|
|
|
|
|
|
if (dest)
|
2010-12-21 01:32:13 +00:00
|
|
|
*dest = x11_screen->monitors[monitor_num].geometry;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static GdkVisual *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_rgba_visual (GdkScreen *screen)
|
2005-05-09 22:54:10 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2005-05-09 22:54:10 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
2005-05-09 22:54:10 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->rgba_visual;
|
2005-05-09 22:54:10 +00:00
|
|
|
}
|
|
|
|
|
2002-05-02 22:28:50 +00:00
|
|
|
/**
|
|
|
|
* gdk_x11_screen_get_xscreen:
|
|
|
|
* @screen: a #GdkScreen.
|
2010-02-23 04:47:24 +00:00
|
|
|
* @returns: (transfer none): an Xlib <type>Screen*</type>
|
2002-05-02 22:28:50 +00:00
|
|
|
*
|
|
|
|
* Returns the screen of a #GdkScreen.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-05-02 22:28:50 +00:00
|
|
|
*/
|
2002-04-25 22:29:14 +00:00
|
|
|
Screen *
|
|
|
|
gdk_x11_screen_get_xscreen (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->xscreen;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
|
|
|
|
2002-05-02 22:28:50 +00:00
|
|
|
/**
|
|
|
|
* gdk_x11_screen_get_screen_number:
|
|
|
|
* @screen: a #GdkScreen.
|
|
|
|
* @returns: the position of @screen among the screens of
|
|
|
|
* its display.
|
|
|
|
*
|
|
|
|
* Returns the index of a #GdkScreen.
|
2002-11-28 00:33:17 +00:00
|
|
|
*
|
|
|
|
* Since: 2.2
|
2002-05-02 22:28:50 +00:00
|
|
|
*/
|
2002-04-25 22:29:14 +00:00
|
|
|
int
|
|
|
|
gdk_x11_screen_get_screen_number (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->screen_num;
|
2002-04-25 22:29:14 +00:00
|
|
|
}
|
2002-05-03 19:03:03 +00:00
|
|
|
|
2006-04-25 14:27:32 +00:00
|
|
|
static gboolean
|
|
|
|
check_is_composited (GdkDisplay *display,
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen)
|
2006-04-25 14:27:32 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
Atom xselection = gdk_x11_atom_to_xatom_for_display (display, x11_screen->cm_selection_atom);
|
2006-04-25 14:27:32 +00:00
|
|
|
Window xwindow;
|
|
|
|
|
|
|
|
xwindow = XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (display), xselection);
|
|
|
|
|
|
|
|
return xwindow != None;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkAtom
|
|
|
|
make_cm_atom (int screen_number)
|
|
|
|
{
|
|
|
|
gchar *name = g_strdup_printf ("_NET_WM_CM_S%d", screen_number);
|
|
|
|
GdkAtom atom = gdk_atom_intern (name, FALSE);
|
|
|
|
g_free (name);
|
|
|
|
return atom;
|
|
|
|
}
|
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
static void
|
|
|
|
init_monitor_geometry (GdkX11Monitor *monitor,
|
|
|
|
int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
monitor->geometry.x = x;
|
|
|
|
monitor->geometry.y = y;
|
|
|
|
monitor->geometry.width = width;
|
|
|
|
monitor->geometry.height = height;
|
|
|
|
|
|
|
|
monitor->output = None;
|
|
|
|
monitor->width_mm = -1;
|
|
|
|
monitor->height_mm = -1;
|
|
|
|
monitor->output_name = NULL;
|
|
|
|
monitor->manufacturer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
init_fake_xinerama (GdkScreen *screen)
|
|
|
|
{
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
XSetWindowAttributes atts;
|
|
|
|
Window win;
|
|
|
|
gint w, h;
|
|
|
|
|
|
|
|
if (!(_gdk_debug_flags & GDK_DEBUG_XINERAMA))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Fake Xinerama mode by splitting the screen into 4 monitors.
|
|
|
|
* Also draw a little cross to make the monitor boundaries visible.
|
|
|
|
*/
|
2010-12-21 01:32:13 +00:00
|
|
|
w = WidthOfScreen (x11_screen->xscreen);
|
|
|
|
h = HeightOfScreen (x11_screen->xscreen);
|
|
|
|
|
|
|
|
x11_screen->n_monitors = 4;
|
|
|
|
x11_screen->monitors = g_new0 (GdkX11Monitor, 4);
|
|
|
|
init_monitor_geometry (&x11_screen->monitors[0], 0, 0, w / 2, h / 2);
|
|
|
|
init_monitor_geometry (&x11_screen->monitors[1], w / 2, 0, w / 2, h / 2);
|
|
|
|
init_monitor_geometry (&x11_screen->monitors[2], 0, h / 2, w / 2, h / 2);
|
|
|
|
init_monitor_geometry (&x11_screen->monitors[3], w / 2, h / 2, w / 2, h / 2);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
|
|
|
atts.override_redirect = 1;
|
|
|
|
atts.background_pixel = WhitePixel(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->screen_num);
|
2007-12-13 18:27:05 +00:00
|
|
|
win = XCreateWindow(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xroot_window, 0, h / 2, w, 1, 0,
|
2007-12-13 18:27:05 +00:00
|
|
|
DefaultDepth(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->screen_num),
|
2007-12-13 18:27:05 +00:00
|
|
|
InputOutput,
|
|
|
|
DefaultVisual(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->screen_num),
|
2007-12-13 18:27:05 +00:00
|
|
|
CWOverrideRedirect|CWBackPixel,
|
|
|
|
&atts);
|
|
|
|
XMapRaised(GDK_SCREEN_XDISPLAY (screen), win);
|
|
|
|
win = XCreateWindow(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xroot_window, w/2 , 0, 1, h, 0,
|
2007-12-13 18:27:05 +00:00
|
|
|
DefaultDepth(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->screen_num),
|
2007-12-13 18:27:05 +00:00
|
|
|
InputOutput,
|
|
|
|
DefaultVisual(GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->screen_num),
|
2007-12-13 18:27:05 +00:00
|
|
|
CWOverrideRedirect|CWBackPixel,
|
|
|
|
&atts);
|
|
|
|
XMapRaised(GDK_SCREEN_XDISPLAY (screen), win);
|
|
|
|
return TRUE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-04-10 04:14:23 +00:00
|
|
|
static void
|
|
|
|
free_monitors (GdkX11Monitor *monitors,
|
|
|
|
gint n_monitors)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < n_monitors; ++i)
|
|
|
|
{
|
|
|
|
g_free (monitors[i].output_name);
|
|
|
|
g_free (monitors[i].manufacturer);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (monitors);
|
|
|
|
}
|
|
|
|
|
2010-06-03 17:43:42 +00:00
|
|
|
#ifdef HAVE_RANDR
|
2009-02-20 04:42:33 +00:00
|
|
|
static int
|
|
|
|
monitor_compare_function (GdkX11Monitor *monitor1,
|
|
|
|
GdkX11Monitor *monitor2)
|
|
|
|
{
|
|
|
|
/* Sort the leftmost/topmost monitors first.
|
|
|
|
* For "cloned" monitors, sort the bigger ones first
|
|
|
|
* (giving preference to taller monitors over wider
|
|
|
|
* monitors)
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (monitor1->geometry.x != monitor2->geometry.x)
|
|
|
|
return monitor1->geometry.x - monitor2->geometry.x;
|
|
|
|
|
|
|
|
if (monitor1->geometry.y != monitor2->geometry.y)
|
|
|
|
return monitor1->geometry.y - monitor2->geometry.y;
|
|
|
|
|
|
|
|
if (monitor1->geometry.height != monitor2->geometry.height)
|
|
|
|
return - (monitor1->geometry.height - monitor2->geometry.height);
|
|
|
|
|
|
|
|
if (monitor1->geometry.width != monitor2->geometry.width)
|
|
|
|
return - (monitor1->geometry.width - monitor2->geometry.width);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2010-06-03 17:43:42 +00:00
|
|
|
#endif
|
2009-02-20 04:42:33 +00:00
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
static gboolean
|
|
|
|
init_randr13 (GdkScreen *screen)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
GdkDisplay *display = gdk_screen_get_display (screen);
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-02-13 18:12:57 +00:00
|
|
|
Display *dpy = GDK_SCREEN_XDISPLAY (screen);
|
|
|
|
XRRScreenResources *resources;
|
2009-12-08 17:27:02 +00:00
|
|
|
RROutput primary_output;
|
2010-04-09 15:22:51 +00:00
|
|
|
RROutput first_output = None;
|
2009-02-13 18:12:57 +00:00
|
|
|
int i;
|
|
|
|
GArray *monitors;
|
|
|
|
gboolean randr12_compat = FALSE;
|
|
|
|
|
|
|
|
if (!display_x11->have_randr13)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
resources = XRRGetScreenResourcesCurrent (x11_screen->xdisplay,
|
|
|
|
x11_screen->xroot_window);
|
2009-02-13 18:12:57 +00:00
|
|
|
if (!resources)
|
|
|
|
return FALSE;
|
2009-12-08 17:27:02 +00:00
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
monitors = g_array_sized_new (FALSE, TRUE, sizeof (GdkX11Monitor),
|
|
|
|
resources->noutput);
|
|
|
|
|
|
|
|
for (i = 0; i < resources->noutput; ++i)
|
|
|
|
{
|
|
|
|
XRROutputInfo *output =
|
|
|
|
XRRGetOutputInfo (dpy, resources, resources->outputs[i]);
|
|
|
|
|
|
|
|
/* Non RandR1.2 X driver have output name "default" */
|
2010-04-09 13:05:38 +00:00
|
|
|
randr12_compat |= !g_strcmp0 (output->name, "default");
|
2009-02-13 18:12:57 +00:00
|
|
|
|
2009-02-18 23:12:26 +00:00
|
|
|
if (output->connection == RR_Disconnected)
|
2009-05-30 04:05:35 +00:00
|
|
|
{
|
|
|
|
XRRFreeOutputInfo (output);
|
|
|
|
continue;
|
|
|
|
}
|
2009-02-18 23:12:26 +00:00
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
if (output->crtc)
|
|
|
|
{
|
|
|
|
GdkX11Monitor monitor;
|
|
|
|
XRRCrtcInfo *crtc = XRRGetCrtcInfo (dpy, resources, output->crtc);
|
|
|
|
|
|
|
|
monitor.geometry.x = crtc->x;
|
|
|
|
monitor.geometry.y = crtc->y;
|
|
|
|
monitor.geometry.width = crtc->width;
|
|
|
|
monitor.geometry.height = crtc->height;
|
|
|
|
|
|
|
|
monitor.output = resources->outputs[i];
|
2009-02-18 23:12:26 +00:00
|
|
|
monitor.width_mm = output->mm_width;
|
|
|
|
monitor.height_mm = output->mm_height;
|
|
|
|
monitor.output_name = g_strdup (output->name);
|
|
|
|
/* FIXME: need EDID parser */
|
2009-02-13 18:12:57 +00:00
|
|
|
monitor.manufacturer = NULL;
|
|
|
|
|
|
|
|
g_array_append_val (monitors, monitor);
|
|
|
|
|
|
|
|
XRRFreeCrtcInfo (crtc);
|
|
|
|
}
|
|
|
|
|
|
|
|
XRRFreeOutputInfo (output);
|
|
|
|
}
|
|
|
|
|
2010-04-09 15:22:51 +00:00
|
|
|
if (resources->noutput > 0)
|
|
|
|
first_output = resources->outputs[0];
|
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
XRRFreeScreenResources (resources);
|
|
|
|
|
|
|
|
/* non RandR 1.2 X driver doesn't return any usable multihead data */
|
|
|
|
if (randr12_compat)
|
|
|
|
{
|
2009-04-10 04:14:23 +00:00
|
|
|
guint n_monitors = monitors->len;
|
|
|
|
|
|
|
|
free_monitors ((GdkX11Monitor *)g_array_free (monitors, FALSE),
|
|
|
|
n_monitors);
|
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-20 04:42:33 +00:00
|
|
|
g_array_sort (monitors,
|
|
|
|
(GCompareFunc) monitor_compare_function);
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->n_monitors = monitors->len;
|
|
|
|
x11_screen->monitors = (GdkX11Monitor *)g_array_free (monitors, FALSE);
|
2009-02-13 18:12:57 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->primary_monitor = 0;
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
|
|
|
x11_screen->xroot_window);
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
for (i = 0; i < x11_screen->n_monitors; ++i)
|
2010-04-09 13:05:38 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->monitors[i].output == primary_output)
|
2010-04-09 15:22:51 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->primary_monitor = i;
|
2010-04-09 15:22:51 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-04-09 13:05:38 +00:00
|
|
|
|
|
|
|
/* No RandR1.3+ available or no primary set, fall back to prefer LVDS as primary if present */
|
|
|
|
if (primary_output == None &&
|
2010-12-21 01:32:13 +00:00
|
|
|
g_ascii_strncasecmp (x11_screen->monitors[i].output_name, "LVDS", 4) == 0)
|
2010-04-09 15:22:51 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->primary_monitor = i;
|
2010-04-09 15:22:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No primary specified and no LVDS found */
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->monitors[i].output == first_output)
|
|
|
|
x11_screen->primary_monitor = i;
|
2010-04-09 13:05:38 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->n_monitors > 0;
|
2009-02-13 18:12:57 +00:00
|
|
|
#endif
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
static gboolean
|
|
|
|
init_solaris_xinerama (GdkScreen *screen)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_SOLARIS_XINERAMA
|
|
|
|
Display *dpy = GDK_SCREEN_XDISPLAY (screen);
|
|
|
|
int screen_no = gdk_screen_get_number (screen);
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
XRectangle monitors[MAXFRAMEBUFFERS];
|
|
|
|
unsigned char hints[16];
|
|
|
|
gint result;
|
|
|
|
int n_monitors;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!XineramaGetState (dpy, screen_no))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
result = XineramaGetInfo (dpy, screen_no, monitors, hints, &n_monitors);
|
|
|
|
|
|
|
|
/* Yes I know it should be Success but the current implementation
|
|
|
|
* returns the num of monitor
|
|
|
|
*/
|
|
|
|
if (result == 0)
|
|
|
|
{
|
2008-08-13 13:47:02 +00:00
|
|
|
return FALSE;
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->monitors = g_new0 (GdkX11Monitor, n_monitors);
|
|
|
|
x11_screen->n_monitors = n_monitors;
|
2007-12-13 18:27:05 +00:00
|
|
|
|
2008-08-13 13:47:02 +00:00
|
|
|
for (i = 0; i < n_monitors; i++)
|
2007-12-13 18:27:05 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
init_monitor_geometry (&x11_screen->monitors[i],
|
2008-08-13 13:47:02 +00:00
|
|
|
monitors[i].x, monitors[i].y,
|
|
|
|
monitors[i].width, monitors[i].height);
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->primary_monitor = 0;
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
return TRUE;
|
|
|
|
#endif /* HAVE_SOLARIS_XINERAMA */
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
init_xfree_xinerama (GdkScreen *screen)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_XFREE_XINERAMA
|
|
|
|
Display *dpy = GDK_SCREEN_XDISPLAY (screen);
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
XineramaScreenInfo *monitors;
|
|
|
|
int i, n_monitors;
|
|
|
|
|
|
|
|
if (!XineramaIsActive (dpy))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
monitors = XineramaQueryScreens (dpy, &n_monitors);
|
|
|
|
|
|
|
|
if (n_monitors <= 0 || monitors == NULL)
|
|
|
|
{
|
|
|
|
/* If Xinerama doesn't think we have any monitors, try acting as
|
|
|
|
* though we had no Xinerama. If the "no monitors" condition
|
|
|
|
* is because XRandR 1.2 is currently switching between CRTCs,
|
|
|
|
* we'll be notified again when we have our monitor back,
|
|
|
|
* and can go back into Xinerama-ish mode at that point.
|
|
|
|
*/
|
|
|
|
if (monitors)
|
|
|
|
XFree (monitors);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->n_monitors = n_monitors;
|
|
|
|
x11_screen->monitors = g_new0 (GdkX11Monitor, n_monitors);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_monitors; ++i)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
init_monitor_geometry (&x11_screen->monitors[i],
|
2007-12-13 18:27:05 +00:00
|
|
|
monitors[i].x_org, monitors[i].y_org,
|
|
|
|
monitors[i].width, monitors[i].height);
|
|
|
|
}
|
|
|
|
|
|
|
|
XFree (monitors);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->primary_monitor = 0;
|
2010-04-09 13:05:38 +00:00
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
return TRUE;
|
|
|
|
#endif /* HAVE_XFREE_XINERAMA */
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
static void
|
|
|
|
deinit_multihead (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-02-24 05:09:13 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
free_monitors (x11_screen->monitors, x11_screen->n_monitors);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->n_monitors = 0;
|
|
|
|
x11_screen->monitors = NULL;
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
static gboolean
|
|
|
|
compare_monitor (GdkX11Monitor *m1,
|
|
|
|
GdkX11Monitor *m2)
|
|
|
|
{
|
|
|
|
if (m1->geometry.x != m2->geometry.x ||
|
|
|
|
m1->geometry.y != m2->geometry.y ||
|
|
|
|
m1->geometry.width != m2->geometry.width ||
|
|
|
|
m1->geometry.height != m2->geometry.height)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (m1->width_mm != m2->width_mm ||
|
|
|
|
m1->height_mm != m2->height_mm)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (g_strcmp0 (m1->output_name, m2->output_name) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (g_strcmp0 (m1->manufacturer, m2->manufacturer) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
compare_monitors (GdkX11Monitor *monitors1, gint n_monitors1,
|
|
|
|
GdkX11Monitor *monitors2, gint n_monitors2)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
if (n_monitors1 != n_monitors2)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < n_monitors1; i++)
|
|
|
|
{
|
|
|
|
if (!compare_monitor (monitors1 + i, monitors2 + i))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
static void
|
|
|
|
init_multihead (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
int opcode, firstevent, firsterror;
|
|
|
|
|
|
|
|
/* There are four different implementations of multihead support:
|
|
|
|
*
|
|
|
|
* 1. Fake Xinerama for debugging purposes
|
|
|
|
* 2. RandR 1.2
|
|
|
|
* 3. Solaris Xinerama
|
|
|
|
* 4. XFree86/Xorg Xinerama
|
|
|
|
*
|
2009-02-13 18:12:57 +00:00
|
|
|
* We use them in that order.
|
2007-12-13 18:27:05 +00:00
|
|
|
*/
|
|
|
|
if (init_fake_xinerama (screen))
|
|
|
|
return;
|
|
|
|
|
2009-02-13 18:12:57 +00:00
|
|
|
if (init_randr13 (screen))
|
|
|
|
return;
|
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
if (XQueryExtension (GDK_SCREEN_XDISPLAY (screen), "XINERAMA",
|
|
|
|
&opcode, &firstevent, &firsterror))
|
|
|
|
{
|
|
|
|
if (init_solaris_xinerama (screen))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (init_xfree_xinerama (screen))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No multihead support of any kind for this screen */
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->n_monitors = 1;
|
|
|
|
x11_screen->monitors = g_new0 (GdkX11Monitor, 1);
|
|
|
|
x11_screen->primary_monitor = 0;
|
2007-12-13 18:27:05 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
init_monitor_geometry (x11_screen->monitors, 0, 0,
|
|
|
|
WidthOfScreen (x11_screen->xscreen),
|
|
|
|
HeightOfScreen (x11_screen->xscreen));
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2002-05-03 19:03:03 +00:00
|
|
|
GdkScreen *
|
|
|
|
_gdk_x11_screen_new (GdkDisplay *display,
|
|
|
|
gint screen_number)
|
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-12-20 18:20:10 +00:00
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2002-05-03 19:03:03 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
screen = g_object_new (GDK_TYPE_X11_SCREEN, NULL);
|
2002-05-03 19:03:03 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
|
|
|
x11_screen->display = display;
|
|
|
|
x11_screen->xdisplay = display_x11->xdisplay;
|
|
|
|
x11_screen->xscreen = ScreenOfDisplay (display_x11->xdisplay, screen_number);
|
|
|
|
x11_screen->screen_num = screen_number;
|
|
|
|
x11_screen->xroot_window = RootWindow (display_x11->xdisplay,screen_number);
|
|
|
|
x11_screen->wmspec_check_window = None;
|
2002-09-25 19:16:46 +00:00
|
|
|
/* we want this to be always non-null */
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->window_manager_name = g_strdup ("unknown");
|
2002-09-25 19:16:46 +00:00
|
|
|
|
2007-12-13 18:27:05 +00:00
|
|
|
init_multihead (screen);
|
2002-10-04 15:58:19 +00:00
|
|
|
init_randr_support (screen);
|
2002-05-03 19:03:03 +00:00
|
|
|
|
2010-12-15 19:49:23 +00:00
|
|
|
_gdk_x11_screen_init_visuals (screen);
|
|
|
|
_gdk_x11_screen_init_root_window (screen);
|
2006-04-25 14:27:32 +00:00
|
|
|
|
2002-05-03 19:03:03 +00:00
|
|
|
return screen;
|
|
|
|
}
|
|
|
|
|
2009-09-14 13:27:42 +00:00
|
|
|
/*
|
|
|
|
* It is important that we first request the selection
|
|
|
|
* notification, and then setup the initial state of
|
|
|
|
* is_composited to avoid a race condition here.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
_gdk_x11_screen_setup (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-09-14 13:27:42 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->cm_selection_atom = make_cm_atom (x11_screen->screen_num);
|
|
|
|
gdk_display_request_selection_notification (x11_screen->display,
|
|
|
|
x11_screen->cm_selection_atom);
|
|
|
|
x11_screen->is_composited = check_is_composited (x11_screen->display, x11_screen);
|
2009-09-14 13:27:42 +00:00
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gboolean
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_is_composited (GdkScreen *screen)
|
2006-04-25 14:27:32 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2006-04-25 14:27:32 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
2006-04-25 14:27:32 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->is_composited;
|
2006-04-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
2002-10-04 15:58:19 +00:00
|
|
|
static void
|
|
|
|
init_randr_support (GdkScreen * screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2002-10-04 15:58:19 +00:00
|
|
|
|
|
|
|
XSelectInput (GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xroot_window,
|
2002-10-04 15:58:19 +00:00
|
|
|
StructureNotifyMask);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_RANDR
|
|
|
|
XRRSelectInput (GDK_SCREEN_XDISPLAY (screen),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xroot_window,
|
2007-12-13 18:27:05 +00:00
|
|
|
RRScreenChangeNotifyMask |
|
|
|
|
RRCrtcChangeNotifyMask |
|
|
|
|
RROutputPropertyNotifyMask);
|
|
|
|
#endif
|
2002-10-04 15:58:19 +00:00
|
|
|
}
|
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
static void
|
|
|
|
process_monitors_change (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2009-02-24 05:09:13 +00:00
|
|
|
gint n_monitors;
|
|
|
|
GdkX11Monitor *monitors;
|
|
|
|
gboolean changed;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
n_monitors = x11_screen->n_monitors;
|
|
|
|
monitors = x11_screen->monitors;
|
2009-02-24 05:09:13 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->n_monitors = 0;
|
|
|
|
x11_screen->monitors = NULL;
|
2009-02-24 05:09:13 +00:00
|
|
|
|
|
|
|
init_multihead (screen);
|
|
|
|
|
|
|
|
changed = !compare_monitors (monitors, n_monitors,
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->monitors, x11_screen->n_monitors);
|
2009-02-24 05:09:13 +00:00
|
|
|
|
|
|
|
free_monitors (monitors, n_monitors);
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
g_signal_emit_by_name (screen, "monitors-changed");
|
|
|
|
}
|
|
|
|
|
2002-10-04 15:58:19 +00:00
|
|
|
void
|
|
|
|
_gdk_x11_screen_size_changed (GdkScreen *screen,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2008-10-22 14:55:56 +00:00
|
|
|
gint width, height;
|
2010-06-03 17:43:42 +00:00
|
|
|
#ifdef HAVE_RANDR
|
2010-12-20 16:14:04 +00:00
|
|
|
GdkX11Display *display_x11;
|
2010-06-03 17:43:42 +00:00
|
|
|
#endif
|
2008-10-22 14:55:56 +00:00
|
|
|
|
|
|
|
width = gdk_screen_get_width (screen);
|
|
|
|
height = gdk_screen_get_height (screen);
|
|
|
|
|
2002-10-04 15:58:19 +00:00
|
|
|
#ifdef HAVE_RANDR
|
2010-12-20 18:20:10 +00:00
|
|
|
display_x11 = GDK_X11_DISPLAY (gdk_screen_get_display (screen));
|
2009-02-24 05:09:13 +00:00
|
|
|
|
|
|
|
if (display_x11->have_randr13 && event->type == ConfigureNotify)
|
2009-12-08 17:27:02 +00:00
|
|
|
{
|
|
|
|
g_signal_emit_by_name (screen, "monitors-changed");
|
|
|
|
return;
|
|
|
|
}
|
2009-02-24 05:09:13 +00:00
|
|
|
|
|
|
|
XRRUpdateConfiguration (event);
|
2002-10-04 15:58:19 +00:00
|
|
|
#else
|
|
|
|
if (event->type == ConfigureNotify)
|
|
|
|
{
|
|
|
|
XConfigureEvent *rcevent = (XConfigureEvent *) event;
|
|
|
|
Screen *xscreen = gdk_x11_screen_get_xscreen (screen);
|
2010-06-03 17:43:42 +00:00
|
|
|
|
2002-10-04 15:58:19 +00:00
|
|
|
xscreen->width = rcevent->width;
|
|
|
|
xscreen->height = rcevent->height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
#endif
|
2008-10-22 14:55:56 +00:00
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
process_monitors_change (screen);
|
2007-12-13 18:27:05 +00:00
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
if (width != gdk_screen_get_width (screen) ||
|
|
|
|
height != gdk_screen_get_height (screen))
|
|
|
|
g_signal_emit_by_name (screen, "size-changed");
|
2007-12-13 18:27:05 +00:00
|
|
|
}
|
|
|
|
|
2002-09-25 19:16:46 +00:00
|
|
|
void
|
|
|
|
_gdk_x11_screen_window_manager_changed (GdkScreen *screen)
|
|
|
|
{
|
2003-02-28 01:45:51 +00:00
|
|
|
g_signal_emit (screen, signals[WINDOW_MANAGER_CHANGED], 0);
|
2002-09-25 19:16:46 +00:00
|
|
|
}
|
|
|
|
|
2006-04-25 14:27:32 +00:00
|
|
|
void
|
|
|
|
_gdk_x11_screen_process_owner_change (GdkScreen *screen,
|
|
|
|
XEvent *event)
|
|
|
|
{
|
2006-04-27 05:04:49 +00:00
|
|
|
#ifdef HAVE_XFIXES
|
2006-04-25 14:27:32 +00:00
|
|
|
XFixesSelectionNotifyEvent *selection_event = (XFixesSelectionNotifyEvent *)event;
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
|
|
|
Atom xcm_selection_atom = gdk_x11_atom_to_xatom_for_display (x11_screen->display,
|
|
|
|
x11_screen->cm_selection_atom);
|
2006-04-25 14:27:32 +00:00
|
|
|
|
|
|
|
if (selection_event->selection == xcm_selection_atom)
|
|
|
|
{
|
|
|
|
gboolean composited = selection_event->owner != None;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (composited != x11_screen->is_composited)
|
2006-04-25 14:27:32 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->is_composited = composited;
|
2006-04-25 14:27:32 +00:00
|
|
|
|
2009-02-24 05:09:13 +00:00
|
|
|
g_signal_emit_by_name (screen, "composited-changed");
|
2006-04-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-27 05:04:49 +00:00
|
|
|
#endif
|
2006-04-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 03:32:47 +00:00
|
|
|
static gchar *
|
|
|
|
substitute_screen_number (const gchar *display_name,
|
|
|
|
gint screen_number)
|
2002-10-31 21:12:23 +00:00
|
|
|
{
|
|
|
|
GString *str;
|
|
|
|
gchar *p;
|
|
|
|
|
|
|
|
str = g_string_new (display_name);
|
|
|
|
|
|
|
|
p = strrchr (str->str, '.');
|
|
|
|
if (p && p > strchr (str->str, ':'))
|
|
|
|
g_string_truncate (str, p - str->str);
|
|
|
|
|
|
|
|
g_string_append_printf (str, ".%d", screen_number);
|
|
|
|
|
|
|
|
return g_string_free (str, FALSE);
|
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gchar *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_make_display_name (GdkScreen *screen)
|
2002-09-25 15:07:47 +00:00
|
|
|
{
|
|
|
|
const gchar *old_display;
|
|
|
|
|
2002-10-31 21:12:23 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
2002-09-25 15:07:47 +00:00
|
|
|
|
2002-10-31 21:12:23 +00:00
|
|
|
old_display = gdk_display_get_name (gdk_screen_get_display (screen));
|
2002-09-25 15:07:47 +00:00
|
|
|
|
2010-12-15 03:32:47 +00:00
|
|
|
return substitute_screen_number (old_display,
|
|
|
|
gdk_screen_get_number (screen));
|
2002-09-25 15:07:47 +00:00
|
|
|
}
|
2005-03-16 03:17:27 +00:00
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static GdkWindow *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_active_window (GdkScreen *screen)
|
2006-03-08 17:02:34 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2006-03-08 17:02:34 +00:00
|
|
|
GdkWindow *ret = NULL;
|
|
|
|
Atom type_return;
|
|
|
|
gint format_return;
|
|
|
|
gulong nitems_return;
|
|
|
|
gulong bytes_after_return;
|
|
|
|
guchar *data = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
|
|
|
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (screen,
|
|
|
|
gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
|
|
|
|
return NULL;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
2006-03-08 17:02:34 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
|
2006-03-08 17:02:34 +00:00
|
|
|
"_NET_ACTIVE_WINDOW"),
|
|
|
|
0, 1, False, XA_WINDOW, &type_return,
|
|
|
|
&format_return, &nitems_return,
|
|
|
|
&bytes_after_return, &data)
|
|
|
|
== Success)
|
|
|
|
{
|
|
|
|
if ((type_return == XA_WINDOW) && (format_return == 32) && (data))
|
|
|
|
{
|
|
|
|
GdkNativeWindow window = *(GdkNativeWindow *) data;
|
|
|
|
|
|
|
|
if (window != None)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
ret = gdk_x11_window_foreign_new_for_display (x11_screen->display,
|
2010-12-15 06:39:30 +00:00
|
|
|
*(Window *) data);
|
2006-03-08 17:02:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
XFree (data);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static GList *
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_window_stack (GdkScreen *screen)
|
2006-03-08 17:02:34 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2006-03-08 17:02:34 +00:00
|
|
|
GList *ret = NULL;
|
|
|
|
Atom type_return;
|
|
|
|
gint format_return;
|
|
|
|
gulong nitems_return;
|
|
|
|
gulong bytes_after_return;
|
|
|
|
guchar *data = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
|
|
|
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (screen,
|
|
|
|
gdk_atom_intern_static_string ("_NET_CLIENT_LIST_STACKING")))
|
|
|
|
return NULL;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
2006-03-08 17:02:34 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
|
2006-03-08 17:02:34 +00:00
|
|
|
"_NET_CLIENT_LIST_STACKING"),
|
|
|
|
0, G_MAXLONG, False, XA_WINDOW, &type_return,
|
|
|
|
&format_return, &nitems_return,
|
|
|
|
&bytes_after_return, &data)
|
|
|
|
== Success)
|
|
|
|
{
|
|
|
|
if ((type_return == XA_WINDOW) && (format_return == 32) &&
|
|
|
|
(data) && (nitems_return > 0))
|
|
|
|
{
|
2008-07-06 06:05:02 +00:00
|
|
|
gulong *stack = (gulong *) data;
|
2006-03-08 17:02:34 +00:00
|
|
|
GdkWindow *win;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < nitems_return; i++)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
win = gdk_x11_window_foreign_new_for_display (x11_screen->display,
|
2010-12-15 06:39:30 +00:00
|
|
|
(Window)stack[i]);
|
2006-03-08 17:02:34 +00:00
|
|
|
|
|
|
|
if (win != NULL)
|
|
|
|
ret = g_list_append (ret, win);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
XFree (data);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
/* Sends a ClientMessage to all toplevel client windows */
|
|
|
|
static gboolean
|
|
|
|
gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
|
|
|
|
XEvent *xev,
|
|
|
|
guint32 xid,
|
|
|
|
guint level)
|
|
|
|
{
|
|
|
|
Atom type = None;
|
|
|
|
int format;
|
|
|
|
unsigned long nitems, after;
|
|
|
|
unsigned char *data;
|
|
|
|
Window *ret_children, ret_root, ret_parent;
|
|
|
|
unsigned int ret_nchildren;
|
|
|
|
gboolean send = FALSE;
|
|
|
|
gboolean found = FALSE;
|
|
|
|
gboolean result = FALSE;
|
|
|
|
int i;
|
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_display_error_trap_push (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xid,
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE"),
|
|
|
|
0, 0, False, AnyPropertyType,
|
|
|
|
&type, &format, &nitems, &after, &data) != Success)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
send = TRUE;
|
|
|
|
XFree (data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* OK, we're all set, now let's find some windows to send this to */
|
|
|
|
if (!XQueryTree (GDK_DISPLAY_XDISPLAY (display), xid,
|
|
|
|
&ret_root, &ret_parent,
|
|
|
|
&ret_children, &ret_nchildren))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
for(i = 0; i < ret_nchildren; i++)
|
|
|
|
if (gdk_event_send_client_message_to_all_recurse (display, xev, ret_children[i], level + 1))
|
|
|
|
found = TRUE;
|
|
|
|
|
|
|
|
XFree (ret_children);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (send || (!found && (level == 1)))
|
|
|
|
{
|
|
|
|
xev->xclient.window = xid;
|
2010-12-15 22:38:48 +00:00
|
|
|
_gdk_x11_display_send_xevent (display, xid, False, NoEventMask, xev);
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
result = send || found;
|
|
|
|
|
|
|
|
out:
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_display_error_trap_pop_ignored (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static void
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_broadcast_client_message (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
GdkEvent *event)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
XEvent sev;
|
|
|
|
GdkWindow *root_window;
|
|
|
|
|
|
|
|
g_return_if_fail (event != NULL);
|
|
|
|
|
|
|
|
root_window = gdk_screen_get_root_window (screen);
|
|
|
|
|
|
|
|
/* Set up our event to send, with the exception of its target window */
|
|
|
|
sev.xclient.type = ClientMessage;
|
|
|
|
sev.xclient.display = GDK_WINDOW_XDISPLAY (root_window);
|
|
|
|
sev.xclient.format = event->client.data_format;
|
|
|
|
memcpy(&sev.xclient.data, &event->client.data, sizeof (sev.xclient.data));
|
|
|
|
sev.xclient.message_type =
|
|
|
|
gdk_x11_atom_to_xatom_for_display (GDK_WINDOW_DISPLAY (root_window),
|
|
|
|
event->client.message_type);
|
|
|
|
|
|
|
|
gdk_event_send_client_message_to_all_recurse (gdk_screen_get_display (screen),
|
|
|
|
&sev,
|
|
|
|
GDK_WINDOW_XID (root_window),
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
check_transform (const gchar *xsettings_name,
|
|
|
|
GType src_type,
|
|
|
|
GType dest_type)
|
|
|
|
{
|
|
|
|
if (!g_value_type_transformable (src_type, dest_type))
|
|
|
|
{
|
|
|
|
g_warning ("Cannot transform xsetting %s of type %s to type %s\n",
|
|
|
|
xsettings_name,
|
|
|
|
g_type_name (src_type),
|
|
|
|
g_type_name (dest_type));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-12-06 21:05:13 +00:00
|
|
|
static gboolean
|
2010-12-21 01:32:13 +00:00
|
|
|
gdk_x11_screen_get_setting (GdkScreen *screen,
|
2010-12-06 21:05:13 +00:00
|
|
|
const gchar *name,
|
|
|
|
GValue *value)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
const char *xsettings_name = NULL;
|
|
|
|
XSettingsResult result;
|
|
|
|
XSettingsSetting *setting = NULL;
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-05-25 22:38:44 +00:00
|
|
|
gboolean success = FALSE;
|
|
|
|
gint i;
|
|
|
|
GValue tmp_val = { 0, };
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
for (i = 0; i < GDK_SETTINGS_N_ELEMENTS(); i++)
|
|
|
|
if (strcmp (GDK_SETTINGS_GDK_NAME (i), name) == 0)
|
|
|
|
{
|
|
|
|
xsettings_name = GDK_SETTINGS_X_NAME (i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!xsettings_name)
|
|
|
|
goto out;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
result = xsettings_client_get_setting (x11_screen->xsettings_client,
|
2010-05-25 22:38:44 +00:00
|
|
|
xsettings_name, &setting);
|
|
|
|
if (result != XSETTINGS_SUCCESS)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
switch (setting->type)
|
|
|
|
{
|
|
|
|
case XSETTINGS_TYPE_INT:
|
|
|
|
if (check_transform (xsettings_name, G_TYPE_INT, G_VALUE_TYPE (value)))
|
|
|
|
{
|
|
|
|
g_value_init (&tmp_val, G_TYPE_INT);
|
|
|
|
g_value_set_int (&tmp_val, setting->data.v_int);
|
|
|
|
g_value_transform (&tmp_val, value);
|
|
|
|
|
|
|
|
success = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XSETTINGS_TYPE_STRING:
|
|
|
|
if (check_transform (xsettings_name, G_TYPE_STRING, G_VALUE_TYPE (value)))
|
|
|
|
{
|
|
|
|
g_value_init (&tmp_val, G_TYPE_STRING);
|
|
|
|
g_value_set_string (&tmp_val, setting->data.v_string);
|
|
|
|
g_value_transform (&tmp_val, value);
|
|
|
|
|
|
|
|
success = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XSETTINGS_TYPE_COLOR:
|
|
|
|
if (!check_transform (xsettings_name, GDK_TYPE_COLOR, G_VALUE_TYPE (value)))
|
|
|
|
{
|
|
|
|
GdkColor color;
|
|
|
|
|
|
|
|
g_value_init (&tmp_val, GDK_TYPE_COLOR);
|
|
|
|
|
|
|
|
color.pixel = 0;
|
|
|
|
color.red = setting->data.v_color.red;
|
|
|
|
color.green = setting->data.v_color.green;
|
|
|
|
color.blue = setting->data.v_color.blue;
|
|
|
|
|
|
|
|
g_value_set_boxed (&tmp_val, &color);
|
|
|
|
|
|
|
|
g_value_transform (&tmp_val, value);
|
|
|
|
|
|
|
|
success = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_unset (&tmp_val);
|
|
|
|
|
|
|
|
out:
|
|
|
|
if (setting)
|
|
|
|
xsettings_setting_free (setting);
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return _gdk_x11_get_xft_setting (screen, name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cleanup_atoms(gpointer data)
|
|
|
|
{
|
|
|
|
NetWmSupportedAtoms *supported_atoms = data;
|
|
|
|
if (supported_atoms->atoms)
|
|
|
|
XFree (supported_atoms->atoms);
|
|
|
|
g_free (supported_atoms);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
fetch_net_wm_check_window (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkDisplay *display;
|
|
|
|
Atom type;
|
|
|
|
gint format;
|
|
|
|
gulong n_items;
|
|
|
|
gulong bytes_after;
|
|
|
|
guchar *data;
|
|
|
|
Window *xwindow;
|
|
|
|
GTimeVal tv;
|
|
|
|
gint error;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
|
|
|
display = x11_screen->display;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
g_return_if_fail (GDK_X11_DISPLAY (display)->trusted_client);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
g_get_current_time (&tv);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (ABS (tv.tv_sec - x11_screen->last_wmspec_check_time) < 15)
|
2010-05-25 22:38:44 +00:00
|
|
|
return; /* we've checked recently */
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->last_wmspec_check_time = tv.tv_sec;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
data = NULL;
|
2010-12-21 01:32:13 +00:00
|
|
|
XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
2010-05-25 22:38:44 +00:00
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
|
|
|
|
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
|
|
|
|
&n_items, &bytes_after, &data);
|
|
|
|
|
|
|
|
if (type != XA_WINDOW)
|
|
|
|
{
|
|
|
|
if (data)
|
|
|
|
XFree (data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xwindow = (Window *)data;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->wmspec_check_window == *xwindow)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
XFree (xwindow);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_display_error_trap_push (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
/* Find out if this WM goes away, so we can reset everything. */
|
2010-12-21 01:32:13 +00:00
|
|
|
XSelectInput (x11_screen->xdisplay, *xwindow, StructureNotifyMask);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
error = gdk_x11_display_error_trap_pop (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
if (!error)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->wmspec_check_window = *xwindow;
|
|
|
|
x11_screen->need_refetch_net_supported = TRUE;
|
|
|
|
x11_screen->need_refetch_wm_name = TRUE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
/* Careful, reentrancy */
|
2010-12-21 01:32:13 +00:00
|
|
|
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (x11_screen));
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
else if (error == BadWindow)
|
|
|
|
{
|
|
|
|
/* Leftover property, try again immediately, new wm may be starting up */
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->last_wmspec_check_time = 0;
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
XFree (xwindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_x11_screen_supports_net_wm_hint:
|
|
|
|
* @screen: the relevant #GdkScreen.
|
|
|
|
* @property: a property atom.
|
|
|
|
*
|
|
|
|
* This function is specific to the X11 backend of GDK, and indicates
|
|
|
|
* whether the window manager supports a certain hint from the
|
|
|
|
* Extended Window Manager Hints Specification. You can find this
|
|
|
|
* specification on
|
|
|
|
* <ulink url="http://www.freedesktop.org">http://www.freedesktop.org</ulink>.
|
|
|
|
*
|
|
|
|
* When using this function, keep in mind that the window manager
|
|
|
|
* can change over time; so you shouldn't use this function in
|
|
|
|
* a way that impacts persistent application state. A common bug
|
|
|
|
* is that your application can start up before the window manager
|
|
|
|
* does when the user logs in, and before the window manager starts
|
|
|
|
* gdk_x11_screen_supports_net_wm_hint() will return %FALSE for every property.
|
|
|
|
* You can monitor the window_manager_changed signal on #GdkScreen to detect
|
|
|
|
* a window manager change.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the window manager supports @property
|
|
|
|
*
|
|
|
|
* Since: 2.2
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
|
|
|
|
GdkAtom property)
|
|
|
|
{
|
|
|
|
gulong i;
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-05-25 22:38:44 +00:00
|
|
|
NetWmSupportedAtoms *supported_atoms;
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
|
|
|
display = x11_screen->display;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
if (!G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client))
|
2010-05-25 22:38:44 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
supported_atoms = g_object_get_data (G_OBJECT (screen), "gdk-net-wm-supported-atoms");
|
|
|
|
if (!supported_atoms)
|
|
|
|
{
|
|
|
|
supported_atoms = g_new0 (NetWmSupportedAtoms, 1);
|
|
|
|
g_object_set_data_full (G_OBJECT (screen), "gdk-net-wm-supported-atoms", supported_atoms, cleanup_atoms);
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch_net_wm_check_window (screen);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->wmspec_check_window == None)
|
2010-05-25 22:38:44 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->need_refetch_net_supported)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
/* WM has changed since we last got the supported list,
|
|
|
|
* refetch it.
|
|
|
|
*/
|
|
|
|
Atom type;
|
|
|
|
gint format;
|
|
|
|
gulong bytes_after;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->need_refetch_net_supported = FALSE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (supported_atoms->atoms)
|
|
|
|
XFree (supported_atoms->atoms);
|
|
|
|
|
|
|
|
supported_atoms->atoms = NULL;
|
|
|
|
supported_atoms->n_atoms = 0;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), x11_screen->xroot_window,
|
2010-05-25 22:38:44 +00:00
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTED"),
|
|
|
|
0, G_MAXLONG, False, XA_ATOM, &type, &format,
|
|
|
|
&supported_atoms->n_atoms, &bytes_after,
|
|
|
|
(guchar **)&supported_atoms->atoms);
|
|
|
|
|
|
|
|
if (type != XA_ATOM)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (supported_atoms->atoms == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < supported_atoms->n_atoms)
|
|
|
|
{
|
|
|
|
if (supported_atoms->atoms[i] == gdk_x11_atom_to_xatom_for_display (display, property))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
refcounted_grab_server (Display *xdisplay)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
|
|
|
|
|
|
|
|
gdk_x11_display_grab (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
refcounted_ungrab_server (Display *xdisplay)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
|
|
|
|
|
|
|
|
gdk_x11_display_ungrab (display);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkFilterReturn
|
|
|
|
gdk_xsettings_client_event_filter (GdkXEvent *xevent,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *screen = data;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (xsettings_client_process_event (screen->xsettings_client, (XEvent *)xevent))
|
|
|
|
return GDK_FILTER_REMOVE;
|
|
|
|
else
|
|
|
|
return GDK_FILTER_CONTINUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
gdk_xsettings_watch_cb (Window window,
|
|
|
|
Bool is_start,
|
|
|
|
long mask,
|
|
|
|
void *cb_data)
|
|
|
|
{
|
|
|
|
GdkWindow *gdkwin;
|
|
|
|
GdkScreen *screen = cb_data;
|
|
|
|
|
2010-12-15 06:39:30 +00:00
|
|
|
gdkwin = gdk_x11_window_lookup_for_display (gdk_screen_get_display (screen), window);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (is_start)
|
|
|
|
{
|
|
|
|
if (gdkwin)
|
|
|
|
g_object_ref (gdkwin);
|
|
|
|
else
|
|
|
|
{
|
2010-12-15 06:39:30 +00:00
|
|
|
gdkwin = gdk_x11_window_foreign_new_for_display (gdk_screen_get_display (screen), window);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
/* gdk_window_foreign_new_for_display() can fail and return NULL if the
|
|
|
|
* window has already been destroyed.
|
|
|
|
*/
|
|
|
|
if (!gdkwin)
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_window_add_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!gdkwin)
|
|
|
|
{
|
|
|
|
/* gdkwin should not be NULL here, since if starting the watch succeeded
|
|
|
|
* we have a reference on the window. It might mean that the caller didn't
|
|
|
|
* remove the watch when it got a DestroyNotify event. Or maybe the
|
|
|
|
* caller ignored the return value when starting the watch failed.
|
|
|
|
*/
|
|
|
|
g_warning ("gdk_xsettings_watch_cb(): Couldn't find window to unwatch");
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_window_remove_filter (gdkwin, gdk_xsettings_client_event_filter, screen);
|
|
|
|
g_object_unref (gdkwin);
|
|
|
|
}
|
|
|
|
|
|
|
|
return True;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_xsettings_notify_cb (const char *name,
|
|
|
|
XSettingsAction action,
|
|
|
|
XSettingsSetting *setting,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
GdkEvent new_event;
|
|
|
|
GdkScreen *screen = data;
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = data;
|
2010-05-25 22:38:44 +00:00
|
|
|
int i;
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->xsettings_in_init)
|
2010-05-25 22:38:44 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
new_event.type = GDK_SETTING;
|
|
|
|
new_event.setting.window = gdk_screen_get_root_window (screen);
|
|
|
|
new_event.setting.send_event = FALSE;
|
|
|
|
new_event.setting.name = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < GDK_SETTINGS_N_ELEMENTS() ; i++)
|
|
|
|
if (strcmp (GDK_SETTINGS_X_NAME (i), name) == 0)
|
|
|
|
{
|
|
|
|
new_event.setting.name = (char*) GDK_SETTINGS_GDK_NAME (i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!new_event.setting.name)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case XSETTINGS_ACTION_NEW:
|
|
|
|
new_event.setting.action = GDK_SETTING_ACTION_NEW;
|
|
|
|
break;
|
|
|
|
case XSETTINGS_ACTION_CHANGED:
|
|
|
|
new_event.setting.action = GDK_SETTING_ACTION_CHANGED;
|
|
|
|
break;
|
|
|
|
case XSETTINGS_ACTION_DELETED:
|
|
|
|
new_event.setting.action = GDK_SETTING_ACTION_DELETED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gdk_event_put (&new_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-12-15 19:49:23 +00:00
|
|
|
_gdk_x11_screen_init_events (GdkScreen *screen)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
/* Keep a flag to avoid extra notifies that we don't need
|
|
|
|
*/
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xsettings_in_init = TRUE;
|
|
|
|
x11_screen->xsettings_client = xsettings_client_new_with_grab_funcs (x11_screen->xdisplay,
|
|
|
|
x11_screen->screen_num,
|
2010-05-25 22:38:44 +00:00
|
|
|
gdk_xsettings_notify_cb,
|
|
|
|
gdk_xsettings_watch_cb,
|
|
|
|
screen,
|
|
|
|
refcounted_grab_server,
|
|
|
|
refcounted_ungrab_server);
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->xsettings_in_init = FALSE;
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_x11_screen_get_window_manager_name:
|
|
|
|
* @screen: a #GdkScreen
|
|
|
|
*
|
|
|
|
* Returns the name of the window manager for @screen.
|
|
|
|
*
|
|
|
|
* Return value: the name of the window manager screen @screen, or
|
|
|
|
* "unknown" if the window manager is unknown. The string is owned by GDK
|
|
|
|
* and should not be freed.
|
|
|
|
*
|
|
|
|
* Since: 2.2
|
|
|
|
**/
|
|
|
|
const char*
|
|
|
|
gdk_x11_screen_get_window_manager_name (GdkScreen *screen)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
GdkX11Screen *x11_screen;
|
2010-12-15 07:05:05 +00:00
|
|
|
GdkDisplay *display;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen = GDK_X11_SCREEN (screen);
|
|
|
|
display = x11_screen->display;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
if (!G_LIKELY (GDK_X11_DISPLAY (display)->trusted_client))
|
2010-12-21 01:32:13 +00:00
|
|
|
return x11_screen->window_manager_name;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
fetch_net_wm_check_window (screen);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->need_refetch_wm_name)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
/* Get the name of the window manager */
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->need_refetch_wm_name = FALSE;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
g_free (x11_screen->window_manager_name);
|
|
|
|
x11_screen->window_manager_name = g_strdup ("unknown");
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
if (x11_screen->wmspec_check_window != None)
|
2010-05-25 22:38:44 +00:00
|
|
|
{
|
|
|
|
Atom type;
|
|
|
|
gint format;
|
|
|
|
gulong n_items;
|
|
|
|
gulong bytes_after;
|
|
|
|
gchar *name;
|
|
|
|
|
|
|
|
name = NULL;
|
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_display_error_trap_push (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
|
2010-12-21 01:32:13 +00:00
|
|
|
x11_screen->wmspec_check_window,
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_get_xatom_by_name_for_display (display,
|
2010-05-25 22:38:44 +00:00
|
|
|
"_NET_WM_NAME"),
|
|
|
|
0, G_MAXLONG, False,
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_get_xatom_by_name_for_display (display,
|
2010-05-25 22:38:44 +00:00
|
|
|
"UTF8_STRING"),
|
|
|
|
&type, &format,
|
|
|
|
&n_items, &bytes_after,
|
|
|
|
(guchar **)&name);
|
|
|
|
|
2010-12-15 07:05:05 +00:00
|
|
|
gdk_x11_display_error_trap_pop_ignored (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
if (name != NULL)
|
|
|
|
{
|
2010-12-21 01:32:13 +00:00
|
|
|
g_free (x11_screen->window_manager_name);
|
|
|
|
x11_screen->window_manager_name = g_strdup (name);
|
2010-05-25 22:38:44 +00:00
|
|
|
XFree (name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
return GDK_X11_SCREEN (screen)->window_manager_name;
|
2010-05-25 22:38:44 +00:00
|
|
|
}
|
2010-12-06 21:05:13 +00:00
|
|
|
|
|
|
|
static void
|
2010-12-21 01:40:45 +00:00
|
|
|
gdk_x11_screen_class_init (GdkX11ScreenClass *klass)
|
2010-12-06 21:05:13 +00:00
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
object_class->dispose = gdk_x11_screen_dispose;
|
|
|
|
object_class->finalize = gdk_x11_screen_finalize;
|
|
|
|
|
|
|
|
screen_class->get_display = gdk_x11_screen_get_display;
|
|
|
|
screen_class->get_width = gdk_x11_screen_get_width;
|
|
|
|
screen_class->get_height = gdk_x11_screen_get_height;
|
|
|
|
screen_class->get_width_mm = gdk_x11_screen_get_width_mm;
|
|
|
|
screen_class->get_height_mm = gdk_x11_screen_get_height_mm;
|
|
|
|
screen_class->get_number = gdk_x11_screen_get_number;
|
|
|
|
screen_class->get_root_window = gdk_x11_screen_get_root_window;
|
|
|
|
screen_class->get_n_monitors = gdk_x11_screen_get_n_monitors;
|
|
|
|
screen_class->get_primary_monitor = gdk_x11_screen_get_primary_monitor;
|
|
|
|
screen_class->get_monitor_width_mm = gdk_x11_screen_get_monitor_width_mm;
|
|
|
|
screen_class->get_monitor_height_mm = gdk_x11_screen_get_monitor_height_mm;
|
|
|
|
screen_class->get_monitor_plug_name = gdk_x11_screen_get_monitor_plug_name;
|
|
|
|
screen_class->get_monitor_geometry = gdk_x11_screen_get_monitor_geometry;
|
|
|
|
screen_class->get_system_visual = _gdk_x11_screen_get_system_visual;
|
|
|
|
screen_class->get_rgba_visual = gdk_x11_screen_get_rgba_visual;
|
|
|
|
screen_class->is_composited = gdk_x11_screen_is_composited;
|
|
|
|
screen_class->make_display_name = gdk_x11_screen_make_display_name;
|
|
|
|
screen_class->get_active_window = gdk_x11_screen_get_active_window;
|
|
|
|
screen_class->get_window_stack = gdk_x11_screen_get_window_stack;
|
|
|
|
screen_class->broadcast_client_message = gdk_x11_screen_broadcast_client_message;
|
|
|
|
screen_class->get_setting = gdk_x11_screen_get_setting;
|
|
|
|
screen_class->visual_get_best_depth = _gdk_x11_screen_visual_get_best_depth;
|
|
|
|
screen_class->visual_get_best_type = _gdk_x11_screen_visual_get_best_type;
|
|
|
|
screen_class->visual_get_best = _gdk_x11_screen_visual_get_best;
|
|
|
|
screen_class->visual_get_best_with_depth = _gdk_x11_screen_visual_get_best_with_depth;
|
|
|
|
screen_class->visual_get_best_with_type = _gdk_x11_screen_visual_get_best_with_type;
|
|
|
|
screen_class->visual_get_best_with_both = _gdk_x11_screen_visual_get_best_with_both;
|
|
|
|
screen_class->query_depths = _gdk_x11_screen_query_depths;
|
|
|
|
screen_class->query_visual_types = _gdk_x11_screen_query_visual_types;
|
|
|
|
screen_class->list_visuals = _gdk_x11_screen_list_visuals;
|
2010-12-06 21:05:13 +00:00
|
|
|
|
|
|
|
signals[WINDOW_MANAGER_CHANGED] =
|
|
|
|
g_signal_new (g_intern_static_string ("window_manager_changed"),
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2010-12-21 01:32:13 +00:00
|
|
|
G_STRUCT_OFFSET (GdkX11ScreenClass, window_manager_changed),
|
2010-12-06 21:05:13 +00:00
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE,
|
|
|
|
0);
|
|
|
|
}
|