wrong atom name - _NET_SUPPORTED not _NET_WM_SUPPORTED

2001-08-29  Havoc Pennington  <hp@pobox.com>

	* src/display.c (meta_display_open): wrong atom name -
	_NET_SUPPORTED not _NET_WM_SUPPORTED

	* src/window.c (meta_window_configure_request): geez, why were we
	honoring configure requests for width/height for normal windows.
	Denied!
	(meta_window_client_message): _NET_WM_MOVERESIZE support, sort of
	(doesn't quite work, acts like owner_events = true?)

	* src/display.c: add _NET_WM_MOVERESIZE atom
This commit is contained in:
Havoc Pennington 2001-08-29 04:16:30 +00:00 committed by Havoc Pennington
parent db0a7e2978
commit 27c81cad33
5 changed files with 145 additions and 12 deletions

View File

@ -1,3 +1,16 @@
2001-08-29 Havoc Pennington <hp@pobox.com>
* src/display.c (meta_display_open): wrong atom name -
_NET_SUPPORTED not _NET_WM_SUPPORTED
* src/window.c (meta_window_configure_request): geez, why were we
honoring configure requests for width/height for normal windows.
Denied!
(meta_window_client_message): _NET_WM_MOVERESIZE support, sort of
(doesn't quite work, acts like owner_events = true?)
* src/display.c: add _NET_WM_MOVERESIZE atom
2001-08-28 Havoc Pennington <hp@pobox.com>
Unbreak tab popup a bit.

View File

@ -112,7 +112,7 @@ meta_display_open (const char *name)
"WM_WINDOW_ROLE",
"_NET_CURRENT_DESKTOP",
"_NET_SUPPORTING_WM_CHECK",
"_NET_WM_SUPPORTED",
"_NET_SUPPORTED",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_DESKTOP",
"_NET_WM_WINDOW_TYPE_DOCK",
@ -134,7 +134,8 @@ meta_display_open (const char *name)
"_NET_WM_ICON_GEOMETRY",
"UTF8_STRING",
"WM_ICON_SIZE",
"_KWM_WIN_ICON"
"_KWM_WIN_ICON",
"_NET_WM_MOVERESIZE"
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@ -197,7 +198,7 @@ meta_display_open (const char *name)
display->atom_wm_window_role = atoms[16];
display->atom_net_current_desktop = atoms[17];
display->atom_net_supporting_wm_check = atoms[18];
display->atom_net_wm_supported = atoms[19];
display->atom_net_supported = atoms[19];
display->atom_net_wm_window_type = atoms[20];
display->atom_net_wm_window_type_desktop = atoms[21];
display->atom_net_wm_window_type_dock = atoms[22];
@ -220,6 +221,7 @@ meta_display_open (const char *name)
display->atom_utf8_string = atoms[39];
display->atom_wm_icon_size = atoms[40];
display->atom_kwm_win_icon = atoms[41];
display->atom_net_wm_moveresize = atoms[42];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new
@ -1480,7 +1482,10 @@ meta_display_begin_grab_op (MetaDisplay *display,
None,
cursor,
timestamp) == GrabSuccess)
{
display->grab_have_pointer = TRUE;
meta_debug_spew ("Successful XGrabPointer()\n");
}
meta_error_trap_pop (display);
XFreeCursor (display->xdisplay, cursor);

View File

@ -76,7 +76,7 @@ struct _MetaDisplay
Atom atom_wm_window_role;
Atom atom_net_current_desktop;
Atom atom_net_supporting_wm_check;
Atom atom_net_wm_supported;
Atom atom_net_supported;
Atom atom_net_wm_window_type;
Atom atom_net_wm_window_type_desktop;
Atom atom_net_wm_window_type_dock;
@ -99,6 +99,7 @@ struct _MetaDisplay
Atom atom_utf8_string;
Atom atom_wm_icon_size;
Atom atom_kwm_win_icon;
Atom atom_net_wm_moveresize;
/* This is the actual window from focus events,
* not the one we last set

View File

@ -72,7 +72,7 @@ set_wm_check_hint (MetaScreen *screen)
static int
set_supported_hint (MetaScreen *screen)
{
#define N_SUPPORTED 22
#define N_SUPPORTED 23
#define N_WIN_SUPPORTED 1
Atom atoms[N_SUPPORTED];
@ -98,9 +98,10 @@ set_supported_hint (MetaScreen *screen)
atoms[19] = screen->display->atom_net_wm_state_skip_taskbar;
atoms[20] = screen->display->atom_net_wm_state_skip_pager;
atoms[21] = screen->display->atom_net_wm_icon;
atoms[22] = screen->display->atom_net_wm_moveresize;
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_net_wm_supported,
screen->display->atom_net_supported,
XA_ATOM,
32, PropModeReplace, (guchar*) atoms, N_SUPPORTED);

View File

@ -2096,11 +2096,17 @@ meta_window_configure_request (MetaWindow *window,
width = window->rect.width;
height = window->rect.height;
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->type == META_WINDOW_TOOLBAR ||
window->type == META_WINDOW_MENU)
{
if (event->xconfigurerequest.value_mask & CWWidth)
width = event->xconfigurerequest.width;
if (event->xconfigurerequest.value_mask & CWHeight)
height = event->xconfigurerequest.height;
}
/* ICCCM 4.1.5 */
@ -2146,6 +2152,16 @@ meta_window_property_notify (MetaWindow *window,
return process_property_notify (window, &event->xproperty);
}
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
#define _NET_WM_MOVERESIZE_MOVE 8
gboolean
meta_window_client_message (MetaWindow *window,
XEvent *event)
@ -2306,6 +2322,103 @@ meta_window_client_message (MetaWindow *window,
return TRUE;
}
else if (event->xclient.message_type ==
display->atom_net_wm_moveresize)
{
int x_root;
int y_root;
int action;
MetaGrabOp op;
x_root = event->xclient.data.l[0];
y_root = event->xclient.data.l[1];
action = event->xclient.data.l[2];
meta_verbose ("Received _NET_WM_MOVERESIZE message on %s, %d,%d action = %d\n",
window->desc,
x_root, y_root, action);
op = META_GRAB_OP_NONE;
switch (action)
{
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
op = META_GRAB_OP_RESIZING_NW;
break;
case _NET_WM_MOVERESIZE_SIZE_TOP:
op = META_GRAB_OP_RESIZING_N;
break;
case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT:
op = META_GRAB_OP_RESIZING_NE;
break;
case _NET_WM_MOVERESIZE_SIZE_RIGHT:
op = META_GRAB_OP_RESIZING_E;
break;
case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT:
op = META_GRAB_OP_RESIZING_SE;
break;
case _NET_WM_MOVERESIZE_SIZE_BOTTOM:
op = META_GRAB_OP_RESIZING_S;
break;
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
op = META_GRAB_OP_RESIZING_SW;
break;
case _NET_WM_MOVERESIZE_SIZE_LEFT:
op = META_GRAB_OP_RESIZING_W;
break;
case _NET_WM_MOVERESIZE_MOVE:
op = META_GRAB_OP_MOVING;
break;
default:
break;
}
if (op != META_GRAB_OP_NONE &&
((window->has_move_func && op == META_GRAB_OP_MOVING) ||
(window->has_resize_func && op != META_GRAB_OP_MOVING)))
{
int x, y, query_root_x, query_root_y;
Window root, child;
guint mask;
int button;
/* The race conditions in this _NET_WM_MOVERESIZE thing
* are mind-boggling
*/
mask = 0;
meta_error_trap_push (window->display);
XQueryPointer (window->display->xdisplay,
window->xwindow,
&root, &child,
&query_root_x, &query_root_y,
&x, &y,
&mask);
meta_error_trap_pop (window->display);
if (mask & Button1Mask)
button = 1;
else if (mask & Button2Mask)
button = 2;
else if (mask & Button3Mask)
button = 3;
else
button = 0;
if (button != 0)
{
meta_verbose ("Beginning move/resize with button = %d\n", button);
meta_display_begin_grab_op (window->display,
window,
op,
FALSE,
button, 0,
CurrentTime,
x_root,
y_root);
}
}
return TRUE;
}
return FALSE;
}