From 64c65f3b67364bb82420dbdd05d7e655b1d74d43 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 21 Mar 2004 00:48:48 +0000 Subject: [PATCH] adds option to have the popup centered above the window instead of centered, and fix the last occurance of that reversed variable --- openbox/config.c | 10 +++++++++- openbox/config.h | 7 ++++++- openbox/moveresize.c | 16 +++++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/openbox/config.c b/openbox/config.c index 6a8dfaca..63ad6794 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -42,6 +42,7 @@ gint config_screen_firstdesk; gboolean config_resize_redraw; gint config_resize_popup_show; +gint config_resize_popup_pos; ObStackingLayer config_dock_layer; gboolean config_dock_floating; @@ -301,6 +302,12 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, else if (parse_contains("Nonpixel", doc, n)) config_resize_popup_show = 1; } + if ((n = parse_find_node("popupPosition", node))) { + if (parse_contains("Top", doc, n)) + config_resize_popup_pos = 1; + else if (parse_contains("Center", doc, n)) + config_resize_popup_pos = 0; + } } static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, @@ -540,7 +547,8 @@ void config_startup(ObParseInst *i) parse_register(i, "desktops", parse_desktops, NULL); config_resize_redraw = TRUE; - config_resize_popup_show = 1; + config_resize_popup_show = 1; /* nonpixel increments */ + config_resize_popup_pos = 0; /* center of client */ parse_register(i, "resize", parse_resize, NULL); diff --git a/openbox/config.h b/openbox/config.h index 59ac5542..ebe13a13 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -43,7 +43,12 @@ extern ObPlacePolicy config_place_policy; /*! When true windows' contents are refreshed while they are resized; otherwise they are not updated until the resize is complete */ -extern gboolean config_redraw_resize; +extern gboolean config_resize_redraw; +/*! show move/resize popups? 0 = no, 1 = always, 2 = only + resizing !1 increments */ +extern gint config_resize_popup_show; +/*! where to show the popup, currently above the window or centered */ +extern gint config_resize_popup_pos; /*! The stacking layer the dock will reside in */ extern ObStackingLayer config_dock_layer; diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 68c75129..71241117 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -77,11 +77,17 @@ static void popup_coords(ObClient *c, gchar *format, gint a, gint b) gchar *text; text = g_strdup_printf(format, a, b); - popup_position(popup, CenterGravity, - c->frame->area.x + c->frame->size.left + - c->area.width / 2, - c->frame->area.y + c->frame->size.top + - c->area.height / 2); + if (config_resize_popup_pos == 1) /* == "Top" */ + popup_position(popup, SouthGravity, + c->frame->area.x + + c->frame->area.width/2, + c->frame->area.y); + else /* == "Center" */ + popup_position(popup, CenterGravity, + c->frame->area.x + c->frame->size.left + + c->area.width / 2, + c->frame->area.y + c->frame->size.top + + c->area.height / 2); popup_show(popup, text); g_free(text); } -- 2.45.2