[Xfce4-commits] r27038 - xfwm4/trunk/src
Olivier Fourdan
olivier at xfce.org
Thu Jun 5 23:29:44 CEST 2008
Author: olivier
Date: 2008-06-05 21:29:44 +0000 (Thu, 05 Jun 2008)
New Revision: 27038
Modified:
xfwm4/trunk/src/client.c
xfwm4/trunk/src/cycle.c
xfwm4/trunk/src/events.c
xfwm4/trunk/src/focus.c
xfwm4/trunk/src/focus.h
xfwm4/trunk/src/moveresize.c
xfwm4/trunk/src/stacking.c
xfwm4/trunk/src/stacking.h
Log:
Move iconified windows to the end of the focus ring, improve focus management
Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/client.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -55,8 +55,8 @@
#include "stacking.h"
#include "startup_notification.h"
#include "transients.h"
-#include "wireframe.h"
#include "workspaces.h"
+#include "xsync.h"
#include "event_filter.h"
/* Event mask definition */
@@ -2149,7 +2149,7 @@
}
static void
-clientHideSingle (Client * c, gboolean iconify)
+clientHideSingle (Client * c, GList *exclude_list, gboolean iconify)
{
ScreenInfo *screen_info;
DisplayInfo *display_info;
@@ -2160,7 +2160,7 @@
display_info = screen_info->display_info;
TRACE ("hiding client \"%s\" (0x%lx)", c->name, c->window);
- clientPassFocus(c->screen_info, c, c);
+ clientPassFocus(c->screen_info, c, exclude_list);
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
{
FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_VISIBLE);
@@ -2173,6 +2173,7 @@
if (iconify)
{
FLAG_SET (c->flags, CLIENT_FLAG_ICONIFIED);
+ clientSetLast (c);
setWMState (display_info, c->window, IconicState);
}
clientSetNetState (c);
@@ -2218,7 +2219,7 @@
{
continue;
}
- clientHideSingle (c2, iconify);
+ clientHideSingle (c2, list_of_windows, iconify);
}
g_list_free (list_of_windows);
Modified: xfwm4/trunk/src/cycle.c
===================================================================
--- xfwm4/trunk/src/cycle.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/cycle.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -44,6 +44,8 @@
#include "stacking.h"
#include "tabwin.h"
#include "transients.h"
+#include "wireframe.h"
+#include "workspaces.h"
#include "event_filter.h"
typedef struct _ClientCycleData ClientCycleData;
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/events.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -60,6 +60,7 @@
#include "compositor.h"
#include "events.h"
#include "event_filter.h"
+#include "xsync.h"
#ifndef CHECK_BUTTON_TIME
#define CHECK_BUTTON_TIME 0
@@ -1048,8 +1049,10 @@
static eventFilterStatus
handleDestroyNotify (DisplayInfo *display_info, XDestroyWindowEvent * ev)
{
+ eventFilterStatus status;
+ GList *list_of_windows;
Client *c;
- eventFilterStatus status;
+
#ifdef ENABLE_KDE_SYSTRAY_PROXY
ScreenInfo *screen_info;
#endif
@@ -1072,8 +1075,10 @@
if (c)
{
TRACE ("DestroyNotify for \"%s\" (0x%lx)", c->name, c->window);
- clientPassFocus (c->screen_info, c, c);
+ list_of_windows = clientListTransientOrModal (c);
+ clientPassFocus (c->screen_info, c, list_of_windows);
clientUnframe (c, FALSE);
+ g_list_free (list_of_windows);
status = EVENT_FILTER_REMOVE;
}
@@ -1156,6 +1161,7 @@
{
eventFilterStatus status;
ScreenInfo *screen_info;
+ GList *list_of_windows;
Client *c;
TRACE ("entering handleUnmapNotify");
@@ -1206,8 +1212,11 @@
if ((ev->event == screen_info->xroot) && (ev->send_event))
{
TRACE ("ICCCM UnmapNotify for \"%s\"", c->name);
- clientPassFocus (screen_info, c, c);
+ list_of_windows = clientListTransientOrModal (c);
+ clientPassFocus (screen_info, c, list_of_windows);
clientUnframe (c, FALSE);
+ g_list_free (list_of_windows);
+
return status;
}
@@ -1219,10 +1228,11 @@
}
else
{
- TRACE ("unmapping \"%s\" as ignore_unmap is %i",
- c->name, c->ignore_unmap);
- clientPassFocus (screen_info, c, c);
+ TRACE ("unmapping \"%s\" as ignore_unmap is %i", c->name, c->ignore_unmap);
+ list_of_windows = clientListTransientOrModal (c);
+ clientPassFocus (screen_info, c, list_of_windows);
clientUnframe (c, FALSE);
+ g_list_free (list_of_windows);
}
}
@@ -1745,7 +1755,7 @@
current_focus = clientGetFocus ();
TRACE ("FocusIn on window (0x%lx)", ev->window);
- if ((c) && (c != current_focus))
+ if ((c) && (c != current_focus) && (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)))
{
TRACE ("Focus transfered to \"%s\" (0x%lx)", c->name, c->window);
Modified: xfwm4/trunk/src/focus.c
===================================================================
--- xfwm4/trunk/src/focus.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/focus.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -62,8 +62,23 @@
static Client *delayed_focus = NULL;
static guint focus_timeout = 0;
+#if 0
+static void
+clientDumpList (ScreenInfo *screen_info)
+{
+ int i;
+ Client *c;
+
+ g_print ("Dumping client list\n");
+ for (c = screen_info->clients, i = 0; (c) && (i < screen_info->client_count); c = c->next, i++)
+ {
+ g_print (" [%i] 0x%lx - %s\n", i, c->window, c->name);
+ }
+}
+#endif
+
static ClientPair
-clientGetTopMostFocusable (ScreenInfo *screen_info, int layer, Client * exclude)
+clientGetTopMostFocusable (ScreenInfo *screen_info, int layer, GList * exclude_list)
{
ClientPair top_client;
Client *c;
@@ -83,20 +98,20 @@
continue;
}
- if (!exclude || (c != exclude))
+ if (!g_list_find (exclude_list, (gconstpointer) c))
{
- if ((c->win_layer <= layer) && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
+ if (c->win_layer > layer)
{
+ break;
+ }
+ else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
+ {
if (clientSelectMask (c, 0, WINDOW_REGULAR_FOCUSABLE))
{
top_client.prefered = c;
}
top_client.highest = c;
}
- else if (c->win_layer > layer)
- {
- break;
- }
}
}
@@ -290,7 +305,7 @@
}
void
-clientPassFocus (ScreenInfo *screen_info, Client *c, Client *exclude)
+clientPassFocus (ScreenInfo *screen_info, Client *c, GList *exclude_list)
{
DisplayInfo *display_info;
ClientPair top_most;
@@ -325,7 +340,7 @@
}
display_info = screen_info->display_info;
- top_most = clientGetTopMostFocusable (screen_info, look_in_layer, exclude);
+ top_most = clientGetTopMostFocusable (screen_info, look_in_layer, exclude_list);
#if 0
if (screen_info->params->click_to_focus)
{
@@ -362,7 +377,7 @@
if (!(screen_info->params->click_to_focus) &&
XQueryPointer (myScreenGetXDisplay (screen_info), screen_info->xroot, &dr, &window, &rx, &ry, &wx, &wy, &mask))
{
- new_focus = clientAtPosition (screen_info, rx, ry, exclude);
+ new_focus = clientAtPosition (screen_info, rx, ry, exclude_list);
}
if (!new_focus)
{
@@ -404,7 +419,7 @@
ScreenInfo *screen_info;
g_return_if_fail (c != NULL);
- TRACE ("Sorting...");
+ TRACE ("entering clientSortRing");
screen_info = c->screen_info;
if ((screen_info->client_count > 2) && (c != screen_info->clients))
@@ -414,6 +429,7 @@
c->prev = screen_info->clients->prev;
c->next = screen_info->clients;
+
screen_info->clients->prev->next = c;
screen_info->clients->prev = c;
}
@@ -421,6 +437,35 @@
}
void
+clientSetLast(Client *c)
+{
+ ScreenInfo *screen_info;
+
+ g_return_if_fail (c != NULL);
+ TRACE ("entering clientSetLast");
+
+ screen_info = c->screen_info;
+ if (screen_info->client_count > 2)
+ {
+ if (screen_info->clients == c)
+ {
+ screen_info->clients = screen_info->clients->next;
+ }
+ else
+ {
+ c->prev->next = c->next;
+ c->next->prev = c->prev;
+
+ c->prev = screen_info->clients->prev;
+ c->next = screen_info->clients;
+
+ screen_info->clients->prev->next = c;
+ screen_info->clients->prev = c;
+ }
+ }
+}
+
+void
clientUpdateFocus (ScreenInfo *screen_info, Client * c, unsigned short flags)
{
DisplayInfo *display_info;
Modified: xfwm4/trunk/src/focus.h
===================================================================
--- xfwm4/trunk/src/focus.h 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/focus.h 2008-06-05 21:29:44 UTC (rev 27038)
@@ -52,9 +52,10 @@
int);
void clientPassFocus (ScreenInfo *,
Client *,
- Client *);
+ GList *);
gboolean clientAcceptFocus (Client *);
void clientSortRing (Client *);
+void clientSetLast (Client *);
void clientUpdateFocus (ScreenInfo *,
Client *,
unsigned short);
Modified: xfwm4/trunk/src/moveresize.c
===================================================================
--- xfwm4/trunk/src/moveresize.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/moveresize.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -43,7 +43,9 @@
#include "poswin.h"
#include "screen.h"
#include "settings.h"
+#include "transients.h"
#include "event_filter.h"
+#include "workspaces.h"
#include "xsync.h"
#define MOVERESIZE_EVENT_MASK \
Modified: xfwm4/trunk/src/stacking.c
===================================================================
--- xfwm4/trunk/src/stacking.c 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/stacking.c 2008-06-05 21:29:44 UTC (rev 27038)
@@ -250,7 +250,7 @@
* conditions caused by querying the X server
*/
Client *
-clientAtPosition (ScreenInfo *screen_info, int x, int y, Client * exclude)
+clientAtPosition (ScreenInfo *screen_info, int x, int y, GList * exclude_list)
{
GList *index;
Client *c, *c2;
@@ -265,7 +265,7 @@
&& (frameY (c2) <= y) && (frameY (c2) + frameHeight (c2) >= y))
{
if (clientSelectMask (c2, INCLUDE_SKIP_PAGER | INCLUDE_SKIP_TASKBAR, WINDOW_REGULAR_FOCUSABLE)
- && (c2 != exclude))
+ && !g_list_find (exclude_list, (gconstpointer) c2))
{
c = c2;
break;
Modified: xfwm4/trunk/src/stacking.h
===================================================================
--- xfwm4/trunk/src/stacking.h 2008-06-05 08:42:33 UTC (rev 27037)
+++ xfwm4/trunk/src/stacking.h 2008-06-05 21:29:44 UTC (rev 27038)
@@ -45,7 +45,7 @@
Client *clientAtPosition (ScreenInfo *,
int,
int,
- Client *);
+ GList *);
void clientRaise (Client *,
Window);
void clientLower (Client *,
More information about the Xfce4-commits
mailing list