@@ -227,21 +227,14 @@ static atomitem_t atomNames[] = {
227227#define _NET_WM_STATE_ADD 1
228228#define _NET_WM_STATE_TOGGLE 2
229229
230- #if 0
230+ #if 1
231231/*
232232 * These constant provide information on the kind of window move/resize when
233233 * it is initiated by the application instead of by WindowMaker. They are
234234 * parameter for the client message _NET_WM_MOVERESIZE, as defined by the
235235 * FreeDesktop wm-spec standard:
236236 * http://standards.freedesktop.org/wm-spec/1.5/ar01s04.html
237237 *
238- * Today, WindowMaker does not support this at all (the corresponding Atom
239- * is not added to the list in setSupportedHints), probably because there is
240- * nothing it needs to do about it, the application is assumed to know what
241- * it is doing, and WindowMaker won't get in the way.
242- *
243- * The definition of the constants (taken from the standard) are disabled to
244- * avoid a spurious warning (-Wunused-macros).
245238 */
246239#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
247240#define _NET_WM_MOVERESIZE_SIZE_TOP 1
@@ -254,6 +247,7 @@ static atomitem_t atomNames[] = {
254247#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
255248#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
256249#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
250+ #define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
257251#endif
258252
259253static void windowObserver (CFNotificationCenterRef center , void * observer , CFNotificationName name ,
@@ -512,6 +506,12 @@ static void updateIconImage(WWindow *wwin)
512506
513507 /* Save the icon in the X11 icon */
514508 wwin -> net_icon_image = get_window_image_from_x11 (wwin -> client_win );
509+ if (wwin -> net_icon_image ) {
510+ fprintf (stderr , "%s: window %s icon size: %i x %i\n" , __func__ , wwin -> wm_class ,
511+ wwin -> net_icon_image -> width , wwin -> net_icon_image -> height );
512+ } else {
513+ fprintf (stderr , "%s: window %s has no icon.\n" , __func__ , wwin -> wm_class );
514+ }
515515
516516 /* Refresh the Window Icon */
517517 if (wwin -> icon )
@@ -1726,6 +1726,74 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
17261726 return True ;
17271727 }
17281728
1729+ /*
1730+ Move and resize
1731+ */
1732+ if (event -> message_type == net_moveresize_window ) {
1733+ // _NET_MOVERESIZE_WINDOW
1734+ // window = window to be moved or resized
1735+ // message_type = _NET_MOVERESIZE_WINDOW
1736+ // format = 32
1737+ // data.l[0] = gravity and flags
1738+ // data.l[1] = x
1739+ // data.l[2] = y
1740+ // data.l[3] = width
1741+ // data.l[4] = height
1742+ fprintf (stderr , "%s: _NET_MOVERESIZE_WINDOW: %li, %li | %li x %li\n" , __func__ , event -> data .l [1 ],
1743+ event -> data .l [2 ], event -> data .l [3 ], event -> data .l [4 ]);
1744+ } else if (event -> message_type == net_wm_moveresize ) {
1745+ // _NET_WM_MOVERESIZE
1746+ // window = window to be moved or resized
1747+ // message_type = _NET_WM_MOVERESIZE
1748+ // format = 32
1749+ // data.l[0] = x_root
1750+ // data.l[1] = y_root
1751+ // data.l[2] = direction
1752+ // data.l[3] = button
1753+ // data.l[4] = source indication
1754+ fprintf (
1755+ stderr ,
1756+ "%s: _NET_WM_MOVERESIZE: %li, %li | direction: %li, button: %li, source direction: %li\n" ,
1757+ __func__ , event -> data .l [0 ], event -> data .l [1 ], event -> data .l [2 ], event -> data .l [3 ],
1758+ event -> data .l [4 ]);
1759+
1760+ WWindow * wwin = NULL ;
1761+ XEvent x_event ;
1762+ x_event .xmotion .x_root = event -> data .l [0 ];
1763+ x_event .xmotion .y_root = event -> data .l [1 ];
1764+ x_event .xmotion .window = event -> window ;
1765+ x_event .xbutton .button = Button1 ;
1766+
1767+ switch (event -> data .l [2 ]) { // direction
1768+ case _NET_WM_MOVERESIZE_SIZE_TOPLEFT : // usupported by design
1769+ case _NET_WM_MOVERESIZE_SIZE_TOP : // usupported by design
1770+ case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT : // usupported by design
1771+ break ;
1772+ case _NET_WM_MOVERESIZE_MOVE : // move only - titlebar
1773+ wwin = wWindowFor (event -> window );
1774+ if (wwin &&
1775+ XGrabPointer (dpy , event -> window , False ,
1776+ ButtonMotionMask | ButtonReleaseMask | ButtonPressMask , GrabModeAsync ,
1777+ GrabModeAsync , None , None , CurrentTime ) == GrabSuccess ) {
1778+ wMouseMoveWindow (wwin , & x_event );
1779+ XUngrabPointer (dpy , CurrentTime );
1780+ } else {
1781+ fprintf (stderr , "%s: window is not found for _NET_WM_MOVERESIZE_MOVE!\n" , __func__ );
1782+ }
1783+ break ;
1784+ case _NET_WM_MOVERESIZE_SIZE_RIGHT :
1785+ break ;
1786+ case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT :
1787+ break ;
1788+ case _NET_WM_MOVERESIZE_SIZE_BOTTOM :
1789+ break ;
1790+ case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT :
1791+ break ;
1792+ case _NET_WM_MOVERESIZE_SIZE_LEFT :
1793+ break ;
1794+ }
1795+ }
1796+
17291797 return False ;
17301798}
17311799
0 commit comments