]> Dogcows Code - chaz/openbox/commitdiff
move the code for tracking what extensions are available on the display into the...
authorDana Jansens <danakj@orodu.net>
Tue, 24 Jul 2007 01:32:31 +0000 (21:32 -0400)
committerDana Jansens <danakj@orodu.net>
Sun, 20 Jan 2008 06:36:54 +0000 (01:36 -0500)
13 files changed:
Makefile.am
obt/display.c
obt/display.h
obt/obt.h [deleted file]
openbox/client.c
openbox/event.c
openbox/extensions.c [deleted file]
openbox/extensions.h [deleted file]
openbox/frame.c
openbox/grab.c
openbox/moveresize.c
openbox/openbox.c
openbox/screen.c

index 6c2140ef1089b746661e917384fd33fc7761bfdb..389042fb01bfb1ecbd76bd052ce15efea85daa5c 100644 (file)
@@ -113,8 +113,12 @@ parser_libobparser_la_SOURCES = \
 ## obt ##
 
 obt_libobt_la_CPPFLAGS = \
+       $(XINERAMA_CFLAGS) \
+       $(XKB_CFLAGS) \
+       $(XRANDR_CFLAGS) \
+       $(XSHAPE_CFLAGS) \
+       $(XSYNC_CFLAGS) \
        $(GLIB_CFLAGS) \
-       $(XML_CFLAGS) \
        -DG_LOG_DOMAIN=\"Obt\" \
        -DLOCALEDIR=\"$(localedir)\" \
        -DDATADIR=\"$(datadir)\" \
@@ -122,10 +126,13 @@ obt_libobt_la_CPPFLAGS = \
 obt_libobt_la_LDFLAGS = \
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 obt_libobt_la_LIBADD = \
-       $(GLIB_LIBS) \
-       $(XML_LIBS)
+       $(XINERAMA_LIBS) \
+       $(XKB_LIBS) \
+       $(XRANDR_LIBS) \
+       $(XSHAPE_LIBS) \
+       $(XSYNC_LIBS) \
+       $(GLIB_LIBS)
 obt_libobt_la_SOURCES = \
-       obt/obt.h \
        obt/display.h \
        obt/display.c \
        obt/mainloop.h \
@@ -136,11 +143,6 @@ obt_libobt_la_SOURCES = \
 
 openbox_openbox_CPPFLAGS = \
        $(SM_CFLAGS) \
-       $(XINERAMA_CFLAGS) \
-       $(XKB_CFLAGS) \
-       $(XRANDR_CFLAGS) \
-       $(XSHAPE_CFLAGS) \
-       $(XSYNC_CFLAGS) \
        $(X_CFLAGS) \
        $(XCURSOR_CFLAGS) \
        $(SM_CFLAGS) \
@@ -154,11 +156,6 @@ openbox_openbox_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"Openbox\"
 openbox_openbox_LDADD = \
        $(SM_LIBS) \
-       $(XINERAMA_LIBS) \
-       $(XKB_LIBS) \
-       $(XRANDR_LIBS) \
-       $(XSHAPE_LIBS) \
-       $(XSYNC_LIBS) \
        $(GLIB_LIBS) \
        $(X_LIBS) \
        $(XCURSOR_LIBS) \
@@ -228,8 +225,6 @@ openbox_openbox_SOURCES = \
        openbox/dock.h \
        openbox/event.c \
        openbox/event.h \
-       openbox/extensions.c \
-       openbox/extensions.h \
        openbox/focus.c \
        openbox/focus.h \
        openbox/focus_cycle.c \
@@ -399,7 +394,6 @@ pubinclude_HEADERS = \
        render/render.h \
        render/theme.h \
        parser/parse.h \
-       obt/obt.h \
        obt/display.h \
        obt/mainloop.h \
        obt/util.h
index b638f9cdf23c1305fef45860ce554c238aa8c9f0..d99667805e9ff7cc1fe715324ff7ffd94f4c35f5 100644 (file)
 #  include <unistd.h>
 #endif
 
+gboolean obt_display_error_occured = FALSE;
+
+gboolean obt_display_extension_xkb       = FALSE;
+gint     obt_display_extension_xkb_basep;
+gboolean obt_display_extension_shape     = FALSE;
+gint     obt_display_extension_shape_basep;
+gboolean obt_display_extension_xinerama  = FALSE;
+gint     obt_display_extension_xinerama_basep;
+gboolean obt_display_extension_randr     = FALSE;
+gint     obt_display_extension_randr_basep;
+gboolean obt_display_extension_sync      = FALSE;
+gint     obt_display_extension_sync_basep;
+
 static gint xerror_handler(Display *d, XErrorEvent *e);
 
 static gboolean xerror_ignore = FALSE;
-static gboolean xerror_occured = FALSE;
 
 Display* obt_display_open(const char *display_name)
 {
@@ -41,9 +53,56 @@ Display* obt_display_open(const char *display_name)
     n = display_name ? g_strdup(display_name) : NULL;
     d = XOpenDisplay(n);
     if (d) {
+        gint junk;
+        (void)junk;
+
         if (fcntl(ConnectionNumber(d), F_SETFD, 1) == -1)
             g_message("Failed to set display as close-on-exec");
         XSetErrorHandler(xerror_handler);
+
+        /* read what extensions are present */
+#ifdef XKB
+        obt_display_extension_xkb =
+            XkbQueryExtension(d, &junk,
+                              &obt_display_extension_xkb_basep, &junk,
+                              NULL, NULL);
+        if (!obt_display_extension_xkb)
+            g_message("XKB extension is not present on the server");
+#endif
+
+#ifdef SHAPE
+        obt_display_extension_shape =
+            XShapeQueryExtension(d, &obt_display_extension_shape_basep,
+                                 &junk);
+        if (!obt_display_extension_shape)
+            g_message("X Shape extension is not present on the server");
+#endif
+
+#ifdef XINERAMA
+        obt_display_extension_xinerama =
+            XineramaQueryExtension(d,
+                                   &obt_display_extension_xinerama_basep,
+                                   &junk) && XineramaIsActive(d);
+        if (!obt_display_extension_xinerama)
+            g_message("Xinerama extension is not present on the server");
+#endif
+
+#ifdef XRANDR
+        obt_display_extension_randr =
+            XRRQueryExtension(d, &obt_display_extension_randr_basep,
+                              &junk);
+        if (!obt_display_extension_randr)
+            g_message("XRandR extension is not present on the server");
+#endif
+
+#ifdef SYNC
+        obt_display_extension_sync =
+            XSyncQueryExtension(d, &obt_display_extension_sync_basep,
+                                &junk) && XSyncInitialize(d, &junk, &junk);
+        if (!obt_display_extension_sync)
+            g_message("X Sync extension is not present on the server or is an "
+                      "incompatible version");
+#endif
     }
     g_free(n);
 
@@ -72,7 +131,7 @@ static gint xerror_handler(Display *d, XErrorEvent *e)
     (void)d; (void)e;
 #endif
 
-    xerror_occured = TRUE;
+    obt_display_error_occured = TRUE;
     return 0;
 }
 
@@ -80,10 +139,5 @@ void obt_display_ignore_errors(Display *d, gboolean ignore)
 {
     XSync(d, FALSE);
     xerror_ignore = ignore;
-    if (ignore) xerror_occured = FALSE;
-}
-
-gboolean obt_display_error_occured()
-{
-    return xerror_occured;
+    if (ignore) obt_display_error_occured = FALSE;
 }
index aafa0fcd4901f32a9ac767575c1133d35fc07045..b4a13c7cb2b04199da4ecc40449a5963baa0e9c5 100644 (file)
    See the COPYING file for a copy of the GNU General Public License.
 */
 
-#ifndef __obt_instance_h
-#define __obt_instance_h
+#ifndef __obt_display_h
+#define __obt_display_h
 
 #include <X11/Xlib.h>
 #include <glib.h>
 
+#include <X11/Xutil.h> /* shape.h uses Region which is in here */
+#ifdef    XKB
+#include <X11/XKBlib.h>
+#endif
+#ifdef    SHAPE
+#include <X11/extensions/shape.h>
+#endif
+#ifdef    XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+#ifdef    XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+#ifdef    SYNC
+#include <X11/extensions/sync.h>
+#endif
+
 G_BEGIN_DECLS
 
+extern gboolean obt_display_error_occured;
+
+extern gboolean obt_display_extension_xkb;
+extern gint     obt_display_extension_xkb_basep;
+extern gboolean obt_display_extension_shape;
+extern gint     obt_display_extension_shape_basep;
+extern gboolean obt_display_extension_xinerama;
+extern gint     obt_display_extension_xinerama_basep;
+extern gboolean obt_display_extension_randr;
+extern gint     obt_display_extension_randr_basep;
+extern gboolean obt_display_extension_sync;
+extern gint     obt_display_extension_sync_basep;
+
 Display* obt_display_open(const char *display_name);
 void     obt_display_close(Display *d);
 
 void     obt_display_ignore_errors(Display *d, gboolean ignore);
-gboolean obt_display_error_occured();
 
 G_END_DECLS
 
-#endif /*__obt_instance_h*/
+#endif /*__obt_display_h*/
diff --git a/obt/obt.h b/obt/obt.h
deleted file mode 100644 (file)
index 0343a6a..0000000
--- a/obt/obt.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
-
-   obt.h for the Openbox window manager
-   Copyright (c) 2007        Dana Jansens
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program 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 General Public License for more details.
-
-   See the COPYING file for a copy of the GNU General Public License.
-*/
-
-#ifndef __obt_h
-#define __obt_h
-
-#include "obt/instance.h"
-#include "obt/util.h"
-
-#endif /*__obt_h*/
index 025dd1297e6e6011d61b4584c2cfc65e4c5a29f3..20ccfe3d22cb1b399f18616cd5318707447b858b 100644 (file)
@@ -26,7 +26,6 @@
 #include "ping.h"
 #include "place.h"
 #include "prop.h"
-#include "extensions.h"
 #include "frame.h"
 #include "session.h"
 #include "event.h"
@@ -1262,7 +1261,7 @@ static void client_get_shaped(ObClient *self)
 {
     self->shaped = FALSE;
 #ifdef   SHAPE
-    if (extensions_shape) {
+    if (obt_display_extension_shape) {
         gint foo;
         guint ufoo;
         gint s;
@@ -3639,8 +3638,8 @@ gboolean client_focus(ObClient *self)
     obt_display_ignore_errors(ob_display, FALSE);
 
     ob_debug_type(OB_DEBUG_FOCUS, "Error focusing? %d\n",
-                  obt_display_error_occured());
-    return !obt_display_error_occured();
+                  obt_display_error_occured);
+    return !obt_display_error_occured;
 }
 
 static void client_present(ObClient *self, gboolean here, gboolean raise,
index 5aa739215db672713075f565ad5269db81dc1dc0..63e27df685d6cd2919129984e00d6502bd50e3db 100644 (file)
@@ -39,7 +39,6 @@
 #include "moveresize.h"
 #include "group.h"
 #include "stacking.h"
-#include "extensions.h"
 #include "translate.h"
 #include "ping.h"
 #include "obt/display.h"
@@ -180,7 +179,9 @@ static Window event_get_window(XEvent *e)
         break;
     default:
 #ifdef XKB
-        if (extensions_xkb && e->type == extensions_xkb_event_basep) {
+        if (obt_display_extension_xkb &&
+            e->type == obt_display_extension_xkb_basep)
+        {
             switch (((XkbAnyEvent*)e)->xkb_type) {
             case XkbBellNotify:
                 window = ((XkbBellNotifyEvent*)e)->window;
@@ -190,8 +191,8 @@ static Window event_get_window(XEvent *e)
         } else
 #endif
 #ifdef SYNC
-        if (extensions_sync &&
-            e->type == extensions_sync_event_basep + XSyncAlarmNotify)
+        if (obt_display_extension_sync &&
+            e->type == obt_display_extension_sync_basep + XSyncAlarmNotify)
         {
             window = None;
         } else
@@ -229,8 +230,8 @@ static void event_set_curtime(XEvent *e)
         break;
     default:
 #ifdef SYNC
-        if (extensions_sync &&
-            e->type == extensions_sync_event_basep + XSyncAlarmNotify)
+        if (obt_display_extension_sync &&
+            e->type == obt_display_extension_sync_basep + XSyncAlarmNotify)
         {
             t = ((XSyncAlarmNotifyEvent*)e)->time;
         }
@@ -690,8 +691,8 @@ static void event_process(const XEvent *ec, gpointer data)
         obt_display_ignore_errors(ob_display, FALSE);
     }
 #ifdef SYNC
-    else if (extensions_sync &&
-        e->type == extensions_sync_event_basep + XSyncAlarmNotify)
+    else if (obt_display_extension_sync &&
+             e->type == obt_display_extension_sync_basep + XSyncAlarmNotify)
     {
         XSyncAlarmNotifyEvent *se = (XSyncAlarmNotifyEvent*)e;
         if (se->alarm == moveresize_alarm && moveresize_in_progress)
@@ -1585,7 +1586,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
     default:
         ;
 #ifdef SHAPE
-        if (extensions_shape && e->type == extensions_shape_event_basep) {
+        if (obt_display_extension_shape &&
+            e->type == obt_display_extension_shape_basep)
+        {
             client->shaped = ((XShapeEvent*)e)->shaped;
             frame_adjust_shape(client->frame);
         }
diff --git a/openbox/extensions.c b/openbox/extensions.c
deleted file mode 100644 (file)
index d108836..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
-
-   extensions.c for the Openbox window manager
-   Copyright (c) 2006        Mikael Magnusson
-   Copyright (c) 2003-2007   Dana Jansens
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program 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 General Public License for more details.
-
-   See the COPYING file for a copy of the GNU General Public License.
-*/
-
-#include "openbox.h"
-#include "geom.h"
-#include "extensions.h"
-#include "screen.h"
-#include "debug.h"
-
-gboolean extensions_xkb       = FALSE;
-gint     extensions_xkb_event_basep;
-gboolean extensions_shape     = FALSE;
-gint     extensions_shape_event_basep;
-gboolean extensions_xinerama  = FALSE;
-gint     extensions_xinerama_event_basep;
-gboolean extensions_randr     = FALSE;
-gint     extensions_randr_event_basep;
-gboolean extensions_sync      = FALSE;
-gint     extensions_sync_event_basep;
-
-void extensions_query_all(void)
-{
-    gint junk;
-    (void)junk;
-
-#ifdef XKB
-    extensions_xkb =
-        XkbQueryExtension(ob_display, &junk, &extensions_xkb_event_basep,
-                          &junk, NULL, NULL);
-    if (!extensions_xkb)
-        ob_debug("XKB extension is not present on the server\n");
-#endif
-
-#ifdef SHAPE
-    extensions_shape =
-        XShapeQueryExtension(ob_display, &extensions_shape_event_basep,
-                             &junk);
-    if (!extensions_shape)
-        ob_debug("X Shape extension is not present on the server\n");
-#endif
-
-#ifdef XINERAMA
-    extensions_xinerama =
-        XineramaQueryExtension(ob_display, &extensions_xinerama_event_basep,
-                               &junk) && XineramaIsActive(ob_display);
-    if (!extensions_xinerama)
-        ob_debug("Xinerama extension is not present on the server\n");
-#endif
-
-#ifdef XRANDR
-    extensions_randr =
-        XRRQueryExtension(ob_display, &extensions_randr_event_basep,
-                          &junk);
-    if (!extensions_randr)
-        ob_debug("XRandR extension is not present on the server\n");
-#endif
-
-#ifdef SYNC
-    extensions_sync =
-        XSyncQueryExtension(ob_display, &extensions_sync_event_basep,
-                            &junk) &&
-        XSyncInitialize(ob_display, &junk, &junk);
-    if (!extensions_sync)
-        ob_debug("X Sync extension is not present on the server or is an "
-                 "incompatible version\n");
-#endif
-}
-
-void extensions_xinerama_screens(Rect **xin_areas, guint *nxin)
-{
-    guint i;
-    gint l, r, t, b;
-    if (ob_debug_xinerama) {
-        g_print("Using fake xinerama !\n");
-        gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen));
-        gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen));
-        *nxin = 2;
-        *xin_areas = g_new(Rect, *nxin + 1);
-        RECT_SET((*xin_areas)[0], 0, 0, w/2, h);
-        RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h);
-    }
-    else
-#ifdef XINERAMA
-    if (extensions_xinerama) {
-        guint i;
-        gint n;
-        XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n);
-        *nxin = n;
-        *xin_areas = g_new(Rect, *nxin + 1);
-        for (i = 0; i < *nxin; ++i)
-            RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org,
-                     info[i].width, info[i].height);
-        XFree(info);
-    }
-    else
-#endif
-    {
-        *nxin = 1;
-        *xin_areas = g_new(Rect, *nxin + 1);
-        RECT_SET((*xin_areas)[0], 0, 0,
-                 WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
-                 HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
-    }
-
-    /* returns one extra with the total area in it */
-    l = (*xin_areas)[0].x;
-    t = (*xin_areas)[0].y;
-    r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1;
-    b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1;
-    for (i = 1; i < *nxin; ++i) {
-        l = MIN(l, (*xin_areas)[i].x);
-        t = MIN(l, (*xin_areas)[i].y);
-        r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1);
-        b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
-    }
-    RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
-}
diff --git a/openbox/extensions.h b/openbox/extensions.h
deleted file mode 100644 (file)
index 3155874..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
-
-   extensions.h for the Openbox window manager
-   Copyright (c) 2006        Mikael Magnusson
-   Copyright (c) 2003-2007   Dana Jansens
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program 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 General Public License for more details.
-
-   See the COPYING file for a copy of the GNU General Public License.
-*/
-
-#ifndef __extensions_h
-#define __extensions_h
-
-#include "geom.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h> /* shape.h uses Region which is in here */
-#ifdef    XKB
-#include <X11/XKBlib.h>
-#endif
-#ifdef    SHAPE
-#include <X11/extensions/shape.h>
-#endif
-#ifdef    XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
-#ifdef    XRANDR
-#include <X11/extensions/Xrandr.h>
-#endif
-#ifdef    SYNC
-#include <X11/extensions/sync.h>
-#endif
-
-#include <glib.h>
-
-/*! Does the display have the XKB extension? */
-extern gboolean extensions_xkb;
-/*! Base for events for the XKB extension */
-extern gint extensions_xkb_event_basep;
-
-/*! Does the display have the Shape extension? */
-extern gboolean extensions_shape;
-/*! Base for events for the Shape extension */
-extern gint extensions_shape_event_basep;
-
-/*! Does the display have the Xinerama extension? */
-extern gboolean extensions_xinerama;
-/*! Base for events for the Xinerama extension */
-extern gint extensions_xinerama_event_basep;
-
-/*! Does the display have the RandR extension? */
-extern gboolean extensions_randr;
-/*! Base for events for the Randr extension */
-extern gint extensions_randr_event_basep;
-
-/*! Does the display have the Sync extension? */
-extern gboolean extensions_sync;
-/*! Base for events for the Sync extension */
-extern gint extensions_sync_event_basep;
-
-void extensions_query_all();
-
-void extensions_xinerama_screens(Rect **areas, guint *nxin);
-
-#endif
index 2952b6c7640c80be9f02d19d9f4c9d525e7141c8..be8230c02256a608ee1d7eb71daa5cf0cb0c1d5a 100644 (file)
@@ -20,7 +20,6 @@
 #include "frame.h"
 #include "client.h"
 #include "openbox.h"
-#include "extensions.h"
 #include "prop.h"
 #include "grab.h"
 #include "config.h"
@@ -30,6 +29,7 @@
 #include "moveresize.h"
 #include "screen.h"
 #include "render/theme.h"
+#include "obt/display.h"
 
 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
                          ButtonPressMask | ButtonReleaseMask | \
index d84ef94fdb6980512f9bc302f1559b23f48ec2cd..cfbbbe1ae82fb31ca5a11f5684ab211a95e9d149 100644 (file)
@@ -180,7 +180,7 @@ void grab_button_full(guint button, guint state, Window win, guint mask,
         XGrabButton(ob_display, button, state | mask_list[i], win, False, mask,
                     pointer_mode, GrabModeAsync, None, ob_cursor(cur));
     obt_display_ignore_errors(ob_display, FALSE);
-    if (obt_display_error_occured())
+    if (obt_display_error_occured)
         ob_debug("Failed to grab button %d modifiers %d", button, state);
 }
 
@@ -202,7 +202,7 @@ void grab_key(guint keycode, guint state, Window win, gint keyboard_mode)
         XGrabKey(ob_display, keycode, state | mask_list[i], win, FALSE,
                  GrabModeAsync, keyboard_mode);
     obt_display_ignore_errors(ob_display, FALSE);
-    if (obt_display_error_occured())
+    if (obt_display_error_occured)
         ob_debug("Failed to grab keycode %d modifiers %d", keycode, state);
 }
 
index 4349f74856345481547680570d3823321463d53b..ed70899c444bde3557b1d5ef44406f00cd33a7ad 100644 (file)
@@ -31,9 +31,9 @@
 #include "config.h"
 #include "event.h"
 #include "debug.h"
-#include "extensions.h"
 #include "render/render.h"
 #include "render/theme.h"
+#include "obt/display.h"
 
 #include <X11/Xlib.h>
 #include <glib.h>
@@ -250,7 +250,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
     moveresize_in_progress = TRUE;
 
 #ifdef SYNC
-    if (config_resize_redraw && !moving && extensions_sync &&
+    if (config_resize_redraw && !moving && obt_display_extension_sync &&
         moveresize_client->sync_request && moveresize_client->sync_counter)
     {
         /* Initialize values for the resize syncing, and create an alarm for
@@ -365,7 +365,7 @@ static void do_resize(void)
     }
 
 #ifdef SYNC
-    if (config_resize_redraw && extensions_sync &&
+    if (config_resize_redraw && obt_display_extension_sync &&
         moveresize_client->sync_request && moveresize_client->sync_counter)
     {
         XEvent ce;
@@ -923,7 +923,7 @@ gboolean moveresize_event(XEvent *e)
         }
     }
 #ifdef SYNC
-    else if (e->type == extensions_sync_event_basep + XSyncAlarmNotify)
+    else if (e->type == obt_display_extension_sync_basep + XSyncAlarmNotify)
     {
         waiting_for_sync = FALSE; /* we got our sync... */
         do_resize(); /* ...so try resize if there is more change pending */
index f00cd2bd093fcab1899ca4f09a3c60a707f8954c..ec283d5ce54c452fd636ab2b743df786f1ccff9e 100644 (file)
@@ -37,7 +37,6 @@
 #include "frame.h"
 #include "keyboard.h"
 #include "mouse.h"
-#include "extensions.h"
 #include "menuframe.h"
 #include "grab.h"
 #include "group.h"
@@ -207,9 +206,7 @@ gint main(gint argc, gchar **argv)
     cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
                                                XC_top_left_corner);
 
-
     prop_startup(); /* get atoms values for the display */
-    extensions_query_all(); /* find which extensions are present */
 
     if (screen_annex()) { /* it will be ours! */
         do {
index d287c9fcbca1ec4569bbac4dbf1a788b8785bcde..0d891630e46152f7f5a1e48fde300d6d367aa8a2 100644 (file)
@@ -33,7 +33,6 @@
 #include "event.h"
 #include "focus.h"
 #include "popup.h"
-#include "extensions.h"
 #include "render/render.h"
 #include "gettext.h"
 #include "obt/display.h"
@@ -110,7 +109,7 @@ static gboolean replace_wm(void)
         XSync(ob_display, FALSE);
 
         obt_display_ignore_errors(ob_display, FALSE);
-        if (obt_display_error_occured())
+        if (obt_display_error_occured)
             current_wm_sn_owner = None;
     }
 
@@ -184,7 +183,7 @@ gboolean screen_annex(void)
     XSelectInput(ob_display, RootWindow(ob_display, ob_screen),
                  ROOT_EVENTMASK);
     obt_display_ignore_errors(ob_display, FALSE);
-    if (obt_display_error_occured()) {
+    if (obt_display_error_occured) {
         g_message(_("A window manager is already running on screen %d"),
                   ob_screen);
 
@@ -1291,6 +1290,55 @@ typedef struct {
     } \
 }
 
+static void get_xinerama_screens(Rect **xin_areas, guint *nxin)
+{
+    guint i;
+    gint l, r, t, b;
+
+    if (ob_debug_xinerama) {
+        g_print("Using fake xinerama !\n");
+        gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen));
+        gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen));
+        *nxin = 2;
+        *xin_areas = g_new(Rect, *nxin + 1);
+        RECT_SET((*xin_areas)[0], 0, 0, w/2, h);
+        RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h);
+    }
+#ifdef XINERAMA
+    else if (obt_display_extension_xinerama) {
+        guint i;
+        gint n;
+        XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n);
+        *nxin = n;
+        *xin_areas = g_new(Rect, *nxin + 1);
+        for (i = 0; i < *nxin; ++i)
+            RECT_SET((*xin_areas)[i], info[i].x_org, info[i].y_org,
+                     info[i].width, info[i].height);
+        XFree(info);
+    }
+#endif
+    else {
+        *nxin = 1;
+        *xin_areas = g_new(Rect, *nxin + 1);
+        RECT_SET((*xin_areas)[0], 0, 0,
+                 WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)),
+                 HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)));
+    }
+
+    /* returns one extra with the total area in it */
+    l = (*xin_areas)[0].x;
+    t = (*xin_areas)[0].y;
+    r = (*xin_areas)[0].x + (*xin_areas)[0].width - 1;
+    b = (*xin_areas)[0].y + (*xin_areas)[0].height - 1;
+    for (i = 1; i < *nxin; ++i) {
+        l = MIN(l, (*xin_areas)[i].x);
+        t = MIN(l, (*xin_areas)[i].y);
+        r = MAX(r, (*xin_areas)[i].x + (*xin_areas)[i].width - 1);
+        b = MAX(b, (*xin_areas)[i].y + (*xin_areas)[i].height - 1);
+    }
+    RECT_SET((*xin_areas)[*nxin], l, t, r - l + 1, b - t + 1);
+}
+
 void screen_update_areas(void)
 {
     guint i, j;
@@ -1299,7 +1347,7 @@ void screen_update_areas(void)
     GSList *sit;
 
     g_free(monitor_area);
-    extensions_xinerama_screens(&monitor_area, &screen_num_monitors);
+    get_xinerama_screens(&monitor_area, &screen_num_monitors);
 
     /* set up the user-specified margins */
     config_margins.top_start = RECT_LEFT(monitor_area[screen_num_monitors]);
This page took 0.053759 seconds and 4 git commands to generate.