if (!hide) {
if (dock->hidden && config_dock_hide) {
ob_main_loop_timeout_add(ob_main_loop, config_dock_show_delay,
- show_timeout, NULL, NULL);
+ show_timeout, NULL, g_direct_equal, NULL);
} else if (!dock->hidden && config_dock_hide) {
ob_main_loop_timeout_remove(ob_main_loop, hide_timeout);
}
} else {
if (!dock->hidden && config_dock_hide) {
ob_main_loop_timeout_add(ob_main_loop, config_dock_hide_delay,
- hide_timeout, NULL, NULL);
+ hide_timeout, NULL, g_direct_equal, NULL);
} else if (dock->hidden && config_dock_hide) {
ob_main_loop_timeout_remove(ob_main_loop, show_timeout);
}
gboolean ignored;
} ObEventData;
+typedef struct
+{
+ ObClient *client;
+ Time time;
+} ObFocusDelayData;
+
static void event_process(const XEvent *e, gpointer data);
static void event_client_dest(ObClient *client, gpointer data);
static void event_handle_root(XEvent *e);
static void event_handle_client(ObClient *c, XEvent *e);
static void event_handle_group(ObGroup *g, XEvent *e);
+static void focus_delay_dest(gpointer data);
+static gboolean focus_delay_cmp(gconstpointer d1, gconstpointer d2);
static gboolean focus_delay_func(gpointer data);
static void focus_delay_client_dest(ObClient *client, gpointer data);
ob_main_loop_timeout_add(ob_main_loop,
config_menu_hide_delay * 1000,
menu_hide_delay_func,
- NULL, NULL);
+ NULL, g_direct_equal, NULL);
if (e->type == ButtonPress || e->type == ButtonRelease ||
e->type == MotionNotify)
if (client_normal(client) && client_can_focus(client)) {
if (config_focus_delay) {
+ ObFocusDelayData *data;
+
ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
+
+ data = g_new(ObFocusDelayData, 1);
+ data->client = client;
+ data->time = event_curtime;
+
ob_main_loop_timeout_add(ob_main_loop,
config_focus_delay,
focus_delay_func,
- client, NULL);
- } else
- focus_delay_func(client);
+ data, focus_delay_cmp, focus_delay_dest);
+ } else {
+ ObFocusDelayData data;
+ data.client = client;
+ data.time = event_curtime;
+ focus_delay_func(&data);
+ }
}
}
if (config_focus_follow && config_focus_delay)
ob_main_loop_timeout_remove_data(ob_main_loop,
focus_delay_func,
- client, TRUE);
+ client, FALSE);
break;
default:
break;
{
menu_frame_select(e->frame, NULL);
}
+ case MotionNotify:
+ if ((e = menu_entry_frame_under(ev->xmotion.x_root,
+ ev->xmotion.y_root)))
+ menu_frame_select(e->frame, e);
+ break;
case KeyPress:
if (ev->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
menu_frame_hide_all();
return FALSE; /* no repeat */
}
+static void focus_delay_dest(gpointer data)
+{
+ g_free(data);
+}
+
+static gboolean focus_delay_cmp(gconstpointer d1, gconstpointer d2)
+{
+ const ObFocusDelayData *f1 = d1, *f2 = d2;
+ return f1->client == f2->client;
+}
+
static gboolean focus_delay_func(gpointer data)
{
- ObClient *c = data;
+ ObFocusDelayData *d = data;
+ Time old = event_curtime;
- if (focus_client != c) {
- if (client_focus(c) && config_focus_raise)
- client_raise(c);
+ event_curtime = d->time;
+ if (focus_client != d->client) {
+ if (client_focus(d->client) && config_focus_raise)
+ client_raise(d->client);
}
+ event_curtime = old;
return FALSE; /* no repeat */
}
static void focus_delay_client_dest(ObClient *client, gpointer data)
{
ob_main_loop_timeout_remove_data(ob_main_loop, focus_delay_func,
- client, TRUE);
+ client, FALSE);
}
static void event_client_dest(ObClient *client, gpointer data)
G_USEC_PER_SEC * 0.6,
flash_timeout,
self,
+ g_direct_equal,
flash_done);
g_get_current_time(&self->flash_end);
g_time_val_add(&self->flash_end, G_USEC_PER_SEC * 5);
ob_main_loop_timeout_remove(ob_main_loop, chain_timeout);
/* 5 second timeout for chains */
ob_main_loop_timeout_add(ob_main_loop, 5 * G_USEC_PER_SEC,
- chain_timeout, NULL, NULL);
+ chain_timeout, NULL,
+ g_direct_equal, NULL);
grab_keys(FALSE);
curpos = p;
grab_keys(TRUE);
gulong delay;
GSourceFunc func;
gpointer data;
+ GEqualFunc equal;
GDestroyNotify destroy;
/* The timer needs to be freed */
gulong microseconds,
GSourceFunc handler,
gpointer data,
+ GEqualFunc cmp,
GDestroyNotify notify)
{
ObMainLoopTimer *t = g_new(ObMainLoopTimer, 1);
t->delay = microseconds;
t->func = handler;
t->data = data;
+ t->equal = cmp;
t->destroy = notify;
t->del_me = FALSE;
g_get_current_time(&loop->now);
for (it = loop->timers; it; it = g_slist_next(it)) {
ObMainLoopTimer *t = it->data;
- if (t->func == handler && t->data == data) {
+ if (t->func == handler && t->equal(t->data, data)) {
t->del_me = TRUE;
if (cancel_dest)
t->destroy = NULL;
gulong microseconds,
GSourceFunc handler,
gpointer data,
+ GEqualFunc cmp,
GDestroyNotify notify);
void ob_main_loop_timeout_remove(ObMainLoop *loop,
GSourceFunc handler);
RrAppearanceCopy(ob_rr_theme->a_menu_text_disabled);
self->a_text_selected =
RrAppearanceCopy(ob_rr_theme->a_menu_text_selected);
+ self->a_text_title =
+ RrAppearanceCopy(ob_rr_theme->a_menu_text_title);
return self;
}
RrAppearanceFree(self->a_text_normal);
RrAppearanceFree(self->a_text_disabled);
RrAppearanceFree(self->a_text_selected);
+ RrAppearanceFree(self->a_text_title);
RrAppearanceFree(self->a_bullet_normal);
RrAppearanceFree(self->a_bullet_selected);
case OB_MENU_ENTRY_TYPE_SEPARATOR:
if (self->entry->data.separator.label) {
item_a = self->frame->a_title;
- item_a->texture[0].data.text.string =
- self->entry->data.separator.label;
- th = self->frame->title_h;
+ th = ob_rr_theme->menu_title_height;
} else {
item_a = self->a_normal;
th = SEPARATOR_HEIGHT + 2*PADDING;
text_a->texture[0].data.text.string = sub ? sub->title : "";
break;
case OB_MENU_ENTRY_TYPE_SEPARATOR:
- text_a = self->a_text_normal;
+ if (self->entry->data.separator.label != NULL)
+ text_a = self->a_text_title;
+ else
+ text_a = self->a_text_normal;
break;
}
self->frame->item_h - 2*PADDING);
break;
case OB_MENU_ENTRY_TYPE_SEPARATOR:
- if (self->entry->data.separator.label == NULL) {
+ if (self->entry->data.separator.label != NULL) {
+ /* labeled separator */
+ XMoveResizeWindow(ob_display, self->text,
+ ob_rr_theme->paddingx, ob_rr_theme->paddingy,
+ self->area.width - 2*ob_rr_theme->paddingx,
+ ob_rr_theme->menu_title_height -
+ 2*ob_rr_theme->paddingy);
+ text_a->surface.parent = item_a;
+ text_a->surface.parentx = ob_rr_theme->paddingx;
+ text_a->surface.parenty = ob_rr_theme->paddingy;
+ RrPaint(text_a, self->text,
+ self->area.width - 2*ob_rr_theme->paddingx,
+ ob_rr_theme->menu_title_height -
+ 2*ob_rr_theme->paddingy);
+ } else {
+ /* unlabeled separaator */
XMoveResizeWindow(ob_display, self->text, PADDING, PADDING,
self->area.width - 2*PADDING, SEPARATOR_HEIGHT);
self->a_separator->surface.parent = item_a;
GList *it;
gboolean has_icon = FALSE;
ObMenu *sub;
+ ObMenuEntryFrame *e;
XSetWindowBorderWidth(ob_display, self->window, ob_rr_theme->mbwidth);
XSetWindowBorder(ob_display, self->window,
th += 2*PADDING;
self->item_h = th;
- self->a_title->texture[0].data.text.string = "";
- RrMinsize(self->a_title, &tw, &th);
- tw += 2*PADDING;
- th += 2*PADDING;
- self->title_h = th;
-
RrMargins(e->a_normal, &l, &t, &r, &b);
STRUT_SET(self->item_margin,
MAX(self->item_margin.left, l),
for (it = self->entries; it; it = g_list_next(it)) {
RrAppearance *text_a;
- ObMenuEntryFrame *e = it->data;
+ e = it->data;
+
+ /* if the first entry is a labeled separator, then make its border
+ overlap with the menu's outside border */
+ if (it == self->entries &&
+ e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR &&
+ e->entry->data.separator.label)
+ {
+ h -= ob_rr_theme->mbwidth;
+ }
+
+ if (e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR &&
+ e->entry->data.separator.label)
+ {
+ e->border = ob_rr_theme->mbwidth;
+ }
- RECT_SET_POINT(e->area, 0, h);
- XMoveWindow(ob_display, e->window, 0, e->area.y);
+ RECT_SET_POINT(e->area, 0, h+e->border);
+ XMoveWindow(ob_display, e->window, e->area.x-e->border, e->area.y-e->border);
+ XSetWindowBorderWidth(ob_display, e->window, e->border);
+ XSetWindowBorder(ob_display, e->window,
+ RrColorPixel(ob_rr_theme->menu_b_color));
text_a = ((e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
!e->entry->data.normal.enabled) ?
break;
case OB_MENU_ENTRY_TYPE_SEPARATOR:
if (e->entry->data.separator.label != NULL) {
- self->a_title->texture[0].data.text.string =
+ e->a_text_title->texture[0].data.text.string =
e->entry->data.separator.label;
- RrMinsize(self->a_title, &tw, &th);
+ RrMinsize(e->a_text_title, &tw, &th);
tw = MIN(tw, MAX_MENU_WIDTH);
+ th = ob_rr_theme->menu_title_height +
+ (ob_rr_theme->mbwidth - PADDING) *2;
} else {
tw = 0;
th = SEPARATOR_HEIGHT;
h += th;
}
+ /* if the last entry is a labeled separator, then make its border
+ overlap with the menu's outside border */
+ it = g_list_last(self->entries);
+ e = it ? it->data : NULL;
+ if (e && e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR &&
+ e->entry->data.separator.label)
+ {
+ h -= ob_rr_theme->mbwidth;
+ }
+
self->text_x = PADDING;
self->text_w = w;
ob_main_loop_timeout_add(ob_main_loop,
config_submenu_show_delay * 1000,
menu_entry_frame_submenu_timeout,
- self->selected,
+ self->selected, g_direct_equal,
NULL);
} else {
menu_entry_frame_show_submenu(self->selected);
guint ignore_enters;
Rect area;
+ gint border;
Window window;
Window icon;
RrAppearance *a_text_normal;
RrAppearance *a_text_disabled;
RrAppearance *a_text_selected;
+ RrAppearance *a_text_title;
};
extern GHashTable *menu_frame_map;
have a timeout */
ob_main_loop_timeout_add(ob_main_loop, 30 * G_USEC_PER_SEC,
sn_wait_timeout, seq,
+ g_direct_equal,
(GDestroyNotify)sn_startup_sequence_unref);
change = TRUE;
break;
sn_launcher_context_ref(sn_launcher);
ob_main_loop_timeout_add(ob_main_loop, 30 * G_USEC_PER_SEC,
sn_launch_wait_timeout, sn_launcher,
+ g_direct_equal,
(GDestroyNotify)sn_launcher_context_unref);
setenv("DESKTOP_STARTUP_ID", id, TRUE);
theme->a_focused_handle = RrAppearanceNew(inst, 0);
theme->a_unfocused_handle = RrAppearanceNew(inst, 0);
theme->a_menu = RrAppearanceNew(inst, 0);
- theme->a_menu_title = RrAppearanceNew(inst, 1);
+ theme->a_menu_title = RrAppearanceNew(inst, 0);
+ theme->a_menu_text_title = RrAppearanceNew(inst, 1);
theme->a_menu_normal = RrAppearanceNew(inst, 0);
theme->a_menu_disabled = RrAppearanceNew(inst, 0);
theme->a_menu_selected = RrAppearanceNew(inst, 0);
set_default_appearance(theme->a_menu);
if (!read_appearance(db, inst,
"menu.title.bg", theme->a_menu_title,
- FALSE))
+ TRUE))
set_default_appearance(theme->a_menu_title);
if (!read_appearance(db, inst,
"menu.items.active.bg", theme->a_menu_selected,
theme->a_icon->surface.grad =
theme->a_clear->surface.grad =
theme->a_clear_tex->surface.grad =
+ theme->a_menu_text_title->surface.grad =
theme->a_menu_normal->surface.grad =
theme->a_menu_disabled->surface.grad =
theme->a_menu_text_normal->surface.grad =
theme->a_unfocused_label->texture[0].data.text.shadow_alpha =
theme->title_unfocused_shadow_alpha;
- theme->a_menu_title->texture[0].type = RR_TEXTURE_TEXT;
- theme->a_menu_title->texture[0].data.text.justify = mtitlejust;
- theme->a_menu_title->texture[0].data.text.font = theme->menu_title_font;
- theme->a_menu_title->texture[0].data.text.color = theme->menu_title_color;
+ theme->a_menu_text_title->texture[0].type = RR_TEXTURE_TEXT;
+ theme->a_menu_text_title->texture[0].data.text.justify = mtitlejust;
+ theme->a_menu_text_title->texture[0].data.text.font =
+ theme->menu_title_font;
+ theme->a_menu_text_title->texture[0].data.text.color =
+ theme->menu_title_color;
if (read_string(db, "menu.title.text.font", &str)) {
char *p;
i = parse_inline_number(p + strlen("shadowoffset="));
else
i = 1;
- theme->a_menu_title->texture[0].data.text.shadow_offset_x = i;
- theme->a_menu_title->texture[0].data.text.shadow_offset_y = i;
+ theme->a_menu_text_title->texture[0].data.text.shadow_offset_x = i;
+ theme->a_menu_text_title->texture[0].data.text.shadow_offset_y = i;
}
if ((p = strstr(str, "shadowtint=")))
{
}
}
- theme->a_menu_title->texture[0].data.text.shadow_color =
+ theme->a_menu_text_title->texture[0].data.text.shadow_color =
theme->menu_title_shadow_color;
- theme->a_menu_title->texture[0].data.text.shadow_alpha =
+ theme->a_menu_text_title->texture[0].data.text.shadow_alpha =
theme->menu_title_shadow_alpha;
theme->a_menu_text_normal->texture[0].type =
theme->a_unfocused_label->texture[0].data.text.shadow_offset_y));
theme->menu_title_font_height = RrFontHeight
(theme->menu_title_font,
- theme->a_menu_title->texture[0].data.text.shadow_offset_y);
+ theme->a_menu_text_title->texture[0].data.text.shadow_offset_y);
theme->menu_font_height = RrFontHeight
(theme->menu_font,
theme->a_menu_text_normal->texture[0].data.text.shadow_offset_y);
RrAppearanceFree(theme->a_unfocused_handle);
RrAppearanceFree(theme->a_menu);
RrAppearanceFree(theme->a_menu_title);
+ RrAppearanceFree(theme->a_menu_text_title);
RrAppearanceFree(theme->a_menu_normal);
RrAppearanceFree(theme->a_menu_disabled);
RrAppearanceFree(theme->a_menu_selected);
RrAppearance *a_icon;
RrAppearance *a_focused_handle;
RrAppearance *a_unfocused_handle;
+ RrAppearance *a_menu_text_title;
RrAppearance *a_menu_title;
RrAppearance *a_menu;
RrAppearance *a_menu_normal;