summaryrefslogtreecommitdiff
path: root/gdk/x11
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-10-04 15:58:19 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-10-04 15:58:19 +0000
commit8555f42715e83e3016fd8a36ee3a99f8d405509f (patch)
tree2305e2ba30fc5f47a6bd52a4d390d130f7f4f1c0 /gdk/x11
parent85d726f9aa22ff9f6b9487b4f3e380a40f731f4b (diff)
downloadgtk+-8555f42715e83e3016fd8a36ee3a99f8d405509f.tar.gz
Add a check for the Xrandr extension.
Fri Oct 4 11:43:47 2002 Owen Taylor <otaylor@redhat.com> * configure.in: Add a check for the Xrandr extension. * gdk/gdkscreen.[ch]: Add a size-changed signal. * gdk/x11/gdkscreen-x11.[ch]: Patch from Keith packard to hook up ConfigureNotify events on the root window to the ::size-changed signal. (#94560) * gtk/gtkimcontextsimple.c: Warning fixes
Diffstat (limited to 'gdk/x11')
-rw-r--r--gdk/x11/gdkevents-x11.c3
-rw-r--r--gdk/x11/gdkscreen-x11.c39
-rw-r--r--gdk/x11/gdkscreen-x11.h2
3 files changed, 44 insertions, 0 deletions
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index cd9ec3ead9..19fa6c9130 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -1447,6 +1447,9 @@ gdk_event_translate (GdkDisplay *display,
: xevent->xconfigure.event != xevent->xconfigure.window
? " (discarding substructure)"
: ""));
+ if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
+ _gdk_x11_screen_size_changed (screen, xevent);
+
if (window &&
xevent->xconfigure.event == xevent->xconfigure.window &&
!GDK_WINDOW_DESTROYED (window) &&
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 2f312f5771..dc408adee8 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -45,6 +45,7 @@ static void gdk_screen_x11_class_init (GdkScreenX11Class *klass);
static void gdk_screen_x11_dispose (GObject *object);
static void gdk_screen_x11_finalize (GObject *object);
static void init_xinerama_support (GdkScreen *screen);
+static void init_randr_support (GdkScreen *screen);
enum
{
@@ -382,6 +383,7 @@ _gdk_x11_screen_new (GdkDisplay *display,
screen_x11->window_manager_name = g_strdup ("unknown");
init_xinerama_support (screen);
+ init_randr_support (screen);
_gdk_visual_init (screen);
_gdk_windowing_window_init (screen);
@@ -480,6 +482,9 @@ static void
init_xinerama_support (GdkScreen * screen)
{
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
+
+ if (screen_x11->monitors)
+ g_free (screen_x11->monitors);
#ifdef HAVE_XINERAMA
int opcode, firstevent, firsterror;
@@ -503,6 +508,40 @@ init_xinerama_support (GdkScreen * screen)
screen_x11->monitors[0].height = HeightOfScreen (screen_x11->xscreen);
}
+static void
+init_randr_support (GdkScreen * screen)
+{
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
+
+ XSelectInput (GDK_SCREEN_XDISPLAY (screen),
+ screen_x11->xroot_window,
+ StructureNotifyMask);
+}
+
+void
+_gdk_x11_screen_size_changed (GdkScreen *screen,
+ XEvent *event)
+{
+#ifdef HAVE_RANDR
+ if (!XRRUpdateConfiguration (event))
+ return;
+#else
+ if (event->type == ConfigureNotify)
+ {
+ XConfigureEvent *rcevent = (XConfigureEvent *) event;
+ Screen *xscreen = gdk_x11_screen_get_xscreen (screen);
+
+ xscreen->width = rcevent->width;
+ xscreen->height = rcevent->height;
+ }
+ else
+ return;
+#endif
+
+ init_xinerama_support (screen);
+ g_signal_emit_by_name (G_OBJECT (screen), "size_changed");
+}
+
void
_gdk_x11_screen_window_manager_changed (GdkScreen *screen)
{
diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h
index 6d3864671e..89aa4390de 100644
--- a/gdk/x11/gdkscreen-x11.h
+++ b/gdk/x11/gdkscreen-x11.h
@@ -102,6 +102,8 @@ GdkScreen * _gdk_x11_screen_new (GdkDisplay *display,
gint screen_number);
void _gdk_x11_screen_window_manager_changed (GdkScreen *screen);
+void _gdk_x11_screen_size_changed (GdkScreen *screen,
+ XEvent *event);
G_END_DECLS