Newer
Older
* to withdrawn state by mistake.
*/
TRACE ("Client \"%s\" is not mapped, event ignored", c->name);
/*
* ICCCM spec states that a client wishing to switch
* to WithdrawnState should send a synthetic UnmapNotify
* with the event field set to root if the client window
* is already unmapped.
* Therefore, bypass the ignore_unmap counter and
* unframe the client.
*/
Olivier Fourdan
committed
if ((ev->event == screen_info->xroot) && (ev->send_event))
{
TRACE ("ICCCM UnmapNotify for \"%s\"", c->name);
clientUnframe (c, FALSE);
return;
}
if (c->ignore_unmap)
{
c->ignore_unmap--;
Olivier Fourdan
committed
TRACE ("ignore_unmap for \"%s\" is now %i",
c->name, c->ignore_unmap);
}
else
{
TRACE ("unmapping \"%s\" as ignore_unmap is %i",
c->name, c->ignore_unmap);
clientUnframe (c, FALSE);
handleConfigureNotify (DisplayInfo *display_info, XConfigureEvent * ev)
screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
if (!screen_info)
{
return;
}
if (ev->window == screen_info->xroot)
TRACE ("ConfigureNotify on the screen_info->xroot win (0x%lx)", ev->window);
#ifdef HAVE_RANDR
XRRUpdateConfiguration (ev);
#else
screen_info->xscreen->width = ev->width;
screen_info->xscreen->height = ev->height;
placeSidewalks (screen_info, screen_info->params->wrap_workspaces);
clientScreenResize (screen_info);
handleConfigureRequest (DisplayInfo *display_info, XConfigureRequestEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
TRACE ("entering handleConfigureRequest");
TRACE ("ConfigureRequest on window (0x%lx)", ev->window);
while (XCheckTypedWindowEvent (display_info->dpy, ev->window, ConfigureRequest, &otherEvent))
if (otherEvent.xconfigurerequest.value_mask == ev->value_mask)
{
ev = &otherEvent.xconfigurerequest;
}
else
{
XPutBackEvent (display_info->dpy, &otherEvent);
wc.x = ev->x;
wc.y = ev->y;
wc.width = ev->width;
wc.height = ev->height;
wc.sibling = ev->above;
wc.stack_mode = ev->detail;
wc.border_width = ev->border_width;
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
if (!c)
{
/* Some app tend or try to manipulate the wm frame to achieve fullscreen mode */
c = myDisplayGetClientFromWindow (display_info, ev->window, FRAME);
TRACE ("client %s (0x%lx) is attempting to manipulate its frame!", c->name, c->window);
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
if (ev->value_mask & CWX)
{
wc.x += frameLeft (c);
}
if (ev->value_mask & CWY)
{
wc.y += frameTop (c);
}
if (ev->value_mask & CWWidth)
{
wc.width -= frameLeft (c) + frameRight (c);
}
if (ev->value_mask & CWHeight)
{
wc.height -= frameTop (c) + frameBottom (c);
}
/* We don't allow changing stacking order by accessing the frame
window because that would break the layer management in xfwm4
*/
ev->value_mask &= ~(CWSibling | CWStackMode);
}
}
if (c)
{
gboolean constrained = FALSE;
TRACE ("handleConfigureRequest managed window \"%s\" (0x%lx)", c->name, c->window);
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING))
{
/* Sorry, but it's not the right time for configure request */
return;
}
if (c->type == WINDOW_DESKTOP)
{
/* Ignore stacking request for DESKTOP windows */
ev->value_mask &= ~(CWSibling | CWStackMode);
}
clientCoordGravitate (c, APPLY, &wc.x, &wc.y);
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
Olivier Fourdan
committed
GdkRectangle rect;
gint monitor_nbr;
int cx, cy;
/* size request from fullscreen windows get fullscreen */
cx = frameX (c) + (frameWidth (c) / 2);
cy = frameY (c) + (frameHeight (c) / 2);
monitor_nbr = gdk_screen_get_monitor_at_point (screen_info->gscr, cx, cy);
gdk_screen_get_monitor_geometry (screen_info->gscr, monitor_nbr, &rect);
Olivier Fourdan
committed
wc.x = rect.x;
wc.y = rect.y;
wc.width = rect.width;
wc.height = rect.height;
/* Clean up buggy requests that set all flags */
if ((ev->value_mask & CWX) && (wc.x == c->x))
{
ev->value_mask &= ~CWX;
}
if ((ev->value_mask & CWY) && (wc.y == c->y))
{
ev->value_mask &= ~CWY;
}
if ((ev->value_mask & CWWidth) && (wc.width == c->width))
{
ev->value_mask &= ~CWWidth;
}
if ((ev->value_mask & CWHeight) && (wc.height == c->height))
{
ev->value_mask &= ~CWHeight;
}
/* Still a move/resize after cleanup? */
if (ev->value_mask & (CWX | CWY | CWWidth | CWHeight))
{
if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
{
clientRemoveMaximizeFlag (c);
}
constrained = TRUE;
}
if (ev->value_mask & CWStackMode)
{
Olivier Fourdan
committed
clientPassGrabButton1 (NULL);
}
Olivier Fourdan
committed
#if 0
/* Let's say that if the client performs a XRaiseWindow, we show the window if hidden */
if ((ev->value_mask & CWStackMode) && (wc.stack_mode == Above))
{
if ((c->win_workspace == screen_info->current_ws) ||
(FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)))
if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
{
clientShow (c, TRUE);
}
}
}
Olivier Fourdan
committed
#endif
clientConfigure (c, &wc, ev->value_mask, (constrained ? CFG_CONSTRAINED : 0) | CFG_REQUEST);
TRACE ("unmanaged configure request for win 0x%lx", ev->window);
XConfigureWindow (display_info->dpy, ev->window, ev->value_mask, &wc);
handleEnterNotify (DisplayInfo *display_info, XCrossingEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
TRACE ("entering handleEnterNotify");
if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab)
|| (ev->detail > NotifyNonlinearVirtual))
/* We're not interested in such notifications */
return;
TRACE ("EnterNotify on window (0x%lx)", ev->window);
c = myDisplayGetClientFromWindow (display_info, ev->window, FRAME);
if (c)
screen_info = c->screen_info;
if (!(screen_info->params->click_to_focus) && clientAcceptFocus (c))
TRACE ("EnterNotify window is \"%s\"", c->name);
if (!(c->type & (WINDOW_DOCK | WINDOW_DESKTOP)))
Olivier Fourdan
committed
{
clientSetFocus (c->screen_info, c, ev->time, FOCUS_FORCE);
if (!(screen_info->params->raise_on_click))
{
clientPassGrabButton1 (c);
}
Olivier Fourdan
committed
}
handleLeaveNotify (DisplayInfo *display_info, XCrossingEvent * ev)
Olivier Fourdan
committed
{
TRACE ("entering handleLeaveNotify");
Olivier Fourdan
committed
Olivier Fourdan
committed
if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab)
|| (ev->detail > NotifyNonlinearVirtual))
{
/* We're not interested in such notifications */
return;
}
screen_info = myDisplayGetScreenFromRoot (display_info, ev->root);
if (!screen_info)
{
return;
}
if ((ev->window == MYWINDOW_XWINDOW (screen_info->sidewalk[0])) ||
(ev->window == MYWINDOW_XWINDOW (screen_info->sidewalk[1])))
Olivier Fourdan
committed
{
TRACE ("Reset edge_scroll_x");
edge_scroll_x = 0;
}
Olivier Fourdan
committed
}
handleFocusIn (DisplayInfo *display_info, XFocusChangeEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
TRACE ("entering handleFocusIn");
Olivier Fourdan
committed
TRACE ("handleFocusIn (0x%lx) mode = %s",
ev->window,
(ev->mode == NotifyNormal) ?
"NotifyNormal" :
(ev->mode == NotifyWhileGrabbed) ?
"NotifyWhileGrabbed" :
"(unknown)");
Olivier Fourdan
committed
TRACE ("handleFocusIn (0x%lx) detail = %s",
ev->window,
(ev->detail == NotifyAncestor) ?
"NotifyAncestor" :
(ev->detail == NotifyVirtual) ?
"NotifyVirtual" :
(ev->detail == NotifyInferior) ?
"NotifyInferior" :
(ev->detail == NotifyNonlinear) ?
"NotifyNonlinear" :
(ev->detail == NotifyNonlinearVirtual) ?
"NotifyNonlinearVirtual" :
(ev->detail == NotifyPointer) ?
"NotifyPointer" :
(ev->detail == NotifyPointerRoot) ?
"NotifyPointerRoot" :
(ev->detail == NotifyDetailNone) ?
"NotifyDetailNone" :
"(unknown)");
screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
if (screen_info && (ev->window == screen_info->xroot) && (ev->mode == NotifyNormal) &&
Olivier Fourdan
committed
(ev->detail == NotifyDetailNone))
{
/* Handle focus transition to root (means that an unknown
window has vanished and the focus is returned to the root
Olivier Fourdan
committed
*/
c = clientGetFocus ();
if (c)
{
clientSetFocus (c->screen_info, c, GDK_CURRENT_TIME, FOCUS_FORCE);
Olivier Fourdan
committed
}
return;
}
if ((ev->mode == NotifyGrab) || (ev->mode == NotifyUngrab) ||
Olivier Fourdan
committed
(ev->detail > NotifyNonlinearVirtual))
{
/* We're not interested in such notifications */
return;
}
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
TRACE ("FocusIn on window (0x%lx)", ev->window);
TRACE ("focus set to \"%s\" (0x%lx)", c->name, c->window);
clientUpdateFocus (screen_info, c, FOCUS_SORT);
if (screen_info->params->raise_on_focus && !screen_info->params->click_to_focus)
handleFocusOut (DisplayInfo *display_info, XFocusChangeEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
Olivier Fourdan
committed
TRACE ("entering handleFocusOut");
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
TRACE ("handleFocusOut (0x%lx) mode = %s",
ev->window,
(ev->mode == NotifyNormal) ?
"NotifyNormal" :
(ev->mode == NotifyWhileGrabbed) ?
"NotifyWhileGrabbed" :
"(unknown)");
TRACE ("handleFocusOut (0x%lx) detail = %s",
ev->window,
(ev->detail == NotifyAncestor) ?
"NotifyAncestor" :
(ev->detail == NotifyVirtual) ?
"NotifyVirtual" :
(ev->detail == NotifyInferior) ?
"NotifyInferior" :
(ev->detail == NotifyNonlinear) ?
"NotifyNonlinear" :
(ev->detail == NotifyNonlinearVirtual) ?
"NotifyNonlinearVirtual" :
(ev->detail == NotifyPointer) ?
"NotifyPointer" :
(ev->detail == NotifyPointerRoot) ?
"NotifyPointerRoot" :
(ev->detail == NotifyDetailNone) ?
"NotifyDetailNone" :
"(unknown)");
if ((ev->mode == NotifyNormal)
&& ((ev->detail == NotifyNonlinear)
|| (ev->detail == NotifyNonlinearVirtual)))
Olivier Fourdan
committed
{
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
TRACE ("FocusOut on window (0x%lx)", ev->window);
Olivier Fourdan
committed
if ((c) && (c == clientGetFocus ()))
{
TRACE ("focus lost from \"%s\" (0x%lx)", c->name, c->window);
clientUpdateFocus (c->screen_info, NULL, NO_FOCUS_FLAG);
Olivier Fourdan
committed
clientPassGrabButton1 (NULL);
/* Clear timeout */
clear_timeout ();
}
Olivier Fourdan
committed
}
handlePropertyNotify (DisplayInfo *display_info, XPropertyEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
Window w = None;
char *names;
int length;
TRACE ("entering handlePropertyNotify");
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
if (c)
{
if (ev->atom == XA_WM_NORMAL_HINTS)
{
TRACE ("client \"%s\" (0x%lx) has received a XA_WM_NORMAL_HINTS notify", c->name, c->window);
}
else if ((ev->atom == XA_WM_NAME) || (ev->atom == net_wm_name))
{
Benedikt Meurer
committed
TRACE ("client \"%s\" (0x%lx) has received a XA_WM_NAME notify", c->name, c->window);
if (c->name)
{
free (c->name);
}
getWindowName (display_info->dpy, c->window, &c->name);
FLAG_SET (c->flags, CLIENT_FLAG_NAME_CHANGED);
frameDraw (c, TRUE, FALSE);
}
else if (ev->atom == motif_wm_hints)
{
TRACE ("client \"%s\" (0x%lx) has received a motif_wm_hints notify", c->name, c->window);
}
else if (ev->atom == XA_WM_HINTS)
{
TRACE ("client \"%s\" (0x%lx) has received a XA_WM_HINTS notify", c->name, c->window);
c->wmhints = XGetWMHints (display_info->dpy, c->window);
if (c->wmhints)
{
if (c->wmhints->flags & WindowGroupHint)
{
c->group_leader = c->wmhints->window_group;
}
TRACE ("client \"%s\" (0x%lx) has received a wm_protocols notify", c->name, c->window);
else if (ev->atom == wm_transient_for)
{
TRACE ("client \"%s\" (0x%lx) has received a wm_transient_for notify", c->name, c->window);
getTransientFor (display_info->dpy, c->screen_info->screen, c->window, &w);
if (clientCheckTransientWindow (c, w))
{
c->transient_for = w;
clientRaise (c);
}
}
else if (ev->atom == win_hints)
{
TRACE ("client \"%s\" (0x%lx) has received a win_hints notify", c->name, c->window);
getHint (display_info->dpy, c->window, win_hints, &c->win_hints);
}
else if (ev->atom == net_wm_window_type)
{
TRACE ("client \"%s\" (0x%lx) has received a net_wm_window_type notify", c->name, c->window);
clientGetNetWmType (c);
frameDraw (c, TRUE, FALSE);
}
else if ((ev->atom == net_wm_strut) || (ev->atom == net_wm_strut_partial))
TRACE ("client \"%s\" (0x%lx) has received a net_wm_strut notify", c->name, c->window);
clientGetNetStruts (c);
}
else if (ev->atom == wm_colormap_windows)
{
clientUpdateColormaps (c);
if (c == clientGetFocus ())
{
clientInstallColormaps (c);
}
}
Olivier Fourdan
committed
else if (ev->atom == net_wm_user_time)
{
if (getNetWMUserTime (display_info->dpy, c->window, &c->user_time))
Olivier Fourdan
committed
{
Olivier Fourdan
committed
FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);
Olivier Fourdan
committed
}
Olivier Fourdan
committed
}
#ifdef HAVE_STARTUP_NOTIFICATION
else if (ev->atom == net_startup_id)
{
if (c->startup_id)
{
free (c->startup_id);
c->startup_id = NULL;
}
getWindowStartupId (display_info->dpy, c->window, &c->startup_id);
#endif
return;
}
screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
if (!screen_info)
{
return;
{
TRACE ("root has received a net_desktop_names notify");
if (getUTF8String (display_info->dpy, screen_info->xroot, net_desktop_names, &names, &length))
{
workspaceSetNames (screen_info, names, length);
}
}
else if (ev->atom == gnome_panel_desktop_area)
TRACE ("root has received a gnome_panel_desktop_area notify");
getGnomeDesktopMargins (display_info->dpy, screen_info->screen, screen_info->gnome_margins);
workspaceUpdateArea (screen_info);
handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
TRACE ("entering handleClientMessage");
/* Don't get surprised with the multiple "if (!clientIsTransientOrModal(c))" tests
xfwm4 really treats transient differently
*/
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
if (c)
{
screen_info = c->screen_info;
if ((ev->message_type == wm_change_state) && (ev->format == 32) && (ev->data.l[0] == IconicState))
TRACE ("client \"%s\" (0x%lx) has received a wm_change_state event", c->name, c->window);
if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED) &&
CLIENT_CAN_HIDE_WINDOW (c))
{
clientHide (c, c->win_workspace, TRUE);
}
}
else if ((ev->message_type == win_state) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a win_state event", c->name, c->window);
clientUpdateWinState (c, ev);
}
else if ((ev->message_type == win_layer) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a win_layer event", c->name, c->window);
if ((ev->data.l[0] != c->win_layer) && !clientIsTransientOrModal (c))
{
clientSetLayer (c, ev->data.l[0]);
}
}
else if ((ev->message_type == win_workspace) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a win_workspace event", c->name, c->window);
if ((ev->data.l[0] != c->win_workspace) && !clientIsTransientOrModal (c))
{
clientSetWorkspace (c, ev->data.l[0], TRUE);
}
}
else if ((ev->message_type == net_wm_desktop) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a net_wm_desktop event", c->name, c->window);
{
if (ev->data.l[0] == ALL_WORKSPACES)
{
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK)
&& !FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
{
clientStick (c, TRUE);
frameDraw (c, FALSE, FALSE);
}
}
else
{
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK)
&& FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
{
clientUnstick (c, TRUE);
frameDraw (c, FALSE, FALSE);
}
if (ev->data.l[0] != c->win_workspace)
{
clientSetWorkspace (c, ev->data.l[0], TRUE);
}
}
}
}
else if ((ev->message_type == net_close_window) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a net_close_window event", c->name, c->window);
clientClose (c);
}
else if ((ev->message_type == net_wm_state) && (ev->format == 32))
{
TRACE ("client \"%s\" (0x%lx) has received a net_wm_state event", c->name, c->window);
clientUpdateNetState (c, ev);
}
else if ((ev->message_type == net_wm_moveresize) && (ev->format == 32))
TRACE ("client \"%s\" (0x%lx) has received a net_wm_moveresize event", c->name, c->window);
g_message (_("%s: Operation not supported (yet)\n"), g_get_prgname ());
else if ((ev->message_type == net_active_window) && (ev->format == 32))
TRACE ("client \"%s\" (0x%lx) has received a net_active_window event", c->name, c->window);
clientSetWorkspace (c, screen_info->current_ws, TRUE);
clientShow (c, TRUE);
clientRaise (c);
clientSetFocus (screen_info, c, GDK_CURRENT_TIME, NO_FOCUS_FLAG);
screen_info = myDisplayGetScreenFromWindow (display_info, ev->window);
if (!screen_info)
{
return;
}
if (((ev->message_type == win_workspace) || (ev->message_type == net_current_desktop)) && (ev->format == 32))
TRACE ("root has received a win_workspace or a net_current_desktop event");
if (ev->data.l[0] != screen_info->current_ws)
workspaceSwitch (screen_info, ev->data.l[0], NULL);
else if (((ev->message_type == win_workspace_count) || (ev->message_type == net_number_of_desktops)) && (ev->format == 32))
{
TRACE ("root has received a win_workspace_count event");
if (ev->data.l[0] != screen_info->workspace_count)
workspaceSetCount (screen_info, ev->data.l[0]);
else if ((ev->message_type == net_system_tray_manager) && (ev->data.l[1] == screen_info->net_system_tray_selection) && (ev->format == 32))
{
TRACE ("root has received a net_system_tray_manager event");
screen_info->systray = getSystrayWindow (display_info->dpy,
screen_info->net_system_tray_selection);
else if ((ev->message_type == net_showing_desktop) && (ev->format == 32))
{
TRACE ("root has received a net_showing_desktop event");
clientToggleShowDesktop (screen_info, ev->data.l[0]);
setHint (display_info->dpy, screen_info->xroot, net_showing_desktop, ev->data.l[0]);
TRACE ("unidentified client message for window 0x%lx", ev->window);
handleShape (DisplayInfo *display_info, XShapeEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
TRACE ("entering handleShape");
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
frameDraw (c, FALSE, TRUE);
handleColormapNotify (DisplayInfo *display_info, XColormapEvent * ev)
Olivier Fourdan
committed
Client *c = NULL;
Olivier Fourdan
committed
TRACE ("entering handleColormapNotify");
Olivier Fourdan
committed
c = myDisplayGetClientFromWindow (display_info, ev->window, WINDOW);
if ((c) && (ev->window == c->window) && (ev->new))
if (c == clientGetFocus ())
{
clientInstallColormaps (c);
}
static void
handleEvent (DisplayInfo *display_info, XEvent * ev)
TRACE ("entering handleEvent");
sn_process_event (ev);
case MotionNotify:
handleMotionNotify (display_info, (XMotionEvent *) ev);
break;
case KeyPress:
handleKeyPress (display_info, (XKeyEvent *) ev);
break;
case ButtonPress:
handleButtonPress (display_info, (XButtonEvent *) ev);
break;
case ButtonRelease:
handleButtonRelease (display_info, (XButtonEvent *) ev);
break;
case DestroyNotify:
handleDestroyNotify (display_info, (XDestroyWindowEvent *) ev);
break;
case UnmapNotify:
handleUnmapNotify (display_info, (XUnmapEvent *) ev);
break;
case MapRequest:
handleMapRequest (display_info, (XMapRequestEvent *) ev);
handleMapNotify (display_info, (XMapEvent *) ev);
handleConfigureNotify (display_info, (XConfigureEvent *) ev);
case ConfigureRequest:
handleConfigureRequest (display_info, (XConfigureRequestEvent *) ev);
break;
case EnterNotify:
handleEnterNotify (display_info, (XCrossingEvent *) ev);
break;
case LeaveNotify:
handleLeaveNotify (display_info, (XCrossingEvent *) ev);
break;
case FocusIn:
handleFocusIn (display_info, (XFocusChangeEvent *) ev);
break;
case FocusOut:
handleFocusOut (display_info, (XFocusChangeEvent *) ev);
break;
case PropertyNotify:
handlePropertyNotify (display_info, (XPropertyEvent *) ev);
break;
case ClientMessage:
handleClientMessage (display_info, (XClientMessageEvent *) ev);
break;
case ColormapNotify:
handleColormapNotify (display_info, (XColormapEvent *) ev);
break;
default:
if (display_info->shape && (ev->type == display_info->shape_event))
handleShape (display_info, (XShapeEvent *) ev);
if (!gdk_events_pending () && !XPending (display_info->dpy))
if (xfwm4_reload)
xfwm4_reload = FALSE;
else if (xfwm4_quit)
{
gtk_main_quit ();
}
Olivier Fourdan
committed
XfceFilterStatus
xfwm4_event_filter (XEvent * xevent, gpointer data)
DisplayInfo *display_info = (DisplayInfo *) data;
TRACE ("entering xfwm4_event_filter");
TRACE ("leaving xfwm4_event_filter");
/* GTK specific stuff */
menu_callback (Menu * menu, MenuOp op, Window client_xwindow, gpointer menu_data, gpointer item_data)
Olivier Fourdan
committed
TRACE ("entering menu_callback");
if (menu_data)
c = (Client *) menu_data;
if (!c)
{
menu_free (menu);
return;
}
c->button_pressed[MENU_BUTTON] = FALSE;
Olivier Fourdan
committed
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
case MENU_OP_QUIT:
gtk_main_quit ();
break;
case MENU_OP_MAXIMIZE:
case MENU_OP_UNMAXIMIZE:
if (CLIENT_CAN_MAXIMIZE_WINDOW (c))
{
clientToggleMaximized (c, WIN_STATE_MAXIMIZED);
}
break;
case MENU_OP_MINIMIZE:
if (CLIENT_CAN_HIDE_WINDOW (c))
{
clientHide (c, c->win_workspace, TRUE);
}
frameDraw (c, FALSE, FALSE);
break;
case MENU_OP_MINIMIZE_ALL:
clientHideAll (c, c->win_workspace);
frameDraw (c, FALSE, FALSE);
break;
case MENU_OP_UNMINIMIZE:
clientShow (c, TRUE);
break;
case MENU_OP_SHADE:
case MENU_OP_UNSHADE:
clientToggleShaded (c);
break;
case MENU_OP_STICK:
case MENU_OP_UNSTICK:
clientToggleSticky (c, TRUE);
frameDraw (c, FALSE, FALSE);
break;
case MENU_OP_WORKSPACES:
clientSetWorkspace (c, GPOINTER_TO_INT (item_data), TRUE);
frameDraw (c, FALSE, FALSE);
break;
case MENU_OP_DELETE:
frameDraw (c, FALSE, FALSE);
clientClose (c);
break;
Olivier Fourdan
committed
case MENU_OP_CONTEXT_HELP:
clientEnterContextMenuState (c);
frameDraw (c, FALSE, FALSE);
break;
case MENU_OP_ABOVE:
case MENU_OP_NORMAL:
clientToggleAbove (c);
/* Fall thru */
default:
frameDraw (c, FALSE, FALSE);
break;
}
menu_free (menu);
void
initMenuEventWin (void)
{
}
static gboolean
show_popup_cb (GtkWidget * widget, GdkEventButton * ev, gpointer data)
ScreenInfo *screen_info = NULL;
DisplayInfo *display_info = NULL;
Olivier Fourdan
committed
Menu *menu;
MenuOp ops;
MenuOp insensitive;
Olivier Fourdan
committed
gint x = ev->x_root;
gint y = ev->y_root;
TRACE ("entering show_popup_cb");
if ((c) && ((ev->button == 1) || (ev->button == 3)))
c->button_pressed[MENU_BUTTON] = TRUE;
frameDraw (c, FALSE, FALSE);
y = c->y;
ops = MENU_OP_DELETE | MENU_OP_MINIMIZE_ALL | MENU_OP_WORKSPACES;
insensitive = 0;
if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_CLOSE))
{
insensitive |= MENU_OP_DELETE;
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
{
ops |= MENU_OP_UNMAXIMIZE;
if (!CLIENT_CAN_MAXIMIZE_WINDOW (c))
{
insensitive |= MENU_OP_UNMAXIMIZE;
}
}
else
{
ops |= MENU_OP_MAXIMIZE;
if (!CLIENT_CAN_MAXIMIZE_WINDOW (c))
{
insensitive |= MENU_OP_MAXIMIZE;
}
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
{
ops |= MENU_OP_UNMINIMIZE;
if (!CLIENT_CAN_HIDE_WINDOW (c))
{
insensitive |= MENU_OP_UNMINIMIZE;
}
}
else
{
ops |= MENU_OP_MINIMIZE;
if (!CLIENT_CAN_HIDE_WINDOW (c))
{
insensitive |= MENU_OP_MINIMIZE;
}
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
{
ops |= MENU_OP_UNSHADE;
}
else
{
ops |= MENU_OP_SHADE;
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
{
ops |= MENU_OP_UNSTICK;
if (!CLIENT_CAN_STICK_WINDOW(c))
{
insensitive |= MENU_OP_UNSTICK;
}
}
else
{
ops |= MENU_OP_STICK;
if (!CLIENT_CAN_STICK_WINDOW(c))
{
insensitive |= MENU_OP_STICK;
}
}
Olivier Fourdan
committed
/* KDE extension */
clientGetWMProtocols(c);
if (FLAG_TEST (c->wm_flags, WM_FLAG_CONTEXT_HELP))
{
ops |= MENU_OP_CONTEXT_HELP;
}
if (FLAG_TEST(c->flags, CLIENT_FLAG_ABOVE))
{
ops |= MENU_OP_NORMAL;
if (clientIsTransientOrModal (c) ||
FLAG_TEST (c->flags, CLIENT_FLAG_BELOW | CLIENT_FLAG_FULLSCREEN))
{
insensitive |= MENU_OP_NORMAL;
}
}
else
{
ops |= MENU_OP_ABOVE;
if (clientIsTransientOrModal (c) ||
FLAG_TEST (c->flags, CLIENT_FLAG_BELOW | CLIENT_FLAG_FULLSCREEN))
{
insensitive |= MENU_OP_ABOVE;