1
0
Fork 0

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:
Havoc Pennington 2001-10-07 23:06:19 +00:00 committed by Havoc Pennington
parent ec4dfd0cbc
commit f22b9dfd94
4 changed files with 83 additions and 17 deletions

View file

@ -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>
* src/window.c (meta_window_client_message): don't allow

View file

@ -135,7 +135,8 @@ meta_display_open (const char *name)
"UTF8_STRING",
"WM_ICON_SIZE",
"_KWM_WIN_ICON",
"_NET_WM_MOVERESIZE"
"_NET_WM_MOVERESIZE",
"_NET_ACTIVE_WINDOW"
};
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_kwm_win_icon = atoms[41];
display->atom_net_wm_moveresize = atoms[42];
display->atom_net_active_window = atoms[43];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new
@ -905,27 +907,29 @@ event_callback (XEvent *event,
screen = meta_display_screen_for_root (display,
event->xclient.window);
if (screen &&
event->xclient.message_type ==
display->atom_net_current_desktop)
if (screen)
{
int space;
MetaWorkspace *workspace;
if (event->xclient.message_type ==
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",
space);
meta_verbose ("Request to change current workspace to %d\n",
space);
workspace =
meta_display_get_workspace_by_screen_index (display,
screen,
space);
workspace =
meta_display_get_workspace_by_screen_index (display,
screen,
space);
if (workspace)
meta_workspace_activate (workspace);
else
meta_verbose ("Don't know about workspace %d\n", space);
if (workspace)
meta_workspace_activate (workspace);
else
meta_verbose ("Don't know about workspace %d\n", space);
}
}
}
break;
@ -1674,3 +1678,32 @@ meta_display_increment_event_serial (MetaDisplay *display)
XDeleteProperty (display->xdisplay, display->leader_window,
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;
}
}

View file

@ -100,6 +100,7 @@ struct _MetaDisplay
Atom atom_wm_icon_size;
Atom atom_kwm_win_icon;
Atom atom_net_wm_moveresize;
Atom atom_net_active_window;
/* This is the actual window from focus events,
* 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 */
void meta_display_increment_event_serial (MetaDisplay *display);
void meta_display_update_active_window_hint (MetaDisplay *display);
#endif

View file

@ -2449,6 +2449,25 @@ meta_window_client_message (MetaWindow *window,
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;
}
@ -2523,6 +2542,9 @@ meta_window_notify_focus (MetaWindow *window,
meta_frame_queue_draw (window->frame);
}
/* Now set _NET_ACTIVE_WINDOW hint */
meta_display_update_active_window_hint (window->display);
return FALSE;
}