2003-03-23 19:48:09 -08:00
|
|
|
/*
|
2007-01-13 11:14:29 -08:00
|
|
|
* Copyright (C) 2003-2007 Kim Woelders
|
2003-03-23 19:48:09 -08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies of the Software, its documentation and marketing & publicity
|
|
|
|
* materials, and acknowledgment shall be given in the documentation, materials
|
|
|
|
* and software packages that this Software was used.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Extended Window Manager Hints.
|
|
|
|
*/
|
|
|
|
#include "E.h"
|
2005-09-04 00:27:20 -07:00
|
|
|
#include "desktops.h"
|
2006-02-18 01:50:17 -08:00
|
|
|
#include "e16-ecore_hints.h"
|
2005-07-16 09:57:45 -07:00
|
|
|
#include "ewins.h"
|
2005-10-27 16:18:35 -07:00
|
|
|
#include "hints.h"
|
2003-03-23 19:48:09 -08:00
|
|
|
|
|
|
|
/*
|
2005-02-12 08:16:29 -08:00
|
|
|
* _NET_WM_MOVERESIZE client message actions
|
2003-03-23 19:48:09 -08:00
|
|
|
*/
|
|
|
|
#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
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9
|
|
|
|
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10
|
|
|
|
|
|
|
|
/* Window state property change actions */
|
|
|
|
#define _NET_WM_STATE_REMOVE 0
|
|
|
|
#define _NET_WM_STATE_ADD 1
|
|
|
|
#define _NET_WM_STATE_TOGGLE 2
|
|
|
|
|
2005-11-12 17:22:28 -08:00
|
|
|
/* Source indication */
|
|
|
|
#define _NET_WM_SOURCE_UNKNOWN 0
|
|
|
|
#define _NET_WM_SOURCE_APP 1
|
|
|
|
#define _NET_WM_SOURCE_USER 2
|
|
|
|
|
|
|
|
#define OPSRC(src) (((src) == _NET_WM_SOURCE_USER) ? _NET_WM_SOURCE_USER : _NET_WM_SOURCE_APP)
|
|
|
|
|
2004-07-02 17:58:19 -07:00
|
|
|
#ifndef ENABLE_HINTS_GNOME
|
|
|
|
Atom _G_WIN_LAUER;
|
|
|
|
#endif
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
/*
|
|
|
|
* Set/clear Atom in list
|
|
|
|
*/
|
2003-03-27 21:16:21 -08:00
|
|
|
static void
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(Ecore_X_Atom * atoms, int size, int *count, Ecore_X_Atom atom,
|
|
|
|
int set)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2003-03-27 21:16:21 -08:00
|
|
|
int i, n, in_list;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
n = *count;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
/* Check if atom is in list or not (+get index) */
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
if (atoms[i] == atom)
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
2003-03-27 21:16:21 -08:00
|
|
|
in_list = i < n;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
if (set && !in_list)
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* Add it (if space left) */
|
|
|
|
if (n < size)
|
|
|
|
atoms[n++] = atom;
|
|
|
|
*count = n;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
|
|
|
else if (!set && in_list)
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* Remove it */
|
|
|
|
atoms[i] = atoms[--n];
|
|
|
|
*count = n;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize EWMH stuff
|
|
|
|
*/
|
|
|
|
void
|
2003-07-12 07:06:37 -07:00
|
|
|
EWMH_Init(Window win_wm_check)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
Ecore_X_Atom atom_list[64];
|
2003-03-27 21:16:21 -08:00
|
|
|
int atom_count;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
#ifndef USE_ECORE_X
|
|
|
|
ecore_x_netwm_init();
|
|
|
|
#endif
|
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
atom_count = 0;
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_SUPPORTED;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_DESKTOP_GEOMETRY;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_DESKTOP_NAMES;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_CURRENT_DESKTOP;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_DESKTOP_VIEWPORT;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WORKAREA;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_SHOWING_DESKTOP;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_ACTIVE_WINDOW;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_CLIENT_LIST;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_CLIENT_LIST_STACKING;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_CLOSE_WINDOW;
|
2005-07-09 17:23:52 -07:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_MOVERESIZE_WINDOW;
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_MOVERESIZE;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_NAME;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ICON_NAME;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_DESKTOP;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
|
|
|
|
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_MODAL;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_STICKY;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_SHADED;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_ABOVE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_BELOW;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
|
|
|
|
|
2005-06-30 05:09:34 -07:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_MOVE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_SHADE;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_STICK;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
|
|
|
|
|
2005-07-09 03:15:18 -07:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STRUT_PARTIAL;
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_STRUT;
|
2005-07-09 03:15:18 -07:00
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_FRAME_EXTENTS;
|
|
|
|
atom_list[atom_count++] = ECORE_X_ATOM_NET_WM_WINDOW_OPACITY;
|
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_window_prop_atom_set(VRoot.xwin, ECORE_X_ATOM_NET_SUPPORTED,
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list, atom_count);
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
/* Set WM info properties */
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_wm_identify(VRoot.xwin, win_wm_check, e_wm_name);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Desktops
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetDesktopCount(void)
|
|
|
|
{
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_count_set(VRoot.xwin, DesksGetNumber());
|
2004-12-28 15:46:49 -08:00
|
|
|
}
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
void
|
|
|
|
EWMH_SetDesktopRoots(void)
|
|
|
|
{
|
|
|
|
int i, n_desks;
|
|
|
|
Ecore_X_Window *wl;
|
2003-06-11 12:41:30 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
n_desks = DesksGetNumber();
|
2007-01-16 17:10:44 -08:00
|
|
|
wl = EMALLOC(Ecore_X_Window, n_desks);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!wl)
|
|
|
|
return;
|
2003-06-11 12:41:30 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
for (i = 0; i < n_desks; i++)
|
2006-04-18 10:57:58 -07:00
|
|
|
wl[i] = EoGetXwin(DeskGet(i));
|
2003-06-11 12:41:30 -07:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_roots_set(VRoot.xwin, wl, n_desks);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
Efree(wl);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetDesktopNames(void)
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
/* Fall back to defaults */
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_names_set(VRoot.xwin, NULL, DesksGetNumber());
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetDesktopSize(void)
|
|
|
|
{
|
2003-03-27 21:16:21 -08:00
|
|
|
int ax, ay;
|
|
|
|
|
2005-11-19 11:32:45 -08:00
|
|
|
DesksGetAreaSize(&ax, &ay);
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_size_set(VRoot.xwin, ax * VRoot.w, ay * VRoot.h);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
2003-08-18 15:03:10 -07:00
|
|
|
void
|
|
|
|
EWMH_SetWorkArea(void)
|
|
|
|
{
|
2005-04-23 01:28:04 -07:00
|
|
|
unsigned int *p_coord;
|
2004-12-28 15:46:49 -08:00
|
|
|
int n_coord, i, n_desks;
|
2003-08-18 15:03:10 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
n_desks = DesksGetNumber();
|
|
|
|
n_coord = 4 * n_desks;
|
2007-01-16 17:10:44 -08:00
|
|
|
p_coord = EMALLOC(unsigned int, n_coord);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!p_coord)
|
|
|
|
return;
|
2003-08-18 15:03:10 -07:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
for (i = 0; i < n_desks; i++)
|
2003-08-18 15:03:10 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
p_coord[4 * i] = 0;
|
|
|
|
p_coord[4 * i + 1] = 0;
|
|
|
|
p_coord[4 * i + 2] = VRoot.w;
|
|
|
|
p_coord[4 * i + 3] = VRoot.h;
|
2003-08-18 15:03:10 -07:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_workareas_set(VRoot.xwin, p_coord, n_desks);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
Efree(p_coord);
|
2003-08-18 15:03:10 -07:00
|
|
|
}
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
void
|
|
|
|
EWMH_SetCurrentDesktop(void)
|
|
|
|
{
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_current_set(VRoot.xwin, DesksGetCurrentNum());
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetDesktopViewport(void)
|
|
|
|
{
|
2005-04-23 01:28:04 -07:00
|
|
|
unsigned int *p_coord;
|
2004-12-28 15:46:49 -08:00
|
|
|
int n_coord, i, ax, ay, n_desks;
|
2003-03-27 21:16:21 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
n_desks = DesksGetNumber();
|
|
|
|
n_coord = 2 * n_desks;
|
2007-01-16 17:10:44 -08:00
|
|
|
p_coord = EMALLOC(unsigned int, n_coord);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!p_coord)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < n_desks; i++)
|
2003-04-02 14:55:53 -08:00
|
|
|
{
|
2005-09-04 00:27:20 -07:00
|
|
|
DeskGetArea(DeskGet(i), &ax, &ay);
|
2004-12-28 15:46:49 -08:00
|
|
|
p_coord[2 * i] = ax * VRoot.w;
|
|
|
|
p_coord[2 * i + 1] = ay * VRoot.h;
|
2003-04-02 14:55:53 -08:00
|
|
|
}
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_desk_viewports_set(VRoot.xwin, p_coord, n_desks);
|
2004-12-28 15:46:49 -08:00
|
|
|
|
|
|
|
Efree(p_coord);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetShowingDesktop(int on)
|
|
|
|
{
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_showing_desktop_set(VRoot.xwin, on);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Window status
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetClientList(void)
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
Ecore_X_Window *wl;
|
2004-04-30 13:05:22 -07:00
|
|
|
int i, num;
|
2005-08-07 07:06:52 -07:00
|
|
|
EWin *const *lst;
|
2003-03-27 21:16:21 -08:00
|
|
|
|
|
|
|
/* Mapping order */
|
2005-08-07 07:06:52 -07:00
|
|
|
lst = EwinListOrderGet(&num);
|
2004-04-30 13:05:22 -07:00
|
|
|
if (num > 0)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
wl = EMALLOC(Ecore_X_Window, num);
|
2003-05-22 12:15:03 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2006-08-07 13:20:16 -07:00
|
|
|
wl[i] = EwinGetClientXwin(lst[i]);
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_client_list_set(VRoot.xwin, wl, num);
|
2004-04-30 13:05:22 -07:00
|
|
|
Efree(wl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_client_list_set(VRoot.xwin, NULL, 0);
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2004-04-30 13:05:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EWMH_SetClientStacking(void)
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
Ecore_X_Window *wl;
|
2004-04-30 13:05:22 -07:00
|
|
|
int i, num;
|
|
|
|
EWin *const *lst;
|
|
|
|
|
2004-03-16 14:10:07 -08:00
|
|
|
/* Stacking order */
|
2004-12-28 15:46:49 -08:00
|
|
|
lst = EwinListStackGet(&num);
|
2004-04-30 13:05:22 -07:00
|
|
|
if (num > 0)
|
|
|
|
{
|
2007-01-16 17:10:44 -08:00
|
|
|
wl = EMALLOC(Ecore_X_Window, num);
|
2004-04-30 13:05:22 -07:00
|
|
|
for (i = 0; i < num; i++)
|
2006-08-07 13:20:16 -07:00
|
|
|
wl[i] = EwinGetClientXwin(lst[num - i - 1]);
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_client_list_stacking_set(VRoot.xwin, wl, num);
|
2004-04-30 13:05:22 -07:00
|
|
|
Efree(wl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_client_list_stacking_set(VRoot.xwin, NULL, 0);
|
2004-04-30 13:05:22 -07:00
|
|
|
}
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-05-22 12:31:13 -07:00
|
|
|
EWMH_SetActiveWindow(Window win)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-10-30 11:40:49 -08:00
|
|
|
static Window win_last_set = None;
|
2003-03-27 21:16:21 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (win == win_last_set)
|
|
|
|
return;
|
2004-05-04 17:17:15 -07:00
|
|
|
|
2006-04-29 12:39:21 -07:00
|
|
|
ecore_x_netwm_client_active_set(VRoot.xwin, win);
|
2004-12-28 15:46:49 -08:00
|
|
|
win_last_set = win;
|
2004-05-04 17:17:15 -07:00
|
|
|
}
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
/*
|
|
|
|
* Functions that set X11-properties from E-window internals
|
|
|
|
*/
|
|
|
|
|
2004-05-22 12:31:13 -07:00
|
|
|
void
|
|
|
|
EWMH_SetWindowName(Window win, const char *name)
|
|
|
|
{
|
2004-05-23 09:11:36 -07:00
|
|
|
const char *str;
|
|
|
|
|
|
|
|
str = EstrInt2Enc(name, 1);
|
2004-12-28 15:46:49 -08:00
|
|
|
ecore_x_netwm_name_set(win, str);
|
2004-05-23 09:11:36 -07:00
|
|
|
EstrInt2EncFree(str, 1);
|
2004-05-22 12:31:13 -07:00
|
|
|
}
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_SetWindowDesktop(const EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
unsigned int val;
|
2003-03-27 21:16:21 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (EoIsSticky(ewin))
|
2003-03-27 21:16:21 -08:00
|
|
|
val = 0xFFFFFFFF;
|
|
|
|
else
|
2005-09-04 00:27:20 -07:00
|
|
|
val = EoGetDeskNum(ewin);
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_netwm_desktop_set(EwinGetClientXwin(ewin), val);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_SetWindowState(const EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
Ecore_X_Atom atom_list[64];
|
|
|
|
int len = sizeof(atom_list) / sizeof(Ecore_X_Atom);
|
2003-03-27 21:16:21 -08:00
|
|
|
int atom_count;
|
|
|
|
|
|
|
|
atom_count = 0;
|
2005-09-03 07:28:39 -07:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_MODAL,
|
|
|
|
ewin->state.modal);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_STICKY,
|
2004-12-28 15:46:49 -08:00
|
|
|
EoIsSticky(ewin));
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_SHADED,
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.shaded);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
2005-07-08 09:48:19 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR,
|
|
|
|
ewin->props.skip_ext_task);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_HIDDEN,
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.iconified || ewin->state.shaded);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT,
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.maximized_vert);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ,
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.maximized_horz);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
2005-07-08 09:48:19 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN, ewin->state.fullscreen);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
2005-07-08 09:48:19 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER,
|
|
|
|
ewin->props.skip_ext_pager);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_ABOVE,
|
2004-12-28 15:46:49 -08:00
|
|
|
EoGetLayer(ewin) >= 6);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count, ECORE_X_ATOM_NET_WM_STATE_BELOW,
|
2004-12-28 15:46:49 -08:00
|
|
|
EoGetLayer(ewin) <= 2);
|
2005-02-12 08:16:29 -08:00
|
|
|
atom_list_set(atom_list, len, &atom_count,
|
2005-06-02 15:11:09 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION,
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.attention);
|
2005-06-02 15:11:09 -07:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_window_prop_atom_set(EwinGetClientXwin(ewin),
|
2005-08-04 09:02:02 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE, atom_list,
|
|
|
|
atom_count);
|
2005-02-12 08:16:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-03-24 15:38:12 -08:00
|
|
|
EWMH_SetWindowBorder(const EWin * ewin)
|
2005-02-12 08:16:29 -08:00
|
|
|
{
|
2005-04-23 01:28:04 -07:00
|
|
|
unsigned int val[4];
|
2005-02-12 08:16:29 -08:00
|
|
|
|
|
|
|
if (ewin->border)
|
|
|
|
{
|
2005-12-22 10:43:15 -08:00
|
|
|
int bl, br, bt, bb;
|
|
|
|
|
|
|
|
EwinBorderGetSize(ewin, &bl, &br, &bt, &bb);
|
|
|
|
val[0] = (unsigned int)bl;
|
|
|
|
val[1] = (unsigned int)br;
|
|
|
|
val[2] = (unsigned int)bt;
|
|
|
|
val[3] = (unsigned int)bb;
|
2005-02-12 08:16:29 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
val[0] = val[1] = val[2] = val[3] = 0;
|
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_window_prop_card32_set(EwinGetClientXwin(ewin),
|
2005-02-12 08:16:29 -08:00
|
|
|
ECORE_X_ATOM_NET_FRAME_EXTENTS, val, 4);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
2004-08-20 14:13:56 -07:00
|
|
|
void
|
2005-03-24 15:38:12 -08:00
|
|
|
EWMH_SetWindowOpacity(const EWin * ewin)
|
2004-08-20 14:13:56 -07:00
|
|
|
{
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_netwm_opacity_set(EwinGetClientXwin(ewin), ewin->ewmh.opacity);
|
2006-04-18 10:57:58 -07:00
|
|
|
ecore_x_netwm_opacity_set(EoGetXwin(ewin), ewin->ewmh.opacity);
|
2004-08-20 14:13:56 -07:00
|
|
|
}
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
/*
|
|
|
|
* Functions that set E-window internals from X11-properties
|
|
|
|
*/
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
static void
|
2004-02-28 17:30:18 -08:00
|
|
|
EWMH_GetWindowName(EWin * ewin)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
_EFREE(ewin->ewmh.wm_name);
|
2004-02-28 17:30:18 -08:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_netwm_name_get(EwinGetClientXwin(ewin), &val);
|
2004-02-28 17:30:18 -08:00
|
|
|
if (!val)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
ewin->ewmh.wm_name = EstrUtf82Int(val, 0);
|
2004-02-28 17:30:18 -08:00
|
|
|
Efree(val);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
EwinChange(ewin, EWIN_CHANGE_NAME);
|
2004-02-28 17:30:18 -08:00
|
|
|
}
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
static void
|
2004-02-28 17:30:18 -08:00
|
|
|
EWMH_GetWindowIconName(EWin * ewin)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
_EFREE(ewin->ewmh.wm_icon_name);
|
2004-02-28 17:30:18 -08:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_netwm_icon_name_get(EwinGetClientXwin(ewin), &val);
|
2004-02-28 17:30:18 -08:00
|
|
|
if (!val)
|
2004-12-28 15:46:49 -08:00
|
|
|
return;
|
|
|
|
ewin->ewmh.wm_icon_name = EstrUtf82Int(val, 0);
|
2004-02-28 17:30:18 -08:00
|
|
|
Efree(val);
|
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
EwinChange(ewin, EWIN_CHANGE_ICON_NAME);
|
2004-02-28 17:30:18 -08:00
|
|
|
}
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
static void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_GetWindowDesktop(EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
int num;
|
|
|
|
unsigned int desk;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_netwm_desktop_get(EwinGetClientXwin(ewin), &desk);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (num <= 0)
|
2005-03-24 15:38:12 -08:00
|
|
|
return;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2004-12-28 15:46:49 -08:00
|
|
|
if (desk == 0xFFFFFFFF)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* It is possible to distinguish between "sticky" and "on all desktops". */
|
|
|
|
/* E doesn't */
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetSticky(ewin, 1);
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-09-04 00:27:20 -07:00
|
|
|
EoSetDesk(ewin, DeskGet(desk));
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetSticky(ewin, 0);
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2004-02-28 17:30:18 -08:00
|
|
|
EwinChange(ewin, EWIN_CHANGE_DESKTOP);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
static void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_GetWindowState(EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
Ecore_X_Atom *p_atoms, atom;
|
2003-03-27 21:16:21 -08:00
|
|
|
int i, n_atoms;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
n_atoms = ecore_x_window_prop_atom_list_get(EwinGetClientXwin(ewin),
|
2005-02-12 08:16:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
&p_atoms);
|
|
|
|
if (n_atoms <= 0)
|
2005-03-24 15:38:12 -08:00
|
|
|
return;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-06-14 04:57:07 -07:00
|
|
|
/* We must clear/set all according to not present/present */
|
2005-02-12 08:16:29 -08:00
|
|
|
/* EoSetSticky(ewin, 0); Do not override if set via _NET_WM_DESKTOP */
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.shaded = 0;
|
2005-09-03 07:28:39 -07:00
|
|
|
ewin->state.modal = 0;
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_ext_task = ewin->props.skip_ext_pager = 0;
|
|
|
|
ewin->state.maximized_horz = ewin->state.maximized_vert = 0;
|
|
|
|
ewin->state.fullscreen = ewin->state.attention = 0;
|
2003-06-14 04:57:07 -07:00
|
|
|
/* ewin->layer = No ... TBD */
|
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
for (i = 0; i < n_atoms; i++)
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
atom = p_atoms[i];
|
2005-09-03 07:28:39 -07:00
|
|
|
if (atom == ECORE_X_ATOM_NET_WM_STATE_MODAL)
|
|
|
|
ewin->state.modal = 1;
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_STICKY)
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetSticky(ewin, 1);
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SHADED)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.shaded = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_ext_task = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_ext_pager = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
|
2005-07-08 09:48:19 -07:00
|
|
|
; /* ewin->state.iconified = 1; No - WM_STATE does this */
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.maximized_vert = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.maximized_horz = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.fullscreen = 1;
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetLayer(ewin, 6);
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_BELOW)
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetLayer(ewin, 2);
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->state.attention = 1;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
|
|
|
Efree(p_atoms);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
2003-05-04 18:16:57 -07:00
|
|
|
static void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_GetWindowType(EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
Ecore_X_Atom *p_atoms, atom;
|
2003-03-27 21:16:21 -08:00
|
|
|
int n_atoms;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.all = 0;
|
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
n_atoms = ecore_x_window_prop_atom_list_get(EwinGetClientXwin(ewin),
|
2005-02-12 08:16:29 -08:00
|
|
|
ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
|
|
|
|
&p_atoms);
|
|
|
|
if (n_atoms <= 0)
|
2006-10-26 13:25:30 -07:00
|
|
|
{
|
|
|
|
if (EwinIsTransient(ewin))
|
|
|
|
ewin->ewmh.type.b.dialog = 1;
|
|
|
|
else
|
|
|
|
ewin->ewmh.type.b.normal = 1;
|
|
|
|
return;
|
|
|
|
}
|
2003-03-27 21:16:21 -08:00
|
|
|
|
|
|
|
atom = p_atoms[0];
|
2005-02-12 08:16:29 -08:00
|
|
|
if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetLayer(ewin, 0);
|
|
|
|
EoSetSticky(ewin, 1);
|
2005-12-22 10:56:02 -08:00
|
|
|
ewin->props.focusclick = 1;
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_focuslist = 1;
|
2005-11-12 09:51:11 -08:00
|
|
|
EwinInhSetUser(ewin, move, 1);
|
|
|
|
EwinInhSetUser(ewin, size, 1);
|
2004-09-19 02:27:38 -07:00
|
|
|
ewin->props.donthide = 1;
|
2005-12-22 10:43:15 -08:00
|
|
|
ewin->props.no_border = 1;
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.desktop = 1;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_ext_task = 1;
|
|
|
|
ewin->props.skip_winlist = 1;
|
|
|
|
ewin->props.skip_focuslist = 1;
|
2004-12-28 15:46:49 -08:00
|
|
|
EoSetSticky(ewin, 1);
|
2004-09-19 02:27:38 -07:00
|
|
|
ewin->props.donthide = 1;
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.dock = 1;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
|
2003-04-06 17:54:55 -07:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/* Epplets hit this */
|
2005-07-08 09:48:19 -07:00
|
|
|
ewin->props.skip_ext_task = 1;
|
|
|
|
ewin->props.skip_winlist = 1;
|
|
|
|
ewin->props.skip_focuslist = 1;
|
|
|
|
ewin->props.never_use_area = 1;
|
2004-09-19 02:27:38 -07:00
|
|
|
ewin->props.donthide = 1;
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.utility = 1;
|
2003-04-06 17:54:55 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
|
2003-07-11 12:49:57 -07:00
|
|
|
{
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.toolbar = 1;
|
2003-07-11 12:49:57 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
|
2003-07-11 12:49:57 -07:00
|
|
|
{
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.menu = 1;
|
2003-07-11 12:49:57 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
|
2003-07-11 12:49:57 -07:00
|
|
|
{
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.splash = 1;
|
2003-07-11 12:49:57 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
|
2003-07-11 12:49:57 -07:00
|
|
|
{
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.dialog = 1;
|
2003-07-11 12:49:57 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
|
2003-07-11 12:49:57 -07:00
|
|
|
{
|
2006-10-26 13:25:30 -07:00
|
|
|
ewin->ewmh.type.b.normal = 1;
|
2003-07-11 12:49:57 -07:00
|
|
|
}
|
|
|
|
Efree(p_atoms);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
2005-06-30 04:52:03 -07:00
|
|
|
static void
|
|
|
|
EWMH_GetWindowIcons(EWin * ewin)
|
|
|
|
{
|
|
|
|
unsigned int *val;
|
2005-07-17 03:22:49 -07:00
|
|
|
int num;
|
2005-06-30 04:52:03 -07:00
|
|
|
|
|
|
|
if (ewin->ewmh.wm_icon)
|
|
|
|
{
|
|
|
|
Efree(ewin->ewmh.wm_icon);
|
|
|
|
ewin->ewmh.wm_icon = NULL;
|
|
|
|
}
|
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_window_prop_card32_list_get(EwinGetClientXwin(ewin),
|
2005-06-30 04:52:03 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_ICON, &val);
|
|
|
|
ewin->ewmh.wm_icon_len = num;
|
|
|
|
if (num <= 0)
|
|
|
|
return;
|
|
|
|
|
2005-07-17 03:22:49 -07:00
|
|
|
if (num < 2 || num < (int)(2 + val[0] * val[1]))
|
2005-06-30 04:52:03 -07:00
|
|
|
{
|
|
|
|
Eprintf
|
|
|
|
("*** EWMH_GetWindowIcons Icon data/size mismatch (ignoring): %s: N=%d WxH=%dx%d\n",
|
2006-11-26 03:30:59 -08:00
|
|
|
EwinGetTitle(ewin), num, val[0], (num >= 2) ? val[1] : 0);
|
2005-06-30 04:52:03 -07:00
|
|
|
Efree(val);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ewin->ewmh.wm_icon = val;
|
|
|
|
|
|
|
|
EwinChange(ewin, EWIN_CHANGE_ICON_PMAP);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:28:01 -08:00
|
|
|
static void
|
|
|
|
EWMH_GetWindowUserTime(EWin * ewin)
|
|
|
|
{
|
|
|
|
#if 0 /* TBD */
|
|
|
|
int num;
|
|
|
|
unsigned int ts;
|
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_netwm_user_time_get(EwinGetClientXwin(ewin), &ts);
|
2005-11-14 11:28:01 -08:00
|
|
|
if (num <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Eprintf("EWMH_GetWindowUserTime %#x\n", ts);
|
|
|
|
#else
|
|
|
|
ewin = NULL;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-07-01 14:04:42 -07:00
|
|
|
static void
|
|
|
|
EWMH_GetWindowMisc(EWin * ewin)
|
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
int num;
|
|
|
|
Ecore_X_Window win;
|
2004-07-01 14:04:42 -07:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_window_prop_window_get(EwinGetClientXwin(ewin),
|
2005-02-12 08:16:29 -08:00
|
|
|
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK,
|
|
|
|
&win, 1);
|
|
|
|
if (num <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ewin->props.vroot = 1;
|
|
|
|
EoSetDesk(ewin, DesksGetCurrent());
|
2004-08-20 14:13:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
EWMH_GetWindowOpacity(EWin * ewin)
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
int num;
|
|
|
|
unsigned int opacity;
|
2004-08-20 14:13:56 -07:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_netwm_opacity_get(EwinGetClientXwin(ewin), &opacity);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (num <= 0)
|
|
|
|
return;
|
2004-08-20 14:13:56 -07:00
|
|
|
|
2005-03-24 15:38:12 -08:00
|
|
|
if (ewin->ewmh.opacity == opacity)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ewin->ewmh.opacity = opacity;
|
|
|
|
|
|
|
|
EwinChange(ewin, EWIN_CHANGE_OPACITY);
|
2004-07-01 14:04:42 -07:00
|
|
|
}
|
|
|
|
|
2004-07-02 17:58:19 -07:00
|
|
|
static void
|
|
|
|
EWMH_GetWindowStrut(EWin * ewin)
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
int num;
|
2005-07-09 03:15:18 -07:00
|
|
|
unsigned int val[12];
|
2004-12-28 15:46:49 -08:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_window_prop_card32_get(EwinGetClientXwin(ewin),
|
2005-07-09 03:15:18 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, val,
|
|
|
|
12);
|
|
|
|
|
|
|
|
if (num < 4)
|
2006-08-07 13:20:16 -07:00
|
|
|
num = ecore_x_window_prop_card32_get(EwinGetClientXwin(ewin),
|
2005-07-09 03:15:18 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_STRUT, val, 4);
|
2004-12-28 15:46:49 -08:00
|
|
|
if (num < 4)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ewin->strut.left = val[0];
|
|
|
|
ewin->strut.right = val[1];
|
|
|
|
ewin->strut.top = val[2];
|
|
|
|
ewin->strut.bottom = val[3];
|
2005-07-09 03:15:18 -07:00
|
|
|
#if 0 /* FIXME - Handle in placement code */
|
|
|
|
if (num < 12)
|
|
|
|
return;
|
|
|
|
ewin->strut.left_start_y = val[4];
|
|
|
|
ewin->strut.left_end_y = val[5];
|
|
|
|
ewin->strut.right_start_y = val[6];
|
|
|
|
ewin->strut.right_end_y = val[7];
|
|
|
|
ewin->strut.top_start_x = val[8];
|
|
|
|
ewin->strut.top_end_x = val[9];
|
|
|
|
ewin->strut.bottom_start_x = val[10];
|
|
|
|
ewin->strut.bottom_end_x = val[11];
|
|
|
|
#endif
|
2004-07-02 17:58:19 -07:00
|
|
|
}
|
|
|
|
|
2005-06-30 05:09:34 -07:00
|
|
|
void
|
2005-07-08 09:48:19 -07:00
|
|
|
EWMH_SetWindowActions(const EWin * ewin)
|
2005-06-30 05:09:34 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
Ecore_X_Atom aa[10];
|
|
|
|
int num;
|
2005-06-30 05:09:34 -07:00
|
|
|
|
2005-07-08 09:48:19 -07:00
|
|
|
num = 0;
|
|
|
|
if (!ewin->state.inhibit_move)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_MOVE;
|
|
|
|
if (!ewin->state.inhibit_resize)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
|
|
|
|
if (!ewin->state.inhibit_iconify)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
|
|
|
|
if (!ewin->state.inhibit_shade)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_SHADE;
|
|
|
|
if (!ewin->state.inhibit_stick)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_STICK;
|
|
|
|
if (!ewin->state.inhibit_max_hor)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
|
|
|
|
if (!ewin->state.inhibit_max_ver)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
|
|
|
|
if (!ewin->state.inhibit_fullscreeen)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
|
|
|
|
if (!ewin->state.inhibit_change_desk)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
|
|
|
|
if (!ewin->state.inhibit_close)
|
|
|
|
aa[num++] = ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
|
2005-06-30 05:09:34 -07:00
|
|
|
|
2006-08-07 13:20:16 -07:00
|
|
|
ecore_x_window_prop_atom_set(EwinGetClientXwin(ewin),
|
2005-07-08 09:48:19 -07:00
|
|
|
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, aa, num);
|
2005-06-30 05:09:34 -07:00
|
|
|
}
|
|
|
|
|
2003-03-23 19:48:09 -08:00
|
|
|
void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_GetWindowHints(EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2004-07-01 14:04:42 -07:00
|
|
|
EWMH_GetWindowMisc(ewin);
|
2004-08-20 14:13:56 -07:00
|
|
|
EWMH_GetWindowOpacity(ewin);
|
2004-02-28 17:30:18 -08:00
|
|
|
EWMH_GetWindowName(ewin);
|
|
|
|
EWMH_GetWindowIconName(ewin);
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_GetWindowDesktop(ewin);
|
|
|
|
EWMH_GetWindowState(ewin);
|
|
|
|
EWMH_GetWindowType(ewin);
|
2005-06-30 04:52:03 -07:00
|
|
|
EWMH_GetWindowIcons(ewin);
|
2004-07-02 17:58:19 -07:00
|
|
|
EWMH_GetWindowStrut(ewin);
|
2005-11-14 11:28:01 -08:00
|
|
|
EWMH_GetWindowUserTime(ewin);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete all (_NET_...) properties set on window
|
|
|
|
*/
|
|
|
|
void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_DelWindowHints(const EWin * ewin)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2006-08-07 13:20:16 -07:00
|
|
|
XDeleteProperty(disp, EwinGetClientXwin(ewin), ECORE_X_ATOM_NET_WM_DESKTOP);
|
|
|
|
XDeleteProperty(disp, EwinGetClientXwin(ewin), ECORE_X_ATOM_NET_WM_STATE);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process configuration requests from clients
|
|
|
|
*/
|
2003-03-27 21:16:21 -08:00
|
|
|
static int
|
|
|
|
do_set(int is_set, int action)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2003-03-27 21:16:21 -08:00
|
|
|
switch (action)
|
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
case _NET_WM_STATE_REMOVE:
|
|
|
|
return 0;
|
|
|
|
case _NET_WM_STATE_ADD:
|
|
|
|
return 1;
|
|
|
|
case _NET_WM_STATE_TOGGLE:
|
|
|
|
return !is_set;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2003-05-04 18:16:57 -07:00
|
|
|
return -1;
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-02-12 08:16:29 -08:00
|
|
|
EWMH_ProcessClientMessage(XClientMessageEvent * ev)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2003-03-27 21:16:21 -08:00
|
|
|
EWin *ewin;
|
2005-11-12 17:22:28 -08:00
|
|
|
int source;
|
|
|
|
Time ts;
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
/*
|
|
|
|
* The ones that don't target an application window
|
|
|
|
*/
|
2005-02-12 08:16:29 -08:00
|
|
|
if (ev->message_type == ECORE_X_ATOM_NET_CURRENT_DESKTOP)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-09-04 00:27:20 -07:00
|
|
|
DeskGotoNum(ev->data.l[0]);
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_DESKTOP_VIEWPORT)
|
2003-03-31 09:31:24 -08:00
|
|
|
{
|
2005-11-19 11:32:45 -08:00
|
|
|
DeskCurrentGotoArea(ev->data.l[0] / VRoot.w, ev->data.l[1] / VRoot.h);
|
2004-03-20 07:49:05 -08:00
|
|
|
goto done;
|
2003-03-31 09:31:24 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_SHOWING_DESKTOP)
|
2004-05-04 17:17:15 -07:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
EwinsShowDesktop(ev->data.l[0]);
|
2004-05-04 17:17:15 -07:00
|
|
|
goto done;
|
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
#if 0
|
2005-02-12 08:16:29 -08:00
|
|
|
Eprintf
|
|
|
|
("EWMH_ProcessClientMessage: ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN: %lx: %s\n",
|
|
|
|
ev->window, (char *)ev->data.l);
|
2004-12-28 15:46:49 -08:00
|
|
|
#endif
|
|
|
|
goto done;
|
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_STARTUP_INFO)
|
2004-12-28 15:46:49 -08:00
|
|
|
{
|
|
|
|
#if 0
|
2005-02-12 08:16:29 -08:00
|
|
|
Eprintf
|
|
|
|
("EWMH_ProcessClientMessage: ECORE_X_ATOM_NET_STARTUP_INFO : %lx: %s\n",
|
|
|
|
ev->window, (char *)ev->data.l);
|
2004-12-28 15:46:49 -08:00
|
|
|
#endif
|
|
|
|
goto done;
|
|
|
|
}
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2003-03-27 21:16:21 -08:00
|
|
|
/*
|
|
|
|
* The ones that do target an application window
|
|
|
|
*/
|
2005-06-30 05:50:47 -07:00
|
|
|
ewin = EwinFindByClient(ev->window);
|
2003-03-27 21:16:21 -08:00
|
|
|
if (ewin == NULL)
|
2005-02-12 08:16:29 -08:00
|
|
|
{
|
|
|
|
/* Some misbehaving clients go here */
|
|
|
|
if (ev->message_type == ECORE_X_ATOM_NET_WM_DESKTOP)
|
|
|
|
{
|
|
|
|
ecore_x_netwm_desktop_set(ev->window, ev->data.l[0]);
|
|
|
|
}
|
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_WM_STATE)
|
|
|
|
{
|
|
|
|
ecore_x_window_prop_atom_list_change(ev->window,
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
ev->data.l[1], ev->data.l[0]);
|
|
|
|
if (ev->data.l[2] ==
|
|
|
|
(long)ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ ||
|
|
|
|
ev->data.l[2] ==
|
|
|
|
(long)ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
|
|
|
|
ecore_x_window_prop_atom_list_change(ev->window,
|
|
|
|
ECORE_X_ATOM_NET_WM_STATE,
|
|
|
|
ev->data.l[2],
|
|
|
|
ev->data.l[0]);
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
2003-03-23 19:48:09 -08:00
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
if (ev->message_type == ECORE_X_ATOM_NET_ACTIVE_WINDOW)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-11-12 17:22:28 -08:00
|
|
|
source = OPSRC(ev->data.l[0]);
|
|
|
|
ts = ev->data.l[1];
|
|
|
|
/* cwin = ev->data.l[2]; */
|
|
|
|
EwinOpActivate(ewin, source);
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_CLOSE_WINDOW)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-11-12 17:22:28 -08:00
|
|
|
/* ts = ev->data.l[0]; */
|
|
|
|
source = OPSRC(ev->data.l[1]);
|
|
|
|
EwinOpClose(ewin, source);
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_WM_DESKTOP)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-11-12 17:22:28 -08:00
|
|
|
source = OPSRC(ev->data.l[1]);
|
2005-02-12 08:16:29 -08:00
|
|
|
if ((unsigned)ev->data.l[0] == 0xFFFFFFFF)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
if (!EoIsSticky(ewin))
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpStick(ewin, source, 1);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
if (EoIsSticky(ewin))
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpStick(ewin, source, 0);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2005-09-04 00:27:20 -07:00
|
|
|
EwinMoveToDesktop(ewin, DeskGet(ev->data.l[0]));
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_WM_STATE)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2003-05-22 12:15:03 -07:00
|
|
|
/*
|
|
|
|
* It is assumed(!) that only the MAXIMIZE H/V ones can be set
|
|
|
|
* in one message.
|
|
|
|
*/
|
2007-01-16 17:10:44 -08:00
|
|
|
unsigned int action;
|
2003-05-22 12:15:03 -07:00
|
|
|
Atom atom, atom2;
|
|
|
|
|
2005-02-12 08:16:29 -08:00
|
|
|
action = ev->data.l[0];
|
|
|
|
atom = ev->data.l[1];
|
|
|
|
atom2 = ev->data.l[2];
|
2005-11-12 17:22:28 -08:00
|
|
|
source = OPSRC(ev->data.l[3]);
|
2005-09-03 07:28:39 -07:00
|
|
|
if (atom == ECORE_X_ATOM_NET_WM_STATE_MODAL)
|
|
|
|
{
|
|
|
|
action = do_set(ewin->state.modal, action);
|
|
|
|
/* TBD */
|
|
|
|
ewin->state.modal = action;
|
|
|
|
}
|
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_STICKY)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
action = do_set(EoIsSticky(ewin), action);
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpStick(ewin, source, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SHADED)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
action = do_set(ewin->state.shaded, action);
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpShade(ewin, source, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
action = do_set(ewin->props.skip_ext_task, action);
|
|
|
|
ewin->props.skip_ext_task = action;
|
2005-06-02 15:11:09 -07:00
|
|
|
EWMH_SetWindowState(ewin);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
action = do_set(ewin->props.skip_ext_pager, action);
|
|
|
|
ewin->props.skip_ext_pager = action;
|
2005-06-02 15:11:09 -07:00
|
|
|
EWMH_SetWindowState(ewin);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT ||
|
|
|
|
atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-03-20 17:39:40 -08:00
|
|
|
void (*func) (EWin *, const char *);
|
2007-01-16 17:10:44 -08:00
|
|
|
unsigned int maxh, maxv;
|
2003-05-22 12:15:03 -07:00
|
|
|
|
2005-07-08 09:48:19 -07:00
|
|
|
maxh = ewin->state.maximized_horz;
|
|
|
|
maxv = ewin->state.maximized_vert;
|
2005-02-12 08:16:29 -08:00
|
|
|
if (atom2 == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT ||
|
|
|
|
atom2 == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
/* (ok - ok) */
|
2003-05-22 12:15:03 -07:00
|
|
|
func = MaxSize;
|
2004-05-31 13:30:12 -07:00
|
|
|
maxh = do_set(maxh, action);
|
|
|
|
maxv = do_set(maxv, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
|
|
|
func = MaxHeight;
|
2004-05-31 13:30:12 -07:00
|
|
|
maxv = do_set(maxv, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
func = MaxWidth;
|
2004-05-31 13:30:12 -07:00
|
|
|
maxh = do_set(maxh, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
|
|
|
|
2005-07-08 09:48:19 -07:00
|
|
|
if ((ewin->state.maximized_horz == maxh) &&
|
|
|
|
(ewin->state.maximized_vert == maxv))
|
2004-05-31 13:30:12 -07:00
|
|
|
goto done;
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
func(ewin, "available");
|
|
|
|
EWMH_SetWindowState(ewin);
|
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
action = do_set(ewin->state.fullscreen, action);
|
|
|
|
if (ewin->state.fullscreen == action)
|
2004-05-31 13:30:12 -07:00
|
|
|
goto done;
|
|
|
|
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpFullscreen(ewin, source, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
action = do_set(EoGetLayer(ewin) >= 6, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
if (action)
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpSetLayer(ewin, source, 6);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpSetLayer(ewin, source, 4);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_BELOW)
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-12-28 15:46:49 -08:00
|
|
|
action = do_set(EoGetLayer(ewin) <= 2, action);
|
2003-05-22 12:15:03 -07:00
|
|
|
if (action)
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpSetLayer(ewin, source, 2);
|
2003-05-22 12:15:03 -07:00
|
|
|
else
|
2005-11-12 17:22:28 -08:00
|
|
|
EwinOpSetLayer(ewin, source, 4);
|
2003-05-22 12:15:03 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
|
|
|
|
{
|
2005-07-08 09:48:19 -07:00
|
|
|
action = do_set(ewin->state.attention, action);
|
|
|
|
ewin->state.attention = action;
|
2005-06-02 15:11:09 -07:00
|
|
|
EWMH_SetWindowState(ewin);
|
2005-02-12 08:16:29 -08:00
|
|
|
}
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-07-09 17:23:52 -07:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_MOVERESIZE_WINDOW)
|
|
|
|
{
|
|
|
|
int flags, grav, x, y, w, h;
|
|
|
|
|
|
|
|
flags = ev->data.l[0];
|
|
|
|
grav = flags & 0xf;
|
|
|
|
if (grav == 0)
|
|
|
|
grav = ewin->client.grav;
|
2005-11-12 17:22:28 -08:00
|
|
|
x = (flags & 0x0100) ? ev->data.l[1] : EoGetX(ewin);
|
|
|
|
y = (flags & 0x0200) ? ev->data.l[2] : EoGetY(ewin);
|
|
|
|
w = (flags & 0x0400) ? ev->data.l[3] : ewin->client.w;
|
|
|
|
h = (flags & 0x0800) ? ev->data.l[4] : ewin->client.h;
|
|
|
|
/* source = OPSRC((flags & 0xF000) >> 12); */
|
2005-07-10 01:31:15 -07:00
|
|
|
EwinMoveResizeWithGravity(ewin, x, y, w, h, grav);
|
2005-07-09 17:23:52 -07:00
|
|
|
}
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE)
|
2003-03-27 21:16:21 -08:00
|
|
|
{
|
2005-11-12 17:22:28 -08:00
|
|
|
/* source = OPSRC(ev->data.l[4]); */
|
2005-02-12 08:16:29 -08:00
|
|
|
switch (ev->data.l[2])
|
2003-05-22 12:15:03 -07:00
|
|
|
{
|
2004-11-11 11:19:55 -08:00
|
|
|
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_TOP:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_RIGHT:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOM:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
|
|
|
|
case _NET_WM_MOVERESIZE_SIZE_LEFT:
|
2007-01-12 17:41:34 -08:00
|
|
|
ActionResizeStart(ewin, MODE_RESIZE);
|
2004-11-11 11:19:55 -08:00
|
|
|
break;
|
|
|
|
case _NET_WM_MOVERESIZE_MOVE:
|
2007-01-12 17:41:34 -08:00
|
|
|
ActionMoveStart(ewin, 0, 0);
|
2004-11-11 11:19:55 -08:00
|
|
|
break;
|
|
|
|
|
2003-05-22 12:15:03 -07:00
|
|
|
case _NET_WM_MOVERESIZE_SIZE_KEYBOARD:
|
2004-01-18 02:24:06 -08:00
|
|
|
/* doResize(NULL); */
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
case _NET_WM_MOVERESIZE_MOVE_KEYBOARD:
|
2004-01-18 02:24:06 -08:00
|
|
|
/* doMove(NULL); */
|
2003-05-22 12:15:03 -07:00
|
|
|
break;
|
|
|
|
}
|
2003-03-27 21:16:21 -08:00
|
|
|
}
|
2005-11-12 17:22:28 -08:00
|
|
|
else if (ev->message_type == ECORE_X_ATOM_NET_RESTACK_WINDOW)
|
|
|
|
{
|
|
|
|
/* source = OPSRC(ev->data.l[0]); */
|
|
|
|
/* FIXME - Implement */
|
|
|
|
}
|
2003-03-27 21:16:21 -08:00
|
|
|
|
2004-03-20 07:49:05 -08:00
|
|
|
done:
|
2005-01-25 13:58:28 -08:00
|
|
|
;
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process received window property change
|
|
|
|
*/
|
|
|
|
void
|
2003-03-27 21:16:21 -08:00
|
|
|
EWMH_ProcessPropertyChange(EWin * ewin, Atom atom_change)
|
2003-03-23 19:48:09 -08:00
|
|
|
{
|
2005-02-12 08:16:29 -08:00
|
|
|
if (atom_change == ECORE_X_ATOM_NET_WM_NAME)
|
2004-02-28 17:30:18 -08:00
|
|
|
EWMH_GetWindowName(ewin);
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom_change == ECORE_X_ATOM_NET_WM_ICON_NAME)
|
2004-02-28 17:30:18 -08:00
|
|
|
EWMH_GetWindowIconName(ewin);
|
2005-07-09 03:15:18 -07:00
|
|
|
else if (atom_change == ECORE_X_ATOM_NET_WM_STRUT_PARTIAL ||
|
|
|
|
atom_change == ECORE_X_ATOM_NET_WM_STRUT)
|
2004-07-02 17:58:19 -07:00
|
|
|
EWMH_GetWindowStrut(ewin);
|
2005-02-12 08:16:29 -08:00
|
|
|
else if (atom_change == ECORE_X_ATOM_NET_WM_WINDOW_OPACITY)
|
2004-08-20 14:13:56 -07:00
|
|
|
EWMH_GetWindowOpacity(ewin);
|
2005-11-14 11:28:01 -08:00
|
|
|
else if (atom_change == ECORE_X_ATOM_NET_WM_USER_TIME)
|
|
|
|
EWMH_GetWindowUserTime(ewin);
|
2003-03-23 19:48:09 -08:00
|
|
|
}
|