From 8c547e2afee5247e7dcbbae76a3f871db7d32ffb 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 fa1a2aaf..bafa35ce 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -58,6 +58,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; @@ -632,6 +633,8 @@ static void parse_desktops(xmlNodePtr node, gpointer d) if (d > 0) config_screen_firstdesk = (unsigned) d; } + if ((n = obt_parse_find_node(node, "emulatexinerama"))) + config_emulate_xinerama = obt_parse_node_bool(n); if ((n = obt_parse_find_node(node, "names"))) { GSList *it; xmlNodePtr nname; @@ -933,6 +936,7 @@ void config_startup(ObtParseInst *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 8a01ee1f..32c61309 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -148,6 +148,8 @@ extern RrFont *config_font_osd; 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 221e338d..109d0f1d 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1306,6 +1306,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) { -- 2.34.1