[Xfce4-commits] r25801 - xfwm4/trunk/src
Olivier Fourdan
olivier at xfce.org
Mon Jun 11 23:53:45 CEST 2007
Author: olivier
Date: 2007-06-11 21:53:45 +0000 (Mon, 11 Jun 2007)
New Revision: 25801
Modified:
xfwm4/trunk/src/client.c
xfwm4/trunk/src/client.h
xfwm4/trunk/src/compositor.c
xfwm4/trunk/src/display.c
xfwm4/trunk/src/display.h
xfwm4/trunk/src/events.c
xfwm4/trunk/src/frame.c
xfwm4/trunk/src/mywindow.c
xfwm4/trunk/src/mywindow.h
xfwm4/trunk/src/screen.c
xfwm4/trunk/src/screen.h
xfwm4/trunk/src/settings.c
xfwm4/trunk/src/stacking.c
xfwm4/trunk/src/transients.c
Log:
Add support for button prelight in windows frame
Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/client.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -76,6 +76,10 @@
FocusChangeMask|\
PropertyChangeMask
+#define BUTTON_EVENT_MASK \
+ EnterWindowMask|\
+ LeaveWindowMask
+
/* Useful macros */
#define START_ICONIC(c) \
((c->wmhints) && \
@@ -1588,6 +1592,7 @@
xfwmPixmapFree (&c->appmenu[ACTIVE]);
xfwmPixmapFree (&c->appmenu[INACTIVE]);
xfwmPixmapFree (&c->appmenu[PRESSED]);
+ xfwmPixmapFree (&c->appmenu[PRELIGHT]);
if (screen_info->buttons[MENU_BUTTON][ACTIVE].pixmap == None)
{
@@ -1601,6 +1606,8 @@
&c->appmenu[INACTIVE]);
xfwmPixmapDuplicate (&screen_info->buttons[MENU_BUTTON][PRESSED],
&c->appmenu[PRESSED]);
+ xfwmPixmapDuplicate (&screen_info->buttons[MENU_BUTTON][PRELIGHT],
+ &c->appmenu[PRELIGHT]);
size = MIN (screen_info->buttons[MENU_BUTTON][ACTIVE].width,
screen_info->buttons[MENU_BUTTON][ACTIVE].height);
@@ -1612,6 +1619,7 @@
xfwmPixmapRenderGdkPixbuf (&c->appmenu[ACTIVE], icon);
xfwmPixmapRenderGdkPixbuf (&c->appmenu[INACTIVE], icon);
xfwmPixmapRenderGdkPixbuf (&c->appmenu[PRESSED], icon);
+ xfwmPixmapRenderGdkPixbuf (&c->appmenu[PRELIGHT], icon);
g_object_unref (icon);
}
@@ -1799,7 +1807,7 @@
for (i = 0; i < BUTTON_COUNT; i++)
{
- c->button_pressed[i] = FALSE;
+ c->button_status[i] = BUTTON_STATE_NORMAL;
}
if (!XGetWMColormapWindows (display_info->dpy, c->window, &c->cmap_windows, &c->ncmap))
@@ -1993,39 +2001,48 @@
xfwmPixmapInit (screen_info, &c->appmenu[ACTIVE]);
xfwmPixmapInit (screen_info, &c->appmenu[INACTIVE]);
xfwmPixmapInit (screen_info, &c->appmenu[PRESSED]);
+ xfwmPixmapInit (screen_info, &c->appmenu[PRELIGHT]);
xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->sides[SIDE_LEFT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + SIDE_LEFT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->sides[SIDE_RIGHT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + SIDE_RIGHT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->sides[SIDE_BOTTOM],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + SIDE_BOTTOM));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->corners[CORNER_BOTTOM_LEFT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_BOTTOM_LEFT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->corners[CORNER_BOTTOM_RIGHT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_BOTTOM_RIGHT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->corners[CORNER_TOP_LEFT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_TOP_LEFT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->corners[CORNER_TOP_RIGHT],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_TOP_RIGHT));
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->title, None);
+ &c->sides[SIDE_LEFT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_COUNT + SIDE_LEFT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->sides[SIDE_RIGHT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_COUNT + SIDE_RIGHT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->sides[SIDE_BOTTOM], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_COUNT + SIDE_BOTTOM));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->corners[CORNER_BOTTOM_LEFT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_BOTTOM_LEFT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->corners[CORNER_BOTTOM_RIGHT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_BOTTOM_RIGHT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->corners[CORNER_TOP_LEFT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_TOP_LEFT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->corners[CORNER_TOP_RIGHT], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_TOP_RIGHT));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->title, NoEventMask, None);
/* create the top side window AFTER the title window since they overlap
and the top side window should be on top */
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->sides[SIDE_TOP],
- myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + SIDE_TOP));
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->sides[SIDE_TOP], NoEventMask,
+ myDisplayGetCursorResize(screen_info->display_info,
+ CORNER_COUNT + SIDE_TOP));
for (i = 0; i < BUTTON_COUNT; i++)
{
- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
- &c->buttons[i], None);
+ xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
+ &c->buttons[i], BUTTON_EVENT_MASK, None);
}
clientUpdateIconPix (c);
@@ -2167,6 +2184,7 @@
xfwmPixmapFree (&c->appmenu[ACTIVE]);
xfwmPixmapFree (&c->appmenu[INACTIVE]);
xfwmPixmapFree (&c->appmenu[PRESSED]);
+ xfwmPixmapFree (&c->appmenu[PRELIGHT]);
for (i = 0; i < BUTTON_COUNT; i++)
{
@@ -2252,7 +2270,7 @@
XQueryTree (display_info->dpy, screen_info->xroot, &w1, &w2, &wins, &count);
for (i = 0; i < count; i++)
{
- c = clientGetFromWindow (screen_info, wins[i], FRAME);
+ c = myScreenGetClientFromWindow (screen_info, wins[i], SEARCH_FRAME);
if (c)
{
clientUnframe (c, TRUE);
@@ -2267,43 +2285,44 @@
}
Client *
-clientGetFromWindow (ScreenInfo *screen_info, Window w, int mode)
+clientGetFromWindow (Client *c, Window w, unsigned short mode)
{
- Client *c;
- int i;
+ int b;
g_return_val_if_fail (w != None, NULL);
+ g_return_val_if_fail (c != NULL, NULL);
TRACE ("entering clientGetFromWindow");
- TRACE ("looking for (0x%lx)", w);
- for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
+ if (mode & SEARCH_WINDOW)
{
- switch (mode)
+ if (c->window == w)
{
- case WINDOW:
- if (c->window == w)
- {
- TRACE ("found \"%s\" (mode WINDOW)", c->name);
- return (c);
- }
- break;
- case FRAME:
- if (c->frame == w)
- {
- TRACE ("found \"%s\" (mode FRAME)", c->name);
- return (c);
- }
- break;
- case ANY:
- default:
- if ((c->frame == w) || (c->window == w))
- {
- TRACE ("found \"%s\" (mode ANY)", c->name);
- return (c);
- }
- break;
+ TRACE ("found \"%s\" (mode WINDOW)", c->name);
+ return (c);
}
}
+
+ if (mode & SEARCH_FRAME)
+ {
+ if (c->frame == w)
+ {
+ TRACE ("found \"%s\" (mode FRAME)", c->name);
+ return (c);
+ }
+ }
+
+ if (mode & SEARCH_BUTTON)
+ {
+ for (b = 0; b < BUTTON_COUNT; b++)
+ {
+ if (MYWINDOW_XWINDOW(c->buttons[b]) == w)
+ {
+ TRACE ("found \"%s\" (mode BUTTON)", c->name);
+ return (c);
+ }
+ }
+ }
+
TRACE ("no client found");
return NULL;
@@ -4731,14 +4750,14 @@
switch (xevent->type)
{
case DestroyNotify:
- removed = clientGetFromWindow (screen_info, ((XDestroyWindowEvent *) xevent)->window, WINDOW);
+ removed = myScreenGetClientFromWindow (screen_info, ((XDestroyWindowEvent *) xevent)->window, SEARCH_WINDOW);
gone |= (c == removed);
c = tabwinRemoveClient(passdata->tabwin, removed);
passdata->c = c;
status = EVENT_FILTER_CONTINUE;
/* Walk through */
case UnmapNotify:
- removed = clientGetFromWindow (screen_info, ((XUnmapEvent *) xevent)->window, WINDOW);
+ removed = myScreenGetClientFromWindow (screen_info, ((XUnmapEvent *) xevent)->window, SEARCH_WINDOW);
gone |= (c == removed);
c = tabwinRemoveClient(passdata->tabwin, removed);
passdata->c = c;
@@ -4951,12 +4970,12 @@
if (xevent->type == EnterNotify)
{
- c->button_pressed[b] = TRUE;
+ c->button_status[b] = BUTTON_STATE_PRESSED;
frameDraw (c, FALSE);
}
else if (xevent->type == LeaveNotify)
{
- c->button_pressed[b] = FALSE;
+ c->button_status[b] = BUTTON_STATE_NORMAL;
frameDraw (c, FALSE);
}
else if (xevent->type == ButtonRelease)
@@ -4966,7 +4985,7 @@
else if ((xevent->type == UnmapNotify) && (xevent->xunmap.window == c->window))
{
pressed = FALSE;
- c->button_pressed[b] = FALSE;
+ c->button_status[b] = BUTTON_STATE_NORMAL;
}
else if ((xevent->type == KeyPress) || (xevent->type == KeyRelease))
{
@@ -5027,7 +5046,7 @@
passdata.c = c;
passdata.b = b;
- c->button_pressed[b] = TRUE;
+ c->button_status[b] = BUTTON_STATE_PRESSED;
frameDraw (c, FALSE);
TRACE ("entering button press loop");
@@ -5038,9 +5057,9 @@
XUngrabPointer (display_info->dpy, myDisplayGetCurrentTime (display_info));
- if (c->button_pressed[b])
+ if (c->button_status[b] == BUTTON_STATE_PRESSED)
{
- c->button_pressed[b] = FALSE;
+ c->button_status[b] = BUTTON_STATE_NORMAL;
switch (b)
{
case HIDE_BUTTON:
@@ -5090,11 +5109,11 @@
if (c->group_leader != None)
{
- return clientGetFromWindow (c->screen_info, c->group_leader, WINDOW);
+ return myScreenGetClientFromWindow (c->screen_info, c->group_leader, SEARCH_WINDOW);
}
else if (c->client_leader != None)
{
- return clientGetFromWindow (c->screen_info, c->client_leader, WINDOW);
+ return myScreenGetClientFromWindow (c->screen_info, c->client_leader, SEARCH_WINDOW);
}
return NULL;
}
Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/client.h 2007-06-11 21:53:45 UTC (rev 25801)
@@ -228,7 +228,7 @@
xfwmWindow buttons[BUTTON_COUNT];
Window client_leader;
Window group_leader;
- xfwmPixmap appmenu[3];
+ xfwmPixmap appmenu[STATE_COUNT];
Colormap cmap;
unsigned long win_hints;
unsigned long win_state;
@@ -264,7 +264,7 @@
int previous_height;
int initial_layer;
int ncmap;
- int button_pressed[BUTTON_COUNT];
+ int button_status[BUTTON_COUNT];
int struts[STRUTS_SIZE];
gchar *name;
Time user_time;
@@ -336,9 +336,9 @@
gboolean);
void clientGrabButtons (Client *);
void clientUngrabButtons (Client *);
-Client *clientGetFromWindow (ScreenInfo *,
+Client *clientGetFromWindow (Client *,
Window,
- int);
+ unsigned short);
void clientShow (Client *,
gboolean);
void clientHide (Client *,
Modified: xfwm4/trunk/src/compositor.c
===================================================================
--- xfwm4/trunk/src/compositor.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/compositor.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -2934,7 +2934,7 @@
{
Client *c;
- c = clientGetFromWindow (screen_info, wins[i], FRAME);
+ c = myScreenGetClientFromWindow (screen_info, wins[i], SEARCH_FRAME);
compositorAddWindow (display_info, wins[i], c);
}
if (wins)
Modified: xfwm4/trunk/src/display.c
===================================================================
--- xfwm4/trunk/src/display.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/display.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -466,7 +466,7 @@
}
Client *
-myDisplayGetClientFromWindow (DisplayInfo *display, Window w, int mode)
+myDisplayGetClientFromWindow (DisplayInfo *display, Window w, unsigned short mode)
{
GSList *index;
@@ -476,30 +476,9 @@
for (index = display->clients; index; index = g_slist_next (index))
{
Client *c = (Client *) index->data;
- switch (mode)
+ if (clientGetFromWindow (c, w, mode))
{
- case WINDOW:
- if (c->window == w)
- {
- TRACE ("found \"%s\" (mode WINDOW)", c->name);
- return (c);
- }
- break;
- case FRAME:
- if (c->frame == w)
- {
- TRACE ("found \"%s\" (mode FRAME)", c->name);
- return (c);
- }
- break;
- case ANY:
- default:
- if ((c->frame == w) || (c->window == w))
- {
- TRACE ("found \"%s\" (mode ANY)", c->name);
- return (c);
- }
- break;
+ return (c);
}
}
TRACE ("no client found");
Modified: xfwm4/trunk/src/display.h
===================================================================
--- xfwm4/trunk/src/display.h 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/display.h 2007-06-11 21:53:45 UTC (rev 25801)
@@ -69,6 +69,14 @@
enum
{
+ SEARCH_WINDOW = (1 << 0),
+ SEARCH_FRAME = (1 << 1),
+ SEARCH_BUTTON = (1 << 2)
+};
+#define SEARCH_ANY (SEARCH_WINDOW | SEARCH_FRAME | SEARCH_BUTTON)
+
+enum
+{
TITLE_1 = 0,
TITLE_2,
TITLE_3,
@@ -110,20 +118,30 @@
enum
{
+ BUTTON_NORMAL = 0,
+ BUTTON_PRELIGHT,
+ BUTTON_PRESSED
+};
+
+enum
+{
ACTIVE = 0,
INACTIVE,
+ PRELIGHT,
PRESSED,
T_ACTIVE,
T_INACTIVE,
+ T_PRELIGHT,
T_PRESSED,
STATE_COUNT
};
enum
{
- ANY,
- WINDOW,
- FRAME
+ BUTTON_STATE_NORMAL = 0,
+ BUTTON_STATE_PRELIGHT,
+ BUTTON_STATE_PRESSED,
+ BUTTON_STATE_COUNT
};
enum
@@ -339,7 +357,7 @@
Client *);
Client *myDisplayGetClientFromWindow (DisplayInfo *,
Window,
- int);
+ unsigned short);
void myDisplayAddScreen (DisplayInfo *,
ScreenInfo *);
void myDisplayRemoveScreen (DisplayInfo *,
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/events.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -870,7 +870,7 @@
#endif
replay = FALSE;
- c = myDisplayGetClientFromWindow (display_info, ev->window, ANY);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_WINDOW);
if (c)
{
state = ev->state & MODIFIER_MASK;
@@ -1097,7 +1097,7 @@
}
#endif
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
TRACE ("DestroyNotify for \"%s\" (0x%lx)", c->name, c->window);
@@ -1125,7 +1125,7 @@
return status;
}
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
ScreenInfo *screen_info = c->screen_info;
@@ -1166,7 +1166,7 @@
TRACE ("entering handleMapNotify");
TRACE ("MapNotify on window (0x%lx)", ev->window);
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
TRACE ("MapNotify for \"%s\" (0x%lx)", c->name, c->window);
@@ -1204,7 +1204,7 @@
return status;
}
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
TRACE ("UnmapNotify for \"%s\" (0x%lx)", c->name, c->window);
@@ -1336,11 +1336,11 @@
wc.stack_mode = ev->detail;
wc.border_width = ev->border_width;
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (!c)
{
/* Some app tend or try to manipulate the wm frame to achieve fullscreen mode */
- c = myDisplayGetClientFromWindow (display_info, ev->window, FRAME);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME);
if (c)
{
TRACE ("client %s (0x%lx) is attempting to manipulate its frame!", c->name, c->window);
@@ -1482,7 +1482,8 @@
static Time lastresist = (Time) CurrentTime;
ScreenInfo *screen_info;
Client *c;
- gboolean warp_pointer;
+ int b;
+ gboolean warp_pointer, button;
/* See http://rfc-ref.org/RFC-TEXTS/1013/chapter12.html for details */
@@ -1498,11 +1499,10 @@
TRACE ("EnterNotify on window (0x%lx)", ev->window);
warp_pointer = FALSE;
- c = myDisplayGetClientFromWindow (display_info, ev->window, FRAME);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_BUTTON);
if (c)
{
screen_info = c->screen_info;
-
if (!(screen_info->params->click_to_focus) && clientAcceptFocus (c))
{
TRACE ("EnterNotify window is \"%s\"", c->name);
@@ -1523,7 +1523,26 @@
clientClearDelayedFocus ();
}
}
-
+ if (c == clientGetFocus ())
+ {
+ button = FALSE;
+ for (b = 0; b < BUTTON_COUNT; b++)
+ {
+ if (MYWINDOW_XWINDOW(c->buttons[b]) == ev->window)
+ {
+ c->button_status[b] = BUTTON_STATE_PRELIGHT;
+ button = TRUE;
+ }
+ else
+ {
+ c->button_status[b] = BUTTON_STATE_NORMAL;
+ }
+ }
+ if (button)
+ {
+ frameDraw (c, FALSE);
+ }
+ }
/* No need to process the event any further */
return EVENT_FILTER_REMOVE;
}
@@ -1652,8 +1671,37 @@
static eventFilterStatus
handleLeaveNotify (DisplayInfo *display_info, XCrossingEvent * ev)
{
+ Client *c;
+ int b;
+ gboolean warp_pointer, button;
+
TRACE ("entering handleLeaveNotify");
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_BUTTON);
+ if (c)
+ {
+ button = FALSE;
+ for (b = 0; b < BUTTON_COUNT; b++)
+ {
+ if (c->button_status[b] != BUTTON_STATE_PRESSED)
+ {
+ if (MYWINDOW_XWINDOW(c->buttons[b]) == ev->window)
+ {
+ c->button_status[b] = BUTTON_STATE_NORMAL;
+ button = TRUE;
+ }
+ }
+ }
+ if (button)
+ {
+ frameDraw (c, FALSE);
+ }
+
+ /* No need to process the event any further */
+ return EVENT_FILTER_REMOVE;
+ }
+
+
return EVENT_FILTER_PASS;
}
@@ -1721,7 +1769,7 @@
/* We're not interested in such notifications */
return EVENT_FILTER_PASS;
}
- c = myDisplayGetClientFromWindow (display_info, ev->window, ANY);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_WINDOW);
user_focus = clientGetUserFocus ();
current_focus = clientGetFocus ();
@@ -1817,7 +1865,7 @@
&& ((ev->detail == NotifyNonlinear)
|| (ev->detail == NotifyNonlinearVirtual)))
{
- c = myDisplayGetClientFromWindow (display_info, ev->window, ANY);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_FRAME | SEARCH_WINDOW);
TRACE ("FocusOut on window (0x%lx)", ev->window);
if ((c) && (c == clientGetFocus ()))
{
@@ -1841,7 +1889,7 @@
TRACE ("entering handlePropertyNotify");
status = EVENT_FILTER_PASS;
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
status = EVENT_FILTER_REMOVE;
@@ -2047,7 +2095,7 @@
TRACE ("entering handleClientMessage");
status = EVENT_FILTER_PASS;
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
status = EVENT_FILTER_REMOVE;
@@ -2248,7 +2296,7 @@
TRACE ("entering handleShape");
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if (c)
{
update = FALSE;
@@ -2283,7 +2331,7 @@
TRACE ("entering handleColormapNotify");
- c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
if ((c) && (ev->window == c->window) && (ev->new))
{
if (c == clientGetFocus ())
@@ -2482,12 +2530,12 @@
if ((menu_data != NULL) && (xid != None))
{
ScreenInfo *screen_info = (ScreenInfo *) menu_data;
- c = clientGetFromWindow (screen_info, xid, WINDOW);
+ c = myScreenGetClientFromWindow (screen_info, xid, SEARCH_WINDOW);
}
if (c)
{
- c->button_pressed[MENU_BUTTON] = FALSE;
+ c->button_status[MENU_BUTTON] = BUTTON_STATE_NORMAL;
switch (op)
{
@@ -2579,7 +2627,7 @@
x = px;
y = py;
- c->button_pressed[MENU_BUTTON] = TRUE;
+ c->button_status[MENU_BUTTON] = BUTTON_STATE_PRESSED;
frameDraw (c, FALSE);
y = (gdouble) c->y;
ops = MENU_OP_DELETE | MENU_OP_MINIMIZE_ALL | MENU_OP_WORKSPACES;
@@ -2702,7 +2750,7 @@
Since all button press/release events are catched by the windows frames, there is some
side effect with GTK menu. When a menu is opened, any click on the window frame is not
detected as a click outside the menu, and the menu doesn't close.
- To avoid this (painless but annoying) behaviour, we just setup a no event window that
+ To avoid this (painless but annoying) behavior, we just setup a no event window that
"hides" the events to regular windows.
That might look tricky, but it's very efficient and save plenty of lines of complicated
code.
@@ -2726,7 +2774,7 @@
{
TRACE ("Cannot open menu");
gdk_beep ();
- c->button_pressed[MENU_BUTTON] = FALSE;
+ c->button_status[MENU_BUTTON] = BUTTON_STATE_NORMAL;
frameDraw (c, FALSE);
xfwmWindowDelete (&menu_event_window);
menu_free (menu);
Modified: xfwm4/trunk/src/frame.c
===================================================================
--- xfwm4/trunk/src/frame.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/frame.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -586,6 +586,31 @@
return chr;
}
+static int
+frameGetButtonState (Client *c, int button, int state)
+{
+ ScreenInfo *screen_info;
+
+ if (state == INACTIVE)
+ {
+ return (state);
+ }
+ screen_info = c->screen_info;
+ if ((c->button_status[button] == BUTTON_STATE_PRESSED) &&
+ (screen_info->buttons[button][PRESSED].pixmap))
+ {
+ return (PRESSED);
+ }
+
+ if ((c->button_status[button] == BUTTON_STATE_PRELIGHT) &&
+ (screen_info->buttons[button][PRELIGHT].pixmap))
+ {
+ return (PRELIGHT);
+ }
+
+ return (ACTIVE);
+}
+
static xfwmPixmap *
frameGetPixmap (Client * c, int button, int state)
{
@@ -602,25 +627,25 @@
break;
case SHADE_BUTTON:
if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
- && screen_info->buttons[SHADE_BUTTON][state + 3].pixmap)
+ && screen_info->buttons[SHADE_BUTTON][state + 4].pixmap)
{
- return &screen_info->buttons[SHADE_BUTTON][state + 3];
+ return &screen_info->buttons[SHADE_BUTTON][state + 4];
}
return &screen_info->buttons[SHADE_BUTTON][state];
break;
case STICK_BUTTON:
if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)
- && screen_info->buttons[STICK_BUTTON][state + 3].pixmap)
+ && screen_info->buttons[STICK_BUTTON][state + 4].pixmap)
{
- return &screen_info->buttons[STICK_BUTTON][state + 3];
+ return &screen_info->buttons[STICK_BUTTON][state + 4];
}
return &screen_info->buttons[STICK_BUTTON][state];
break;
case MAXIMIZE_BUTTON:
if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)
- && screen_info->buttons[MAXIMIZE_BUTTON][state + 3].pixmap)
+ && screen_info->buttons[MAXIMIZE_BUTTON][state + 4].pixmap)
{
- return &screen_info->buttons[MAXIMIZE_BUTTON][state + 3];
+ return &screen_info->buttons[MAXIMIZE_BUTTON][state + 4];
}
return &screen_info->buttons[MAXIMIZE_BUTTON][state];
break;
@@ -734,7 +759,7 @@
{
if (xfwmWindowVisible (&c->buttons[i]))
{
- my_pixmap = frameGetPixmap (c, i, c->button_pressed[i] ? PRESSED : state);
+ my_pixmap = frameGetPixmap (c, i, frameGetButtonState (c, i, state));
XShapeCombineMask (display_info->dpy, MYWINDOW_XWINDOW (c->buttons[i]),
ShapeBounding, 0, 0, my_pixmap->mask, ShapeSet);
}
@@ -1001,7 +1026,7 @@
{
if (x + screen_info->buttons[button][state].width + screen_info->params->button_spacing < right)
{
- my_pixmap = frameGetPixmap (c, button, c->button_pressed[button] ? PRESSED : state);
+ my_pixmap = frameGetPixmap (c, button, frameGetButtonState (c, button, state));
if (my_pixmap->pixmap)
{
xfwmWindowSetBG (&c->buttons[button], my_pixmap);
@@ -1036,7 +1061,7 @@
{
if (x - screen_info->buttons[button][state].width - screen_info->params->button_spacing > left)
{
- my_pixmap = frameGetPixmap (c, button, c->button_pressed[button] ? PRESSED : state);
+ my_pixmap = frameGetPixmap (c, button, frameGetButtonState (c, button, state));
if (my_pixmap->pixmap)
{
xfwmWindowSetBG (&c->buttons[button], my_pixmap);
Modified: xfwm4/trunk/src/mywindow.c
===================================================================
--- xfwm4/trunk/src/mywindow.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/mywindow.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -77,14 +77,27 @@
void
xfwmWindowCreate (ScreenInfo * screen_info, Visual *visual, gint depth, Window parent,
- xfwmWindow * win, Cursor cursor)
+ xfwmWindow * win, long eventmask, Cursor cursor)
{
+ XSetWindowAttributes attributes;
+ unsigned long valuemask;
+
TRACE ("entering xfwmWindowCreate");
g_return_if_fail (screen_info != NULL);
- win->window = XCreateSimpleWindow (myScreenGetXDisplay (screen_info),
- parent, 0, 0, 1, 1, 0, 0, 0);
+ attributes.event_mask = eventmask;
+ valuemask = 0L;
+ if (eventmask != NoEventMask)
+ {
+ valuemask |= CWEventMask;
+ }
+
+ win->window = XCreateWindow (myScreenGetXDisplay (screen_info),
+ parent, 0, 0, 1, 1, 0, 0,
+ InputOutput, CopyFromParent,
+ valuemask, &attributes);
+
TRACE ("Created XID 0x%lx", win->window);
if (cursor != None)
{
@@ -226,7 +239,6 @@
InputOnly, CopyFromParent,
CWEventMask | CWOverrideRedirect,
&attributes);
- XMapWindow (myScreenGetXDisplay (screen_info), win->window);
if (bottom)
{
XLowerWindow (myScreenGetXDisplay (screen_info), win->window);
@@ -235,6 +247,7 @@
{
XRaiseWindow (myScreenGetXDisplay (screen_info), win->window);
}
+ XMapWindow (myScreenGetXDisplay (screen_info), win->window);
XFlush (myScreenGetXDisplay (screen_info));
win->map = TRUE;
Modified: xfwm4/trunk/src/mywindow.h
===================================================================
--- xfwm4/trunk/src/mywindow.h 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/mywindow.h 2007-06-11 21:53:45 UTC (rev 25801)
@@ -58,6 +58,7 @@
gint,
Window,
xfwmWindow *,
+ long,
Cursor);
void xfwmWindowTemp (ScreenInfo *,
Visual *,
Modified: xfwm4/trunk/src/screen.c
===================================================================
--- xfwm4/trunk/src/screen.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/screen.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -487,3 +487,24 @@
ungrabKeys (dpy, screen_info->xroot);
}
+Client *
+myScreenGetClientFromWindow (ScreenInfo *screen_info, Window w, unsigned short mode)
+{
+ Client *c;
+ int i, j;
+
+ g_return_val_if_fail (w != None, NULL);
+ TRACE ("entering myScreenGetClientFromWindow");
+ TRACE ("looking for (0x%lx)", w);
+
+ for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
+ {
+ if (clientGetFromWindow (c, w, mode))
+ {
+ return (c);
+ }
+ }
+ TRACE ("no client found");
+
+ return NULL;
+}
Modified: xfwm4/trunk/src/screen.h
===================================================================
--- xfwm4/trunk/src/screen.h 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/screen.h 2007-06-11 21:53:45 UTC (rev 25801)
@@ -173,5 +173,8 @@
unsigned int myScreenUngrabPointer (ScreenInfo *);
void myScreenGrabKeys (ScreenInfo *);
void myScreenUngrabKeys (ScreenInfo *);
+Client *myScreenGetClientFromWindow (ScreenInfo *,
+ Window,
+ unsigned short);
#endif /* INC_SCREEN_H */
Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/settings.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -1136,54 +1136,72 @@
"hide-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[HIDE_BUTTON][PRESSED], theme,
"hide-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[HIDE_BUTTON][PRELIGHT], theme,
+ "hide-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][ACTIVE], theme,
"close-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][INACTIVE], theme,
"close-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][PRESSED], theme,
"close-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[CLOSE_BUTTON][PRELIGHT], theme,
+ "close-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][ACTIVE], theme,
"maximize-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][INACTIVE], theme,
"maximize-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][PRESSED], theme,
"maximize-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][PRELIGHT], theme,
+ "maximize-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][ACTIVE], theme,
"shade-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][INACTIVE], theme,
"shade-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][PRESSED], theme,
"shade-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][PRELIGHT], theme,
+ "shade-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][ACTIVE], theme,
"stick-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][INACTIVE], theme,
"stick-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][PRESSED], theme,
"stick-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][PRELIGHT], theme,
+ "stick-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][ACTIVE], theme,
"menu-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][INACTIVE], theme,
"menu-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][PRESSED], theme,
"menu-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[MENU_BUTTON][PRELIGHT], theme,
+ "menu-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_ACTIVE], theme,
"shade-toggled-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_INACTIVE], theme,
"shade-toggled-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_PRESSED], theme,
"shade-toggled-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[SHADE_BUTTON][T_PRELIGHT], theme,
+ "shade-toggled-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_ACTIVE], theme,
"stick-toggled-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_INACTIVE], theme,
"stick-toggled-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_PRESSED], theme,
"stick-toggled-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[STICK_BUTTON][T_PRELIGHT], theme,
+ "stick-toggled-prelight", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_ACTIVE], theme,
"maximize-toggled-active", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_INACTIVE], theme,
"maximize-toggled-inactive", colsym);
xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_PRESSED], theme,
"maximize-toggled-pressed", colsym);
+ xfwmPixmapLoad (screen_info, &screen_info->buttons[MAXIMIZE_BUTTON][T_PRELIGHT], theme,
+ "maximize-toggled-prelight", colsym);
for (i = 0; i < TITLE_COUNT; i++)
{
Modified: xfwm4/trunk/src/stacking.c
===================================================================
--- xfwm4/trunk/src/stacking.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/stacking.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -334,7 +334,7 @@
/* Search for the window that will be just on top of the raised window */
if (wsibling)
{
- c2 = myDisplayGetClientFromWindow (display_info, wsibling, ANY);
+ c2 = myDisplayGetClientFromWindow (display_info, wsibling, SEARCH_FRAME | SEARCH_WINDOW);
if (c2)
{
sibling = g_list_find (screen_info->windows_stack, (gconstpointer) c2);
@@ -481,7 +481,7 @@
}
else if (wsibling)
{
- c2 = myDisplayGetClientFromWindow (display_info, wsibling, ANY);
+ c2 = myDisplayGetClientFromWindow (display_info, wsibling, SEARCH_FRAME | SEARCH_WINDOW);
if (c2)
{
sibling = g_list_find (screen_info->windows_stack, (gconstpointer) c2);
Modified: xfwm4/trunk/src/transients.c
===================================================================
--- xfwm4/trunk/src/transients.c 2007-06-11 21:17:58 UTC (rev 25800)
+++ xfwm4/trunk/src/transients.c 2007-06-11 21:53:45 UTC (rev 25801)
@@ -39,7 +39,7 @@
if ((c->transient_for) && (c->transient_for != c->screen_info->xroot))
{
- return clientGetFromWindow (c->screen_info, c->transient_for, WINDOW);
+ return myScreenGetClientFromWindow (c->screen_info, c->transient_for, SEARCH_WINDOW);
}
return NULL;
}
More information about the Xfce4-commits
mailing list