only pass thru events when the menu is open, don't for other stuff
This commit is contained in:
parent
a70633d42a
commit
ff43372da7
7 changed files with 23 additions and 24 deletions
|
@ -41,7 +41,7 @@ inline void client_action_start(union ActionData *data)
|
||||||
{
|
{
|
||||||
if (config_focus_follow)
|
if (config_focus_follow)
|
||||||
if (data->any.context != OB_FRAME_CONTEXT_CLIENT && !data->any.button)
|
if (data->any.context != OB_FRAME_CONTEXT_CLIENT && !data->any.button)
|
||||||
grab_pointer(TRUE, OB_CURSOR_NONE);
|
grab_pointer(TRUE, FALSE, OB_CURSOR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void client_action_end(union ActionData *data)
|
inline void client_action_end(union ActionData *data)
|
||||||
|
@ -49,7 +49,7 @@ inline void client_action_end(union ActionData *data)
|
||||||
if (config_focus_follow)
|
if (config_focus_follow)
|
||||||
if (data->any.context != OB_FRAME_CONTEXT_CLIENT) {
|
if (data->any.context != OB_FRAME_CONTEXT_CLIENT) {
|
||||||
if (!data->any.button) {
|
if (!data->any.button) {
|
||||||
grab_pointer(FALSE, OB_CURSOR_NONE);
|
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
|
||||||
} else {
|
} else {
|
||||||
ObClient *c;
|
ObClient *c;
|
||||||
|
|
||||||
|
|
|
@ -393,9 +393,6 @@ static Bool look_for_focusin(Display *d, XEvent *e, XPointer arg)
|
||||||
static gboolean event_ignore(XEvent *e, ObClient *client)
|
static gboolean event_ignore(XEvent *e, ObClient *client)
|
||||||
{
|
{
|
||||||
switch(e->type) {
|
switch(e->type) {
|
||||||
case EnterNotify:
|
|
||||||
case LeaveNotify:
|
|
||||||
return keyboard_interactively_grabbed();
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
if (!wanted_focusevent(e)) {
|
if (!wanted_focusevent(e)) {
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | \
|
#define GRAB_PTR_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
||||||
PointerMotionMask | EnterWindowMask | LeaveWindowMask)
|
|
||||||
#define GRAB_KEY_MASK (KeyPressMask | KeyReleaseMask)
|
#define GRAB_KEY_MASK (KeyPressMask | KeyReleaseMask)
|
||||||
|
|
||||||
#define MASK_LIST_SIZE 8
|
#define MASK_LIST_SIZE 8
|
||||||
|
@ -90,15 +89,15 @@ gboolean grab_keyboard(gboolean grab)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean grab_pointer(gboolean grab, ObCursor cur)
|
gboolean grab_pointer(gboolean grab, gboolean owner_events, ObCursor cur)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (grab) {
|
if (grab) {
|
||||||
if (pgrabs++ == 0) {
|
if (pgrabs++ == 0) {
|
||||||
ret = XGrabPointer(ob_display, screen_support_win,
|
ret = XGrabPointer(ob_display, screen_support_win, owner_events,
|
||||||
True, GRAB_PTR_MASK, GrabModeAsync,
|
GRAB_PTR_MASK,
|
||||||
GrabModeAsync, None,
|
GrabModeAsync, GrabModeAsync, None,
|
||||||
ob_cursor(cur), event_curtime) == Success;
|
ob_cursor(cur), event_curtime) == Success;
|
||||||
if (!ret)
|
if (!ret)
|
||||||
--pgrabs;
|
--pgrabs;
|
||||||
|
@ -115,13 +114,15 @@ gboolean grab_pointer(gboolean grab, ObCursor cur)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win)
|
gboolean grab_pointer_window(gboolean grab, gboolean owner_events,
|
||||||
|
ObCursor cur, Window win)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (grab) {
|
if (grab) {
|
||||||
if (pgrabs++ == 0) {
|
if (pgrabs++ == 0) {
|
||||||
ret = XGrabPointer(ob_display, win, True, GRAB_PTR_MASK,
|
ret = XGrabPointer(ob_display, win, owner_events,
|
||||||
|
GRAB_PTR_MASK,
|
||||||
GrabModeAsync, GrabModeAsync, None,
|
GrabModeAsync, GrabModeAsync, None,
|
||||||
ob_cursor(cur),
|
ob_cursor(cur),
|
||||||
event_curtime) == Success;
|
event_curtime) == Success;
|
||||||
|
@ -179,8 +180,8 @@ void grab_shutdown(gboolean reconfig)
|
||||||
if (reconfig) return;
|
if (reconfig) return;
|
||||||
|
|
||||||
while (grab_keyboard(FALSE));
|
while (grab_keyboard(FALSE));
|
||||||
while (grab_pointer(FALSE, OB_CURSOR_NONE));
|
while (grab_pointer(FALSE, FALSE, OB_CURSOR_NONE));
|
||||||
while (grab_pointer_window(FALSE, OB_CURSOR_NONE, None));
|
while (grab_pointer_window(FALSE, FALSE, OB_CURSOR_NONE, None));
|
||||||
while (grab_server(FALSE));
|
while (grab_server(FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,9 @@ void grab_startup(gboolean reconfig);
|
||||||
void grab_shutdown(gboolean reconfig);
|
void grab_shutdown(gboolean reconfig);
|
||||||
|
|
||||||
gboolean grab_keyboard(gboolean grab);
|
gboolean grab_keyboard(gboolean grab);
|
||||||
gboolean grab_pointer(gboolean grab, ObCursor cur);
|
gboolean grab_pointer(gboolean grab, gboolean owner_events, ObCursor cur);
|
||||||
gboolean grab_pointer_window(gboolean grab, ObCursor cur, Window win);
|
gboolean grab_pointer_window(gboolean grab, gboolean owner_events,
|
||||||
|
ObCursor cur, Window win);
|
||||||
gint grab_server(gboolean grab);
|
gint grab_server(gboolean grab);
|
||||||
|
|
||||||
gboolean grab_on_keyboard();
|
gboolean grab_on_keyboard();
|
||||||
|
|
|
@ -166,7 +166,7 @@ gboolean keyboard_interactive_grab(guint state, ObClient *client,
|
||||||
if (!interactive_states) {
|
if (!interactive_states) {
|
||||||
if (!grab_keyboard(TRUE))
|
if (!grab_keyboard(TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!grab_pointer(TRUE, OB_CURSOR_NONE)) {
|
if (!grab_pointer(TRUE, FALSE, OB_CURSOR_NONE)) {
|
||||||
grab_keyboard(FALSE);
|
grab_keyboard(FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ void keyboard_interactive_end(ObInteractiveState *s,
|
||||||
|
|
||||||
if (!interactive_states) {
|
if (!interactive_states) {
|
||||||
grab_keyboard(FALSE);
|
grab_keyboard(FALSE);
|
||||||
grab_pointer(FALSE, OB_CURSOR_NONE);
|
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
|
||||||
keyboard_reset_chains();
|
keyboard_reset_chains();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,10 +681,10 @@ static gboolean menu_frame_show(ObMenuFrame *self)
|
||||||
|
|
||||||
if (menu_frame_visible == NULL) {
|
if (menu_frame_visible == NULL) {
|
||||||
/* no menus shown yet */
|
/* no menus shown yet */
|
||||||
if (!grab_pointer(TRUE, OB_CURSOR_POINTER))
|
if (!grab_pointer(TRUE, TRUE, OB_CURSOR_POINTER))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!grab_keyboard(TRUE)) {
|
if (!grab_keyboard(TRUE)) {
|
||||||
grab_pointer(FALSE, OB_CURSOR_POINTER);
|
grab_pointer(FALSE, TRUE, OB_CURSOR_POINTER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,7 +809,7 @@ void menu_frame_hide(ObMenuFrame *self)
|
||||||
|
|
||||||
if (menu_frame_visible == NULL) {
|
if (menu_frame_visible == NULL) {
|
||||||
/* last menu shown */
|
/* last menu shown */
|
||||||
grab_pointer(FALSE, OB_CURSOR_NONE);
|
grab_pointer(FALSE, TRUE, OB_CURSOR_NONE);
|
||||||
grab_keyboard(FALSE);
|
grab_keyboard(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,14 +164,14 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
|
||||||
else
|
else
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
|
|
||||||
grab_pointer(TRUE, cur);
|
grab_pointer(TRUE, FALSE, cur);
|
||||||
grab_keyboard(TRUE);
|
grab_keyboard(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void moveresize_end(gboolean cancel)
|
void moveresize_end(gboolean cancel)
|
||||||
{
|
{
|
||||||
grab_keyboard(FALSE);
|
grab_keyboard(FALSE);
|
||||||
grab_pointer(FALSE, OB_CURSOR_NONE);
|
grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
|
||||||
|
|
||||||
popup_hide(popup);
|
popup_hide(popup);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue