replace the focus_backup with the screen_support_win, we dont need 2 offscreen windows.
This commit is contained in:
parent
120623d34e
commit
d1d84711a2
6 changed files with 30 additions and 39 deletions
|
@ -21,29 +21,14 @@ ObClient *focus_client = NULL;
|
||||||
GList **focus_order = NULL; /* these lists are created when screen_startup
|
GList **focus_order = NULL; /* these lists are created when screen_startup
|
||||||
sets the number of desktops */
|
sets the number of desktops */
|
||||||
|
|
||||||
Window focus_backup = None;
|
|
||||||
|
|
||||||
static ObClient *focus_cycle_target = NULL;
|
static ObClient *focus_cycle_target = NULL;
|
||||||
static Popup *focus_cycle_popup = NULL;
|
static Popup *focus_cycle_popup = NULL;
|
||||||
|
|
||||||
void focus_startup()
|
void focus_startup()
|
||||||
{
|
{
|
||||||
/* create the window which gets focus when no clients get it. Have to
|
|
||||||
make it override-redirect so we don't try manage it, since it is
|
|
||||||
mapped. */
|
|
||||||
XSetWindowAttributes attrib;
|
|
||||||
|
|
||||||
focus_client = NULL;
|
focus_client = NULL;
|
||||||
|
|
||||||
attrib.override_redirect = TRUE;
|
|
||||||
focus_backup = XCreateWindow(ob_display, ob_root,
|
|
||||||
-100, -100, 1, 1, 0,
|
|
||||||
CopyFromParent, InputOutput, CopyFromParent,
|
|
||||||
CWOverrideRedirect, &attrib);
|
|
||||||
XMapRaised(ob_display, focus_backup);
|
|
||||||
|
|
||||||
/* do this *after* focus_backup is created, since it is used for
|
|
||||||
stacking */
|
|
||||||
focus_cycle_popup = popup_new(TRUE);
|
focus_cycle_popup = popup_new(TRUE);
|
||||||
|
|
||||||
/* start with nothing focused */
|
/* start with nothing focused */
|
||||||
|
@ -62,8 +47,6 @@ void focus_shutdown()
|
||||||
popup_free(focus_cycle_popup);
|
popup_free(focus_cycle_popup);
|
||||||
focus_cycle_popup = NULL;
|
focus_cycle_popup = NULL;
|
||||||
|
|
||||||
XDestroyWindow(ob_display, focus_backup);
|
|
||||||
|
|
||||||
/* reset focus to root */
|
/* reset focus to root */
|
||||||
XSetInputFocus(ob_display, PointerRoot, RevertToPointerRoot,
|
XSetInputFocus(ob_display, PointerRoot, RevertToPointerRoot,
|
||||||
event_lasttime);
|
event_lasttime);
|
||||||
|
@ -94,7 +77,7 @@ void focus_set_client(ObClient *client)
|
||||||
|
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
/* when nothing will be focused, send focus to the backup target */
|
/* when nothing will be focused, send focus to the backup target */
|
||||||
XSetInputFocus(ob_display, focus_backup, RevertToPointerRoot,
|
XSetInputFocus(ob_display, screen_support_win, RevertToPointerRoot,
|
||||||
event_lasttime);
|
event_lasttime);
|
||||||
XSync(ob_display, FALSE);
|
XSync(ob_display, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
|
|
||||||
struct _ObClient;
|
struct _ObClient;
|
||||||
|
|
||||||
/*! The window which gets focus when nothing else will be focused */
|
|
||||||
extern Window focus_backup;
|
|
||||||
|
|
||||||
/*! The client which is currently focused */
|
/*! The client which is currently focused */
|
||||||
extern struct _ObClient *focus_client;
|
extern struct _ObClient *focus_client;
|
||||||
|
|
||||||
|
|
|
@ -30,23 +30,22 @@
|
||||||
SubstructureNotifyMask | SubstructureRedirectMask | \
|
SubstructureNotifyMask | SubstructureRedirectMask | \
|
||||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
|
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
|
||||||
|
|
||||||
guint screen_num_desktops = 0;
|
guint screen_num_desktops;
|
||||||
guint screen_num_monitors = 0;
|
guint screen_num_monitors;
|
||||||
guint screen_desktop = 0;
|
guint screen_desktop;
|
||||||
Size screen_physical_size;
|
Size screen_physical_size;
|
||||||
gboolean screen_showing_desktop;
|
gboolean screen_showing_desktop;
|
||||||
DesktopLayout screen_desktop_layout;
|
DesktopLayout screen_desktop_layout;
|
||||||
char **screen_desktop_names = NULL;
|
char **screen_desktop_names;
|
||||||
|
Window screen_support_win;
|
||||||
|
|
||||||
static Rect **area = NULL; /* array of desktop holding array of
|
static Rect **area; /* array of desktop holding array of xinerama areas */
|
||||||
xinerama areas */
|
static Rect *monitor_area;
|
||||||
static Rect *monitor_area = NULL;
|
|
||||||
static Window support_window = None;
|
|
||||||
|
|
||||||
#ifdef USE_LIBSN
|
#ifdef USE_LIBSN
|
||||||
static SnMonitorContext *sn_context;
|
static SnMonitorContext *sn_context;
|
||||||
static int sn_busy_cnt;
|
static int sn_busy_cnt;
|
||||||
static ObTimer *sn_timer = NULL;
|
static ObTimer *sn_timer;
|
||||||
|
|
||||||
static void sn_event_func(SnMonitorEvent *event, void *data);
|
static void sn_event_func(SnMonitorEvent *event, void *data);
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,8 +54,9 @@ static void set_root_cursor();
|
||||||
|
|
||||||
gboolean screen_annex()
|
gboolean screen_annex()
|
||||||
{
|
{
|
||||||
|
XSetWindowAttributes attrib;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int i, num_support;
|
gint i, num_support;
|
||||||
guint32 *supported;
|
guint32 *supported;
|
||||||
|
|
||||||
xerror_set_ignore(TRUE);
|
xerror_set_ignore(TRUE);
|
||||||
|
@ -79,14 +79,21 @@ gboolean screen_annex()
|
||||||
PROP_SET32(ob_root, openbox_pid, cardinal, pid);
|
PROP_SET32(ob_root, openbox_pid, cardinal, pid);
|
||||||
|
|
||||||
/* create the netwm support window */
|
/* create the netwm support window */
|
||||||
support_window = XCreateSimpleWindow(ob_display, ob_root, 0,0,1,1,0,0,0);
|
attrib.override_redirect = TRUE;
|
||||||
|
screen_support_win = XCreateWindow(ob_display, ob_root,
|
||||||
|
-100, -100, 1, 1, 0,
|
||||||
|
CopyFromParent, InputOutput,
|
||||||
|
CopyFromParent,
|
||||||
|
CWOverrideRedirect, &attrib);
|
||||||
|
XMapRaised(ob_display, screen_support_win);
|
||||||
|
|
||||||
/* set supporting window */
|
/* set supporting window */
|
||||||
PROP_SET32(ob_root, net_supporting_wm_check, window, support_window);
|
PROP_SET32(ob_root, net_supporting_wm_check, window, screen_support_win);
|
||||||
|
|
||||||
/* set properties on the supporting window */
|
/* set properties on the supporting window */
|
||||||
PROP_SETS(support_window, net_wm_name, "Openbox");
|
PROP_SETS(screen_support_win, net_wm_name, "Openbox");
|
||||||
PROP_SET32(support_window, net_supporting_wm_check, window,support_window);
|
PROP_SET32(screen_support_win, net_supporting_wm_check,
|
||||||
|
window, screen_support_win);
|
||||||
|
|
||||||
/* set the _NET_SUPPORTED_ATOMS hint */
|
/* set the _NET_SUPPORTED_ATOMS hint */
|
||||||
num_support = 61;
|
num_support = 61;
|
||||||
|
@ -212,7 +219,7 @@ void screen_shutdown()
|
||||||
PROP_ERASE(ob_root, net_supported); /* not without us */
|
PROP_ERASE(ob_root, net_supported); /* not without us */
|
||||||
PROP_ERASE(ob_root, net_showing_desktop); /* don't keep this mode */
|
PROP_ERASE(ob_root, net_showing_desktop); /* don't keep this mode */
|
||||||
|
|
||||||
XDestroyWindow(ob_display, support_window);
|
XDestroyWindow(ob_display, screen_support_win);
|
||||||
|
|
||||||
g_strfreev(screen_desktop_names);
|
g_strfreev(screen_desktop_names);
|
||||||
for (r = area; *r; ++r)
|
for (r = area; *r; ++r)
|
||||||
|
|
|
@ -16,6 +16,8 @@ extern guint screen_num_monitors;
|
||||||
extern guint screen_desktop;
|
extern guint screen_desktop;
|
||||||
/*! Are we in showing-desktop mode? */
|
/*! Are we in showing-desktop mode? */
|
||||||
extern gboolean screen_showing_desktop;
|
extern gboolean screen_showing_desktop;
|
||||||
|
/*! The support window also used for focus and stacking */
|
||||||
|
extern Window screen_support_win;
|
||||||
|
|
||||||
typedef struct DesktopLayout {
|
typedef struct DesktopLayout {
|
||||||
ObOrientation orientation;
|
ObOrientation orientation;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
|
#include "screen.h"
|
||||||
#include "focus.h"
|
#include "focus.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
|
@ -53,7 +54,7 @@ static void do_restack(GList *wins, GList *before)
|
||||||
win = g_new(Window, g_list_length(wins) + 1);
|
win = g_new(Window, g_list_length(wins) + 1);
|
||||||
|
|
||||||
if (before == stacking_list)
|
if (before == stacking_list)
|
||||||
win[0] = focus_backup;
|
win[0] = screen_support_win;
|
||||||
else if (!before)
|
else if (!before)
|
||||||
win[0] = window_top(g_list_last(stacking_list)->data);
|
win[0] = window_top(g_list_last(stacking_list)->data);
|
||||||
else
|
else
|
||||||
|
@ -267,7 +268,7 @@ void stacking_add(ObWindow *win)
|
||||||
ObStackingLayer l;
|
ObStackingLayer l;
|
||||||
GList *wins;
|
GList *wins;
|
||||||
|
|
||||||
g_assert(focus_backup != None); /* make sure I dont break this in the
|
g_assert(screen_support_win != None); /* make sure I dont break this in the
|
||||||
future */
|
future */
|
||||||
|
|
||||||
l = window_layer(win);
|
l = window_layer(win);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "kernel/focus.h"
|
#include "kernel/focus.h"
|
||||||
|
#include "kernel/screen.h"
|
||||||
#include "kernel/frame.h"
|
#include "kernel/frame.h"
|
||||||
#include "kernel/dispatch.h"
|
#include "kernel/dispatch.h"
|
||||||
#include "kernel/openbox.h"
|
#include "kernel/openbox.h"
|
||||||
|
@ -103,7 +104,7 @@ static void grab_keys(gboolean grab)
|
||||||
{
|
{
|
||||||
GList *it;
|
GList *it;
|
||||||
|
|
||||||
grab_for_window(focus_backup, grab);
|
grab_for_window(screen_support_win, grab);
|
||||||
for (it = client_list; it; it = g_list_next(it))
|
for (it = client_list; it; it = g_list_next(it))
|
||||||
grab_for_window(((ObClient*)it->data)->frame->window, grab);
|
grab_for_window(((ObClient*)it->data)->frame->window, grab);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue