let you specify the resize popup to be in a fixed place
This commit is contained in:
parent
b7e23f286a
commit
17bc51aab8
6 changed files with 141 additions and 13 deletions
12
data/rc.xml
12
data/rc.xml
|
@ -129,7 +129,17 @@
|
|||
<popupShow>Nonpixel</popupShow>
|
||||
<!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -->
|
||||
<popupPosition>Center</popupPosition>
|
||||
<!-- 'Center' or 'Top' -->
|
||||
<!-- 'Center', 'Top', or 'Fixed' -->
|
||||
<popupFixedPosition>
|
||||
<!-- these are used if popupPosition is set to 'Fixed' -->
|
||||
|
||||
<x>10</x>
|
||||
<!-- positive number for distance from left edge, negative number for
|
||||
distance from right edge, or 'Center' -->
|
||||
<y>10</y>
|
||||
<!-- positive number for distance from top edge, negative number for
|
||||
distance from bottom edge, or 'Center' -->
|
||||
</popupFixedPosition>
|
||||
</resize>
|
||||
|
||||
<!-- You can reserve a portion of your screen where windows will not cover when
|
||||
|
|
|
@ -96,6 +96,11 @@
|
|||
<xsd:element minOccurs="0" name="drawContents" type="ob:bool"/>
|
||||
<xsd:element minOccurs="0" name="popupShow" type="ob:popupshow"/>
|
||||
<xsd:element minOccurs="0" name="popupPosition" type="ob:popupposition"/>
|
||||
<xsd:element minOccurs="0" name="popupPosition" type="ob:popupfixedposition"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="popupfixedposition">
|
||||
<xsd:element minOccurs="0" name="x" type="ob:center_or_int"/>
|
||||
<xsd:element minOccurs="0" name="y" type="ob:center_or_int"/>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="dock">
|
||||
<xsd:element minOccurs="0" name="position" type="ob:dock_position"/>
|
||||
|
|
|
@ -60,10 +60,16 @@ GSList *config_desktops_names;
|
|||
guint config_screen_firstdesk;
|
||||
guint config_desktop_popup_time;
|
||||
|
||||
gboolean config_resize_redraw;
|
||||
gboolean config_resize_four_corners;
|
||||
gint config_resize_popup_show;
|
||||
gint config_resize_popup_pos;
|
||||
gboolean config_resize_redraw;
|
||||
gboolean config_resize_four_corners;
|
||||
gint config_resize_popup_show;
|
||||
ObResizePopupPos config_resize_popup_pos;
|
||||
gboolean config_resize_popup_x_center;
|
||||
gboolean config_resize_popup_y_center;
|
||||
gboolean config_resize_popup_x_opposite;
|
||||
gboolean config_resize_popup_y_opposite;
|
||||
gint config_resize_popup_x;
|
||||
gint config_resize_popup_y;
|
||||
|
||||
ObStackingLayer config_dock_layer;
|
||||
gboolean config_dock_floating;
|
||||
|
@ -661,11 +667,46 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
|
|||
config_resize_popup_show = 1;
|
||||
}
|
||||
if ((n = parse_find_node("popupPosition", node))) {
|
||||
config_resize_popup_pos = parse_int(doc, n);
|
||||
if (parse_contains("Top", doc, n))
|
||||
config_resize_popup_pos = 1;
|
||||
config_resize_popup_pos = OB_RESIZE_POS_TOP;
|
||||
else if (parse_contains("Center", doc, n))
|
||||
config_resize_popup_pos = 0;
|
||||
config_resize_popup_pos = OB_RESIZE_POS_CENTER;
|
||||
else if (parse_contains("Fixed", doc, n)) {
|
||||
config_resize_popup_pos = OB_RESIZE_POS_FIXED;
|
||||
|
||||
if ((n = parse_find_node("popupFixedPosition", node))) {
|
||||
xmlNodePtr n2;
|
||||
|
||||
if ((n2 = parse_find_node("x", n->children))) {
|
||||
gchar *s = parse_string(doc, n2);
|
||||
if (!g_ascii_strcasecmp(s, "center"))
|
||||
config_resize_popup_x_center = TRUE;
|
||||
else {
|
||||
if (s[0] == '-')
|
||||
config_resize_popup_x_opposite = TRUE;
|
||||
if (s[0] == '-' || s[0] == '+')
|
||||
config_resize_popup_x = atoi(s+1);
|
||||
else
|
||||
config_resize_popup_x = atoi(s);
|
||||
}
|
||||
}
|
||||
if ((n2 = parse_find_node("y", n->children))) {
|
||||
gchar *s = parse_string(doc, n2);
|
||||
if (!g_ascii_strcasecmp(s, "center"))
|
||||
config_resize_popup_y_center = TRUE;
|
||||
else {
|
||||
if (s[0] == '-')
|
||||
config_resize_popup_y_opposite = TRUE;
|
||||
if (s[0] == '-' || s[0] == '+')
|
||||
config_resize_popup_y = atoi(s+1);
|
||||
else
|
||||
config_resize_popup_y = atoi(s);
|
||||
}
|
||||
}
|
||||
g_print("X %d %d %d\n", config_resize_popup_x_center, config_resize_popup_x_opposite, config_resize_popup_x);
|
||||
g_print("Y %d %d %d\n", config_resize_popup_y_center, config_resize_popup_y_opposite, config_resize_popup_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -914,7 +955,13 @@ void config_startup(ObParseInst *i)
|
|||
config_resize_redraw = TRUE;
|
||||
config_resize_four_corners = FALSE;
|
||||
config_resize_popup_show = 1; /* nonpixel increments */
|
||||
config_resize_popup_pos = 0; /* center of client */
|
||||
config_resize_popup_pos = OB_RESIZE_POS_CENTER;
|
||||
config_resize_popup_x_center = FALSE;
|
||||
config_resize_popup_x_opposite = FALSE;
|
||||
config_resize_popup_x = 0;
|
||||
config_resize_popup_y_center = FALSE;
|
||||
config_resize_popup_y_opposite = FALSE;
|
||||
config_resize_popup_y = 0;
|
||||
|
||||
parse_register(i, "resize", parse_resize, NULL);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "stacking.h"
|
||||
#include "place.h"
|
||||
#include "geom.h"
|
||||
#include "moveresize.h"
|
||||
#include "render/render.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
@ -92,8 +93,24 @@ 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;
|
||||
/*! where to show the resize popup */
|
||||
extern ObResizePopupPos config_resize_popup_pos;
|
||||
/*! if the resize popup should be centered horizontally if it is being
|
||||
placed in a fixed position */
|
||||
extern gboolean config_resize_popup_x_center;
|
||||
/*! if the resize popup should be centered vertically if it is being
|
||||
placed in a fixed position */
|
||||
extern gboolean config_resize_popup_y_center;
|
||||
/*! if the resize popup should be placed from the right side of the screen when
|
||||
placed in a fixed position */
|
||||
extern gboolean config_resize_popup_x_opposite;
|
||||
/*! if the resize popup should be placed from the bottom side of the screen
|
||||
when placed in a fixed position */
|
||||
extern gboolean config_resize_popup_y_opposite;
|
||||
/*! where the resize popup should be if it is placed in a fixed position */
|
||||
extern gint config_resize_popup_x;
|
||||
/*! where the resize popup should be if it is placed in a fixed position */
|
||||
extern gint config_resize_popup_y;
|
||||
|
||||
/*! The stacking layer the dock will reside in */
|
||||
extern ObStackingLayer config_dock_layer;
|
||||
|
|
|
@ -101,17 +101,60 @@ static void popup_coords(ObClient *c, const gchar *format, gint a, gint b)
|
|||
gchar *text;
|
||||
|
||||
text = g_strdup_printf(format, a, b);
|
||||
if (config_resize_popup_pos == 1) /* == "Top" */
|
||||
if (config_resize_popup_pos == OB_RESIZE_POS_TOP)
|
||||
popup_position(popup, SouthGravity,
|
||||
c->frame->area.x
|
||||
+ c->frame->area.width/2,
|
||||
c->frame->area.y - ob_rr_theme->fbwidth);
|
||||
else /* == "Center" */
|
||||
else if (config_resize_popup_pos == OB_RESIZE_POS_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);
|
||||
else /* Fixed */ {
|
||||
Rect *area = screen_physical_area_active();
|
||||
gint gravity, x, y;
|
||||
|
||||
x = config_resize_popup_x;
|
||||
if (config_resize_popup_x_center) x = area->x + area->width/2;
|
||||
else if (config_resize_popup_x_opposite) x = RECT_RIGHT(*area) - x;
|
||||
else x = area->x + x;
|
||||
|
||||
y = config_resize_popup_y;
|
||||
if (config_resize_popup_y_center) y = area->y + area->height/2;
|
||||
else if (config_resize_popup_y_opposite) y = RECT_BOTTOM(*area) - y;
|
||||
else y = area->y + y;
|
||||
|
||||
if (config_resize_popup_x_center) {
|
||||
if (config_resize_popup_y_center)
|
||||
gravity = CenterGravity;
|
||||
else if (config_resize_popup_y_opposite)
|
||||
gravity = SouthGravity;
|
||||
else
|
||||
gravity = NorthGravity;
|
||||
}
|
||||
else if (config_resize_popup_x_opposite) {
|
||||
if (config_resize_popup_y_center)
|
||||
gravity = EastGravity;
|
||||
else if (config_resize_popup_y_opposite)
|
||||
gravity = SouthEastGravity;
|
||||
else
|
||||
gravity = NorthEastGravity;
|
||||
}
|
||||
else {
|
||||
if (config_resize_popup_y_center)
|
||||
gravity = WestGravity;
|
||||
else if (config_resize_popup_y_opposite)
|
||||
gravity = SouthWestGravity;
|
||||
else
|
||||
gravity = NorthWestGravity;
|
||||
}
|
||||
|
||||
popup_position(popup, gravity, x, y);
|
||||
|
||||
g_free(area);
|
||||
}
|
||||
popup_show(popup, text);
|
||||
g_free(text);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
|
||||
struct _ObClient;
|
||||
|
||||
typedef enum {
|
||||
OB_RESIZE_POS_CENTER,
|
||||
OB_RESIZE_POS_TOP,
|
||||
OB_RESIZE_POS_FIXED
|
||||
} ObResizePopupPos;
|
||||
|
||||
extern gboolean moveresize_in_progress;
|
||||
extern struct _ObClient *moveresize_client;
|
||||
#ifdef SYNC
|
||||
|
|
Loading…
Reference in a new issue