mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
set _NET_ACTIVE_WINDOW hint
2001-10-07 Havoc Pennington <hp@pobox.com> * src/display.c (meta_display_update_active_window_hint): set _NET_ACTIVE_WINDOW hint * src/window.c (meta_window_client_message): support _NET_ACTIVE_WINDOW client message
This commit is contained in:
parent
ec4dfd0cbc
commit
f22b9dfd94
@ -1,3 +1,11 @@
|
|||||||
|
2001-10-07 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
|
* src/display.c (meta_display_update_active_window_hint):
|
||||||
|
set _NET_ACTIVE_WINDOW hint
|
||||||
|
|
||||||
|
* src/window.c (meta_window_client_message): support
|
||||||
|
_NET_ACTIVE_WINDOW client message
|
||||||
|
|
||||||
2001-10-07 Havoc Pennington <hp@pobox.com>
|
2001-10-07 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/window.c (meta_window_client_message): don't allow
|
* src/window.c (meta_window_client_message): don't allow
|
||||||
|
@ -135,7 +135,8 @@ meta_display_open (const char *name)
|
|||||||
"UTF8_STRING",
|
"UTF8_STRING",
|
||||||
"WM_ICON_SIZE",
|
"WM_ICON_SIZE",
|
||||||
"_KWM_WIN_ICON",
|
"_KWM_WIN_ICON",
|
||||||
"_NET_WM_MOVERESIZE"
|
"_NET_WM_MOVERESIZE",
|
||||||
|
"_NET_ACTIVE_WINDOW"
|
||||||
};
|
};
|
||||||
Atom atoms[G_N_ELEMENTS(atom_names)];
|
Atom atoms[G_N_ELEMENTS(atom_names)];
|
||||||
|
|
||||||
@ -222,6 +223,7 @@ meta_display_open (const char *name)
|
|||||||
display->atom_wm_icon_size = atoms[40];
|
display->atom_wm_icon_size = atoms[40];
|
||||||
display->atom_kwm_win_icon = atoms[41];
|
display->atom_kwm_win_icon = atoms[41];
|
||||||
display->atom_net_wm_moveresize = atoms[42];
|
display->atom_net_wm_moveresize = atoms[42];
|
||||||
|
display->atom_net_active_window = atoms[43];
|
||||||
|
|
||||||
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
|
||||||
* created in screen_new
|
* created in screen_new
|
||||||
@ -905,27 +907,29 @@ event_callback (XEvent *event,
|
|||||||
screen = meta_display_screen_for_root (display,
|
screen = meta_display_screen_for_root (display,
|
||||||
event->xclient.window);
|
event->xclient.window);
|
||||||
|
|
||||||
if (screen &&
|
if (screen)
|
||||||
event->xclient.message_type ==
|
|
||||||
display->atom_net_current_desktop)
|
|
||||||
{
|
{
|
||||||
int space;
|
if (event->xclient.message_type ==
|
||||||
MetaWorkspace *workspace;
|
display->atom_net_current_desktop)
|
||||||
|
{
|
||||||
|
int space;
|
||||||
|
MetaWorkspace *workspace;
|
||||||
|
|
||||||
space = event->xclient.data.l[0];
|
space = event->xclient.data.l[0];
|
||||||
|
|
||||||
meta_verbose ("Request to change current workspace to %d\n",
|
meta_verbose ("Request to change current workspace to %d\n",
|
||||||
space);
|
space);
|
||||||
|
|
||||||
workspace =
|
workspace =
|
||||||
meta_display_get_workspace_by_screen_index (display,
|
meta_display_get_workspace_by_screen_index (display,
|
||||||
screen,
|
screen,
|
||||||
space);
|
space);
|
||||||
|
|
||||||
if (workspace)
|
if (workspace)
|
||||||
meta_workspace_activate (workspace);
|
meta_workspace_activate (workspace);
|
||||||
else
|
else
|
||||||
meta_verbose ("Don't know about workspace %d\n", space);
|
meta_verbose ("Don't know about workspace %d\n", space);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1674,3 +1678,32 @@ meta_display_increment_event_serial (MetaDisplay *display)
|
|||||||
XDeleteProperty (display->xdisplay, display->leader_window,
|
XDeleteProperty (display->xdisplay, display->leader_window,
|
||||||
display->atom_motif_wm_hints);
|
display->atom_motif_wm_hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_display_update_active_window_hint (MetaDisplay *display)
|
||||||
|
{
|
||||||
|
GSList *tmp;
|
||||||
|
|
||||||
|
unsigned long data[2];
|
||||||
|
|
||||||
|
if (display->focus_window)
|
||||||
|
data[0] = display->focus_window->xwindow;
|
||||||
|
else
|
||||||
|
data[0] = None;
|
||||||
|
data[1] = None;
|
||||||
|
|
||||||
|
tmp = display->screens;
|
||||||
|
while (tmp != NULL)
|
||||||
|
{
|
||||||
|
MetaScreen *screen = tmp->data;
|
||||||
|
|
||||||
|
meta_error_trap_push (display);
|
||||||
|
XChangeProperty (display->xdisplay, screen->xroot,
|
||||||
|
display->atom_net_active_window,
|
||||||
|
XA_WINDOW,
|
||||||
|
32, PropModeReplace, (guchar*) data, 2);
|
||||||
|
meta_error_trap_pop (display);
|
||||||
|
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -100,6 +100,7 @@ struct _MetaDisplay
|
|||||||
Atom atom_wm_icon_size;
|
Atom atom_wm_icon_size;
|
||||||
Atom atom_kwm_win_icon;
|
Atom atom_kwm_win_icon;
|
||||||
Atom atom_net_wm_moveresize;
|
Atom atom_net_wm_moveresize;
|
||||||
|
Atom atom_net_active_window;
|
||||||
|
|
||||||
/* This is the actual window from focus events,
|
/* This is the actual window from focus events,
|
||||||
* not the one we last set
|
* not the one we last set
|
||||||
@ -194,4 +195,6 @@ void meta_display_ungrab_window_buttons (MetaDisplay *display,
|
|||||||
/* make a request to ensure the event serial has changed */
|
/* make a request to ensure the event serial has changed */
|
||||||
void meta_display_increment_event_serial (MetaDisplay *display);
|
void meta_display_increment_event_serial (MetaDisplay *display);
|
||||||
|
|
||||||
|
void meta_display_update_active_window_hint (MetaDisplay *display);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
22
src/window.c
22
src/window.c
@ -2449,6 +2449,25 @@ meta_window_client_message (MetaWindow *window,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
else if (event->xclient.message_type ==
|
||||||
|
display->atom_net_active_window)
|
||||||
|
{
|
||||||
|
meta_verbose ("_NET_ACTIVE_WINDOW request for window '%s'", window->desc);
|
||||||
|
|
||||||
|
/* Switch to window's workspace - alternatively we could move
|
||||||
|
* window back to this workspace. I don't know which is right.
|
||||||
|
*/
|
||||||
|
if (!meta_workspace_contains_window (window->screen->active_workspace,
|
||||||
|
window) &&
|
||||||
|
/* this check shouldn't actually be required, I don't think it is */
|
||||||
|
window->workspaces)
|
||||||
|
meta_workspace_activate (window->workspaces->data);
|
||||||
|
|
||||||
|
meta_window_raise (window);
|
||||||
|
meta_window_focus (window, CurrentTime); /* FIXME CurrentTime */
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -2523,6 +2542,9 @@ meta_window_notify_focus (MetaWindow *window,
|
|||||||
meta_frame_queue_draw (window->frame);
|
meta_frame_queue_draw (window->frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now set _NET_ACTIVE_WINDOW hint */
|
||||||
|
meta_display_update_active_window_hint (window->display);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user