void action_resize_relative(union ActionData *data)
{
ObClient *c = data->relative.any.c;
- gint x, y, w1, w2, h1, h2, lw, lh;
+ gint x, y, ow, xoff, nw, oh, yoff, nh, lw, lh;
client_action_start(data);
x = c->area.x;
y = c->area.y;
- w1 = c->area.width + data->relative.deltax * c->size_inc.width;
- w2 = c->area.width + data->relative.deltax * c->size_inc.width
+ ow = c->area.width;
+ xoff = -data->relative.deltaxl * c->size_inc.width;
+ nw = ow + data->relative.deltax * c->size_inc.width
+ data->relative.deltaxl * c->size_inc.width;
- h1 = c->area.height + data->relative.deltay * c->size_inc.height;
- h2 = c->area.height + data->relative.deltay * c->size_inc.height
+ oh = c->area.height;
+ yoff = -data->relative.deltayu * c->size_inc.height;
+ nh = oh + data->relative.deltay * c->size_inc.height
+ data->relative.deltayu * c->size_inc.height;
+
+ g_print("deltax %d %d x %d ow %d xoff %d nw %d\n",
+ data->relative.deltax,
+ data->relative.deltaxl,
+ x, ow, xoff, nw);
- client_try_configure(c, &x, &y, &w2, &h2, &lw, &lh, TRUE);
- client_move_resize(c, x + (w1 - w2), y + (h1 - h2), w2, h2);
+ client_try_configure(c, &x, &y, &nw, &nh, &lw, &lh, TRUE);
+ xoff = xoff == 0 ? 0 : (xoff < 0 ? MAX(xoff, ow-nw) : MIN(xoff, ow-nw));
+ yoff = yoff == 0 ? 0 : (yoff < 0 ? MAX(yoff, oh-nh) : MIN(yoff, oh-nh));
+ client_move_resize(c, x + xoff, y + yoff, nw, nh);
client_action_end(data, FALSE);
}
*/
client_try_configure(self, &x, &y, &w, &h, &l, &l, FALSE);
ob_debug("placed window 0x%x at %d, %d with size %d x %d\n",
- self->window, self->area.x, self->area.y,
- self->area.width, self->area.height);
- oldarea = self->area; /* save the area */
- RECT_SET(self->area, x, y, w, h); /* put where it should be for the premax stuff */
+ self->window, x, y, w, h);
+ /* save the area, and make it where it should be for the premax stuff */
+ oldarea = self->area;
+ RECT_SET(self->area, x, y, w, h);
/* apply the states. these are in a carefully crafted order.. */
static gboolean menu_pipe_submenu(gpointer key, gpointer val, gpointer data)
{
ObMenu *menu = val;
- return menu->pipe_creator == data;
+ return menu->pipe_creator != NULL;
+}
+
+static void clear_cache(gpointer key, gpointer val, gpointer data)
+{
+ ObMenu *menu = val;
+ if (menu->execute)
+ menu_clear_entries(menu);
+}
+
+void menu_clear_pipe_caches()
+{
+ /* delete any pipe menus' submenus */
+ g_hash_table_foreach_remove(menu_hash, menu_pipe_submenu, NULL);
+ /* empty the top level pipe menus */
+ g_hash_table_foreach(menu_hash, clear_cache, NULL);
}
void menu_pipe_execute(ObMenu *self)
if (!self->execute)
return;
+ if (self->entries) /* the entries are already created and cached */
+ return;
if (!g_spawn_command_line_sync(self->execute, &output, NULL, NULL, &err)) {
g_message(_("Failed to execute command for pipe-menu '%s': %s"),
if (parse_load_mem(output, strlen(output),
"openbox_pipe_menu", &doc, &node))
{
- g_hash_table_foreach_remove(menu_hash, menu_pipe_submenu, self);
- menu_clear_entries(self);
-
menu_parse_state.pipe_creator = self;
menu_parse_state.parent = self;
parse_tree(menu_parse_inst, doc, node->children);
menu_frame_hide_all();
+ /* clear the pipe menus when showing a new menu */
+ menu_clear_pipe_caches();
+
frame = menu_frame_new(self, 0, client);
if (!menu_frame_show_topmenu(frame, x, y, button))
menu_frame_free(frame);
gboolean allow_shortcut_selection, gpointer data);
void menu_free(ObMenu *menu);
-/* Repopulate a pipe-menu by running its command */
+/*! Repopulate a pipe-menu by running its command */
void menu_pipe_execute(ObMenu *self);
+/*! Clear a pipe-menu's entries */
+void menu_clear_pipe_caches();
void menu_show_all_shortcuts(ObMenu *self, gboolean show);
GList *it;
guint old;
gulong ignore_start;
+ gboolean allow_omni;
g_assert(num < screen_num_desktops);
}
}
- if (focus_client && ((client_normal(focus_client) &&
- focus_client->desktop == DESKTOP_ALL) ||
- focus_client->desktop == screen_desktop))
- dofocus = FALSE;
+ /* only allow omnipresent windows to get focus on desktop change if
+ an omnipresent window is already focused (it'll keep focus probably, but
+ maybe not depending on mouse-focus options) */
+ allow_omni = focus_client && (client_normal(focus_client) &&
+ focus_client->desktop == DESKTOP_ALL);
/* have to try focus here because when you leave an empty desktop
there is no focus out to watch for. also, we have different rules
do this before hiding the windows so if helper windows are coming
with us, they don't get hidden
*/
- if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, FALSE)))
+ if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, allow_omni)))
{
/* only do the flicker reducing stuff ahead of time if we are going
to call xsetinputfocus on the window ourselves. otherwise there is
#include "color.h"
#include <glib.h>
-static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
+static void highlight(RrSurface *s, RrPixel32 *x, RrPixel32 *y, gboolean raised);
static void gradient_parentrelative(RrAppearance *a, gint w, gint h);
static void gradient_solid(RrAppearance *l, gint w, gint h);
static void gradient_splitvertical(RrAppearance *a, gint w, gint h);
if (a->surface.relief != RR_RELIEF_FLAT) {
if (a->surface.bevel == RR_BEVEL_1) {
for (off = 1, x = 1; x < w - 1; ++x, off++)
- highlight(data + off,
+ highlight(&a->surface, data + off,
data + off + (h-1) * w,
a->surface.relief==RR_RELIEF_RAISED);
for (off = 0, x = 0; x < h; ++x, off++)
- highlight(data + off * w,
+ highlight(&a->surface, data + off * w,
data + off * w + w - 1,
a->surface.relief==RR_RELIEF_RAISED);
}
if (a->surface.bevel == RR_BEVEL_2) {
for (off = 2, x = 2; x < w - 2; ++x, off++)
- highlight(data + off + w,
+ highlight(&a->surface, data + off + w,
data + off + (h-2) * w,
a->surface.relief==RR_RELIEF_RAISED);
for (off = 1, x = 1; x < h-1; ++x, off++)
- highlight(data + off * w + 1,
+ highlight(&a->surface, data + off * w + 1,
data + off * w + w - 2,
a->surface.relief==RR_RELIEF_RAISED);
}
}
}
-static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
+static void highlight(RrSurface *s, RrPixel32 *x, RrPixel32 *y, gboolean raised)
{
gint r, g, b;
up = y;
down = x;
}
+
r = (*up >> RrDefaultRedOffset) & 0xFF;
- r += r >> 1;
+ r += (r * s->bevel_light_adjust) >> 8;
g = (*up >> RrDefaultGreenOffset) & 0xFF;
- g += g >> 1;
+ g += (g * s->bevel_light_adjust) >> 8;
b = (*up >> RrDefaultBlueOffset) & 0xFF;
- b += b >> 1;
+ b += (b * s->bevel_light_adjust) >> 8;
if (r > 0xFF) r = 0xFF;
if (g > 0xFF) g = 0xFF;
if (b > 0xFF) b = 0xFF;
+ (b << RrDefaultBlueOffset);
r = (*down >> RrDefaultRedOffset) & 0xFF;
- r = (r >> 1) + (r >> 2);
+ r -= (r * s->bevel_dark_adjust) >> 8;
g = (*down >> RrDefaultGreenOffset) & 0xFF;
- g = (g >> 1) + (g >> 2);
+ g -= (g * s->bevel_dark_adjust) >> 8;
b = (*down >> RrDefaultBlueOffset) & 0xFF;
- b = (b >> 1) + (b >> 2);
+ b -= (b * s->bevel_dark_adjust) >> 8;
*down = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
+ (b << RrDefaultBlueOffset);
}
/* light color */
r = l->surface.primary->r;
- r += r >> 1;
+ r += (r * l->surface.bevel_light_adjust) >> 8;
g = l->surface.primary->g;
- g += g >> 1;
+ g += (g * l->surface.bevel_light_adjust) >> 8;
b = l->surface.primary->b;
- b += b >> 1;
+ b += (b * l->surface.bevel_light_adjust) >> 8;
if (r > 0xFF) r = 0xFF;
if (g > 0xFF) g = 0xFF;
if (b > 0xFF) b = 0xFF;
/* dark color */
r = l->surface.primary->r;
- r = (r >> 1) + (r >> 2);
+ r -= (r * l->surface.bevel_dark_adjust) >> 8;
g = l->surface.primary->g;
- g = (g >> 1) + (g >> 2);
+ g -= (g * l->surface.bevel_dark_adjust) >> 8;
b = l->surface.primary->b;
- b = (b >> 1) + (b >> 2);
+ b -= (b * l->surface.bevel_dark_adjust) >> 8;
g_assert(!l->surface.bevel_dark);
l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
}
out = g_new0(RrAppearance, 1);
out->inst = inst;
out->textures = numtex;
+ out->surface.bevel_light_adjust = 128;
+ out->surface.bevel_dark_adjust = 64;
if (numtex) out->texture = g_new0(RrTexture, numtex);
return out;
else spc->bevel_light = NULL;
spc->interlaced = spo->interlaced;
+ spc->bevel_light_adjust = spo->bevel_light_adjust;
+ spc->bevel_dark_adjust = spo->bevel_dark_adjust;
spc->border = spo->border;
spc->parent = NULL;
spc->parentx = spc->parenty = 0;
RrColor *bevel_dark;
RrColor *bevel_light;
RrColor *interlace_color;
+ gint bevel_dark_adjust; /* 0-255, default is 64 */
+ gint bevel_light_adjust; /* 0-255, default is 128 */
gboolean interlaced;
gboolean border;
RrAppearance *parent;
{
gboolean ret = FALSE;
gchar *rclass = create_class_name(rname);
- gchar *cname, *ctoname, *bcname, *icname;
+ gchar *cname, *ctoname, *bcname, *icname, *hname, *sname;
gchar *rettype;
XrmValue retvalue;
+ gint i;
cname = g_strconcat(rname, ".color", NULL);
ctoname = g_strconcat(rname, ".colorTo", NULL);
bcname = g_strconcat(rname, ".border.color", NULL);
icname = g_strconcat(rname, ".interlace.color", NULL);
+ hname = g_strconcat(rname, ".highlight", NULL);
+ sname = g_strconcat(rname, ".shadow", NULL);
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
retvalue.addr != NULL) {
if (!read_color(db, inst, icname,
&value->surface.interlace_color))
value->surface.interlace_color = RrColorNew(inst, 0, 0, 0);
+ if (read_int(db, hname, &i) && i >= 0)
+ value->surface.bevel_light_adjust = i;
+ if (read_int(db, sname, &i) && i >= 0 && i <= 256)
+ value->surface.bevel_dark_adjust = i;
ret = TRUE;
}
+ g_free(sname);
+ g_free(hname);
g_free(icname);
g_free(bcname);
g_free(ctoname);