[Xfce4-commits] [xfce/xfwm4] 02/04: Rework myDisplayGetScreenFromWindow()
noreply at xfce.org
noreply at xfce.org
Fri Jan 30 22:08:45 CET 2015
This is an automated email from the git hooks/post-receive script.
olivier pushed a commit to branch master
in repository xfce/xfwm4.
commit 352da19746442a6400ba6e0598b9d887053beb08
Author: Olivier Fourdan <fourdan at xfce.org>
Date: Fri Jan 30 21:54:45 2015 +0100
Rework myDisplayGetScreenFromWindow()
to reduce roundtrips and X errors.
Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
src/display.c | 13 ++++++++-----
src/events.c | 37 ++++++++++++++++++++++---------------
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/display.c b/src/display.c
index 6a1c036..694ed4f 100644
--- a/src/display.c
+++ b/src/display.c
@@ -618,17 +618,20 @@ myDisplayGetRootFromWindow(DisplayInfo *display, Window w)
ScreenInfo *
myDisplayGetScreenFromWindow (DisplayInfo *display, Window w)
{
- Window root;
+ GSList *list;
g_return_val_if_fail (w != None, NULL);
g_return_val_if_fail (display != NULL, NULL);
- root = myDisplayGetRootFromWindow (display, w);
- if (root != None)
+ for (list = display->screens; list; list = g_slist_next (list))
{
- return myDisplayGetScreenFromRoot (display, root);
+ ScreenInfo *screen = (ScreenInfo *) list->data;
+ if (screen->xroot == w)
+ {
+ return screen;
+ }
}
- TRACE ("myDisplayGetScreenFromWindow: no screen found");
+ TRACE ("myDisplayGetScreenFromWindow: no screen found for 0x%lx", w);
return NULL;
}
diff --git a/src/events.c b/src/events.c
index 2ecb1b8..719ce41 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1540,16 +1540,16 @@ handleFocusIn (DisplayInfo *display_info, XFocusChangeEvent * ev)
"NotifyDetailNone" :
"(unknown)");
- screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
- if (!screen_info)
+ if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab))
{
- /* Not for us */
+ /* We're not interested in such notifications */
return EVENT_FILTER_PASS;
}
- if ((ev->window == screen_info->xroot)
- && ((ev->detail == NotifyDetailNone)
- || ((ev->mode == NotifyNormal) && (ev->detail == NotifyInferior))))
+ screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
+ if (screen_info &&
+ ((ev->detail == NotifyDetailNone) ||
+ ((ev->mode == NotifyNormal) && (ev->detail == NotifyInferior))))
{
/*
Handle unexpected focus transition to root (means that an unknown
@@ -1559,11 +1559,7 @@ handleFocusIn (DisplayInfo *display_info, XFocusChangeEvent * ev)
clientSetFocus (screen_info, c, getXServerTime (display_info), FOCUS_FORCE);
return EVENT_FILTER_PASS;
}
- if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab))
- {
- /* We're not interested in such notifications */
- return EVENT_FILTER_PASS;
- }
+
c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_WINDOW);
user_focus = clientGetUserFocus ();
current_focus = clientGetFocus ();
@@ -2016,7 +2012,6 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
TRACE ("window (0x%lx) has received a MANAGER event", ev->window);
selection = (Atom) ev->data.l[1];
-
#ifdef ENABLE_KDE_SYSTRAY_PROXY
if (selection == screen_info->net_system_tray_selection)
{
@@ -2052,12 +2047,24 @@ static eventFilterStatus
handleSelectionClear (DisplayInfo *display_info, XSelectionClearEvent * ev)
{
eventFilterStatus status;
- ScreenInfo *screen_info;
+ ScreenInfo *screen_info, *pscreen;
+ GSList *list;
- TRACE ("entering handleSelectionClear");
+ DBG ("entering handleSelectionClear 0x%lx", ev->window);
status = EVENT_FILTER_PASS;
- screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
+ screen_info = NULL;
+
+ for (list = display_info->screens; list; list = g_slist_next (list))
+ {
+ pscreen = (ScreenInfo *) list->data;
+ if (ev->window == pscreen->xfwm4_win)
+ {
+ screen_info = pscreen;
+ break;
+ }
+ }
+
if (screen_info)
{
if (myScreenCheckWMAtom (screen_info, ev->selection))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list