From a72af211e195098e25913f8004128c4135735f2a 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/screen.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/openbox/config.c b/openbox/config.c index 212be65..d6aa6c3 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -64,6 +64,7 @@ guint config_desktops_num; GSList *config_desktops_names; guint config_screen_firstdesk; guint config_desktop_popup_time; +gint config_emulate_xinerama; gboolean config_resize_redraw; gint config_resize_popup_show; @@ -777,6 +778,8 @@ static void parse_desktops(xmlNodePtr node, gpointer d) if (d > 0) config_screen_firstdesk = (unsigned) d; } + if ((n = obt_xml_find_node(node, "emulatexinerama"))) + config_emulate_xinerama = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "names"))) { GSList *it; xmlNodePtr nname; @@ -1092,6 +1095,7 @@ void config_startup(ObtXmlInst *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 fc1d217..786d236 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -170,6 +170,8 @@ extern RrFont *config_font_inactiveosd; extern guint 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/screen.c b/openbox/screen.c index e758ada..09e824c 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1373,6 +1373,20 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin) *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(obt_display, ob_screen)) / 2, + HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen))); + RECT_SET((*xin_areas)[1], + WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)) / 2, + 0, + WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)) / 2, + HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen))); + RECT_SET((*xin_areas)[*nxin], 0, 0, + WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)), + HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen))); } #ifdef XINERAMA else if (obt_display_extension_xinerama && -- 1.9.1