From f1470130c6e0c3ca04f046337f085d95103079a8 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 24 Jul 2007 01:35:12 +0200 Subject: [PATCH] Add emulatexinerama option in desktops section that splits the screen in two side-by-side areas. --- openbox/config.c | 4 ++++ openbox/config.h | 2 ++ openbox/extensions.c | 28 +++++++++++++++++----------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/openbox/config.c b/openbox/config.c index 2bdd1966..0f886cca 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -58,6 +58,7 @@ gint config_desktops_num; GSList *config_desktops_names; guint config_screen_firstdesk; guint config_desktop_popup_time; +gint config_emulate_xinerama; gboolean config_resize_redraw; gboolean config_resize_four_corners; @@ -619,6 +620,8 @@ static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, if (d > 0) config_screen_firstdesk = (unsigned) d; } + if ((n = parse_find_node("emulatexinerama", node))) + config_emulate_xinerama = parse_bool(doc, n); if ((n = parse_find_node("names", node))) { GSList *it; xmlNodePtr nname; @@ -902,6 +905,7 @@ void config_startup(ObParseInst *i) config_desktops_num = 4; config_screen_firstdesk = 1; + config_emulate_xinerama = FALSE; config_desktops_names = NULL; config_desktop_popup_time = 875; diff --git a/openbox/config.h b/openbox/config.h index 9d0602e2..0a3eda12 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -143,6 +143,8 @@ extern RrFont *config_font_osd; extern gint config_desktops_num; /*! Desktop to start on, put 5 to start in the center of a 3x3 grid */ extern guint config_screen_firstdesk; +/*! Emulate xinerama by dividing screen in two halves, left and right. */ +extern gboolean config_emulate_xinerama; /*! Names for the desktops */ extern GSList *config_desktops_names; /*! Amount of time to show the desktop switch dialog */ diff --git a/openbox/extensions.c b/openbox/extensions.c index 89a96576..130804fc 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -21,6 +21,7 @@ #include "geom.h" #include "extensions.h" #include "screen.h" +#include "config.h" #include "debug.h" gboolean extensions_xkb = FALSE; @@ -87,7 +88,7 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) guint i; gint l, r, t, b; #ifdef XINERAMA - if (extensions_xinerama) { + if (!config_emulate_xinerama && extensions_xinerama) { guint i; gint n; XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n); @@ -99,22 +100,27 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) XFree(info); } else #endif - if (ob_debug_xinerama) { - 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 { + if (config_emulate_xinerama) { + *nxin = 2; + *xin_areas = g_new(Rect, *nxin + 1); + RECT_SET((*xin_areas)[0], 0, 0, + WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2, + HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen))); + RECT_SET((*xin_areas)[1], + WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2, + 0, + WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)) / 2, + HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen))); + RECT_SET((*xin_areas)[*nxin], 0, 0, + WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)), + HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen))); + } 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; -- 2.34.1