let you raise the focus target temporarily during focus cycling, with the <raise> option. also a new <bar> option lets you turn off the indicator bar
This commit is contained in:
parent
746015e88c
commit
ea371936ce
5 changed files with 70 additions and 25 deletions
|
@ -1,4 +1,6 @@
|
||||||
#include "openbox/actions.h"
|
#include "openbox/actions.h"
|
||||||
|
#include "openbox/stacking.h"
|
||||||
|
#include "openbox/window.h"
|
||||||
#include "openbox/event.h"
|
#include "openbox/event.h"
|
||||||
#include "openbox/focus_cycle.h"
|
#include "openbox/focus_cycle.h"
|
||||||
#include "openbox/openbox.h"
|
#include "openbox/openbox.h"
|
||||||
|
@ -11,6 +13,8 @@ typedef struct {
|
||||||
gboolean desktop_windows;
|
gboolean desktop_windows;
|
||||||
gboolean all_desktops;
|
gboolean all_desktops;
|
||||||
gboolean forward;
|
gboolean forward;
|
||||||
|
gboolean bar;
|
||||||
|
gboolean raise;
|
||||||
GSList *actions;
|
GSList *actions;
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
|
@ -46,11 +50,16 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
o->dialog = TRUE;
|
o->dialog = TRUE;
|
||||||
|
o->bar = TRUE;
|
||||||
|
|
||||||
if ((n = parse_find_node("linear", node)))
|
if ((n = parse_find_node("linear", node)))
|
||||||
o->linear = parse_bool(doc, n);
|
o->linear = parse_bool(doc, n);
|
||||||
if ((n = parse_find_node("dialog", node)))
|
if ((n = parse_find_node("dialog", node)))
|
||||||
o->dialog = parse_bool(doc, n);
|
o->dialog = parse_bool(doc, n);
|
||||||
|
if ((n = parse_find_node("bar", node)))
|
||||||
|
o->bar = parse_bool(doc, n);
|
||||||
|
if ((n = parse_find_node("raise", node)))
|
||||||
|
o->raise = parse_bool(doc, n);
|
||||||
if ((n = parse_find_node("panels", node)))
|
if ((n = parse_find_node("panels", node)))
|
||||||
o->dock_windows = parse_bool(doc, n);
|
o->dock_windows = parse_bool(doc, n);
|
||||||
if ((n = parse_find_node("desktop", node)))
|
if ((n = parse_find_node("desktop", node)))
|
||||||
|
@ -111,17 +120,22 @@ static void free_func(gpointer options)
|
||||||
static gboolean run_func(ObActionsData *data, gpointer options)
|
static gboolean run_func(ObActionsData *data, gpointer options)
|
||||||
{
|
{
|
||||||
Options *o = options;
|
Options *o = options;
|
||||||
|
struct _ObClient *ft;
|
||||||
|
|
||||||
focus_cycle(o->forward,
|
ft = focus_cycle(o->forward,
|
||||||
o->all_desktops,
|
o->all_desktops,
|
||||||
o->dock_windows,
|
o->dock_windows,
|
||||||
o->desktop_windows,
|
o->desktop_windows,
|
||||||
o->linear,
|
o->linear,
|
||||||
TRUE,
|
TRUE,
|
||||||
o->dialog,
|
o->bar,
|
||||||
FALSE, FALSE);
|
o->dialog,
|
||||||
|
FALSE, FALSE);
|
||||||
cycling = TRUE;
|
cycling = TRUE;
|
||||||
|
|
||||||
|
stacking_restore();
|
||||||
|
if (o->raise) stacking_temp_raise(CLIENT_AS_WINDOW(ft));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +188,7 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
|
||||||
o->desktop_windows,
|
o->desktop_windows,
|
||||||
o->linear,
|
o->linear,
|
||||||
TRUE,
|
TRUE,
|
||||||
|
o->bar,
|
||||||
o->dialog,
|
o->dialog,
|
||||||
TRUE, cancel);
|
TRUE, cancel);
|
||||||
cycling = FALSE;
|
cycling = FALSE;
|
||||||
|
@ -181,4 +196,6 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
|
||||||
if (ft)
|
if (ft)
|
||||||
actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
||||||
state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
|
state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
|
||||||
|
|
||||||
|
stacking_restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "openbox/actions.h"
|
#include "openbox/actions.h"
|
||||||
#include "openbox/event.h"
|
#include "openbox/event.h"
|
||||||
|
#include "openbox/stacking.h"
|
||||||
|
#include "openbox/window.h"
|
||||||
#include "openbox/focus_cycle.h"
|
#include "openbox/focus_cycle.h"
|
||||||
#include "openbox/openbox.h"
|
#include "openbox/openbox.h"
|
||||||
#include "openbox/misc.h"
|
#include "openbox/misc.h"
|
||||||
|
@ -11,6 +13,8 @@ typedef struct {
|
||||||
gboolean dock_windows;
|
gboolean dock_windows;
|
||||||
gboolean desktop_windows;
|
gboolean desktop_windows;
|
||||||
ObDirection direction;
|
ObDirection direction;
|
||||||
|
gboolean bar;
|
||||||
|
gboolean raise;
|
||||||
GSList *actions;
|
GSList *actions;
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
|
@ -46,9 +50,14 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||||
|
|
||||||
o = g_new0(Options, 1);
|
o = g_new0(Options, 1);
|
||||||
o->dialog = TRUE;
|
o->dialog = TRUE;
|
||||||
|
o->bar = TRUE;
|
||||||
|
|
||||||
if ((n = parse_find_node("dialog", node)))
|
if ((n = parse_find_node("dialog", node)))
|
||||||
o->dialog = parse_bool(doc, n);
|
o->dialog = parse_bool(doc, n);
|
||||||
|
if ((n = parse_find_node("bar", node)))
|
||||||
|
o->bar = parse_bool(doc, n);
|
||||||
|
if ((n = parse_find_node("raise", node)))
|
||||||
|
o->raise = parse_bool(doc, n);
|
||||||
if ((n = parse_find_node("panels", node)))
|
if ((n = parse_find_node("panels", node)))
|
||||||
o->dock_windows = parse_bool(doc, n);
|
o->dock_windows = parse_bool(doc, n);
|
||||||
if ((n = parse_find_node("desktop", node)))
|
if ((n = parse_find_node("desktop", node)))
|
||||||
|
@ -135,13 +144,19 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
||||||
if (!o->interactive)
|
if (!o->interactive)
|
||||||
end_cycle(FALSE, data->state, o);
|
end_cycle(FALSE, data->state, o);
|
||||||
else {
|
else {
|
||||||
focus_directional_cycle(o->direction,
|
struct _ObClient *ft;
|
||||||
o->dock_windows,
|
|
||||||
o->desktop_windows,
|
ft = focus_directional_cycle(o->direction,
|
||||||
TRUE,
|
o->dock_windows,
|
||||||
o->dialog,
|
o->desktop_windows,
|
||||||
FALSE, FALSE);
|
TRUE,
|
||||||
|
o->bar,
|
||||||
|
o->dialog,
|
||||||
|
FALSE, FALSE);
|
||||||
cycling = TRUE;
|
cycling = TRUE;
|
||||||
|
|
||||||
|
stacking_restore();
|
||||||
|
if (o->raise) stacking_temp_raise(CLIENT_AS_WINDOW(ft));
|
||||||
}
|
}
|
||||||
|
|
||||||
return o->interactive;
|
return o->interactive;
|
||||||
|
@ -194,12 +209,14 @@ static void end_cycle(gboolean cancel, guint state, Options *o)
|
||||||
o->dock_windows,
|
o->dock_windows,
|
||||||
o->desktop_windows,
|
o->desktop_windows,
|
||||||
o->interactive,
|
o->interactive,
|
||||||
|
o->bar,
|
||||||
o->dialog,
|
o->dialog,
|
||||||
TRUE, cancel);
|
TRUE, cancel);
|
||||||
cycling = FALSE;
|
cycling = FALSE;
|
||||||
|
|
||||||
if (ft) {
|
if (ft)
|
||||||
actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
actions_run_acts(o->actions, OB_USER_ACTION_KEYBOARD_KEY,
|
||||||
state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
|
state, -1, -1, 0, OB_FRAME_CONTEXT_NONE, ft);
|
||||||
}
|
|
||||||
|
stacking_restore();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,15 +62,16 @@ void focus_cycle_stop(ObClient *ifclient)
|
||||||
focus_cycle_dock_windows,
|
focus_cycle_dock_windows,
|
||||||
focus_cycle_desktop_windows))
|
focus_cycle_desktop_windows))
|
||||||
{
|
{
|
||||||
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,TRUE);
|
||||||
focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
focus_directional_cycle(0, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
|
ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
|
||||||
gboolean dock_windows, gboolean desktop_windows,
|
gboolean dock_windows, gboolean desktop_windows,
|
||||||
gboolean linear, gboolean interactive,
|
gboolean linear, gboolean interactive,
|
||||||
gboolean dialog, gboolean done, gboolean cancel)
|
gboolean showbar, gboolean dialog,
|
||||||
|
gboolean done, gboolean cancel)
|
||||||
{
|
{
|
||||||
static ObClient *t = NULL;
|
static ObClient *t = NULL;
|
||||||
static GList *order = NULL;
|
static GList *order = NULL;
|
||||||
|
@ -128,7 +129,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
if (ft != focus_cycle_target) { /* prevents flicker */
|
if (ft != focus_cycle_target) { /* prevents flicker */
|
||||||
focus_cycle_target = ft;
|
focus_cycle_target = ft;
|
||||||
focus_cycle_draw_indicator(ft);
|
focus_cycle_draw_indicator(showbar ? ft : NULL);
|
||||||
}
|
}
|
||||||
if (dialog)
|
if (dialog)
|
||||||
/* same arguments as focus_target_valid */
|
/* same arguments as focus_target_valid */
|
||||||
|
@ -261,7 +262,7 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir,
|
||||||
ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
|
ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
|
||||||
gboolean desktop_windows,
|
gboolean desktop_windows,
|
||||||
gboolean interactive,
|
gboolean interactive,
|
||||||
gboolean dialog,
|
gboolean showbar, gboolean dialog,
|
||||||
gboolean done, gboolean cancel)
|
gboolean done, gboolean cancel)
|
||||||
{
|
{
|
||||||
static ObClient *first = NULL;
|
static ObClient *first = NULL;
|
||||||
|
@ -307,7 +308,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows,
|
||||||
focus_cycle_target = ft;
|
focus_cycle_target = ft;
|
||||||
if (!interactive)
|
if (!interactive)
|
||||||
goto done_cycle;
|
goto done_cycle;
|
||||||
focus_cycle_draw_indicator(ft);
|
focus_cycle_draw_indicator(showbar ? ft : NULL);
|
||||||
}
|
}
|
||||||
if (focus_cycle_target && dialog)
|
if (focus_cycle_target && dialog)
|
||||||
/* same arguments as focus_target_valid */
|
/* same arguments as focus_target_valid */
|
||||||
|
|
|
@ -37,11 +37,13 @@ void focus_cycle_shutdown(gboolean reconfig);
|
||||||
struct _ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
|
struct _ObClient* focus_cycle(gboolean forward, gboolean all_desktops,
|
||||||
gboolean dock_windows, gboolean desktop_windows,
|
gboolean dock_windows, gboolean desktop_windows,
|
||||||
gboolean linear, gboolean interactive,
|
gboolean linear, gboolean interactive,
|
||||||
gboolean dialog, gboolean done, gboolean cancel);
|
gboolean showbar, gboolean dialog,
|
||||||
|
gboolean done, gboolean cancel);
|
||||||
struct _ObClient* focus_directional_cycle(ObDirection dir,
|
struct _ObClient* focus_directional_cycle(ObDirection dir,
|
||||||
gboolean dock_windows,
|
gboolean dock_windows,
|
||||||
gboolean desktop_windows,
|
gboolean desktop_windows,
|
||||||
gboolean interactive,
|
gboolean interactive,
|
||||||
|
gboolean showbar,
|
||||||
gboolean dialog,
|
gboolean dialog,
|
||||||
gboolean done, gboolean cancel);
|
gboolean done, gboolean cancel);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ struct
|
||||||
|
|
||||||
static RrAppearance *a_focus_indicator;
|
static RrAppearance *a_focus_indicator;
|
||||||
static RrColor *color_white;
|
static RrColor *color_white;
|
||||||
|
static gboolean visible;
|
||||||
|
|
||||||
static Window create_window(Window parent, gulong mask,
|
static Window create_window(Window parent, gulong mask,
|
||||||
XSetWindowAttributes *attrib)
|
XSetWindowAttributes *attrib)
|
||||||
|
@ -53,6 +54,8 @@ void focus_cycle_indicator_startup(gboolean reconfig)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
|
||||||
|
visible = FALSE;
|
||||||
|
|
||||||
if (reconfig) return;
|
if (reconfig) return;
|
||||||
|
|
||||||
focus_indicator.top.obwin.type = Window_Internal;
|
focus_indicator.top.obwin.type = Window_Internal;
|
||||||
|
@ -118,7 +121,7 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
|
||||||
|
|
||||||
void focus_cycle_draw_indicator(ObClient *c)
|
void focus_cycle_draw_indicator(ObClient *c)
|
||||||
{
|
{
|
||||||
if (!c) {
|
if (!c && visible) {
|
||||||
gulong ignore_start;
|
gulong ignore_start;
|
||||||
|
|
||||||
/* kill enter events cause by this unmapping */
|
/* kill enter events cause by this unmapping */
|
||||||
|
@ -130,7 +133,10 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
XUnmapWindow(ob_display, focus_indicator.bottom.win);
|
XUnmapWindow(ob_display, focus_indicator.bottom.win);
|
||||||
|
|
||||||
event_end_ignore_all_enters(ignore_start);
|
event_end_ignore_all_enters(ignore_start);
|
||||||
} else {
|
|
||||||
|
visible = FALSE;
|
||||||
|
}
|
||||||
|
else if (c) {
|
||||||
/*
|
/*
|
||||||
if (c)
|
if (c)
|
||||||
frame_adjust_focus(c->frame, FALSE);
|
frame_adjust_focus(c->frame, FALSE);
|
||||||
|
@ -249,5 +255,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
XMapWindow(ob_display, focus_indicator.left.win);
|
XMapWindow(ob_display, focus_indicator.left.win);
|
||||||
XMapWindow(ob_display, focus_indicator.right.win);
|
XMapWindow(ob_display, focus_indicator.right.win);
|
||||||
XMapWindow(ob_display, focus_indicator.bottom.win);
|
XMapWindow(ob_display, focus_indicator.bottom.win);
|
||||||
|
|
||||||
|
visible = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue