make openbox use the obt prop.c/h stuff
holy search and replace batman
This commit is contained in:
parent
e2ddfaf9ff
commit
0fcf5ead0f
21 changed files with 518 additions and 1211 deletions
|
@ -268,8 +268,6 @@ openbox_openbox_SOURCES = \
|
|||
openbox/place.h \
|
||||
openbox/popup.c \
|
||||
openbox/popup.h \
|
||||
openbox/prop.c \
|
||||
openbox/prop.h \
|
||||
openbox/resist.c \
|
||||
openbox/resist.h \
|
||||
openbox/screen.c \
|
||||
|
|
18
obt/prop.c
18
obt/prop.c
|
@ -100,14 +100,14 @@ void obt_prop_startup()
|
|||
CREATE(NET_WM_STRUT_PARTIAL, "_NET_WM_STRUT_PARTIAL");
|
||||
CREATE(NET_WM_ICON, "_NET_WM_ICON");
|
||||
CREATE(NET_WM_ICON_GEOMETRY, "_NET_WM_ICON_GEOMETRY");
|
||||
/* CREATE(NET_WM_PId, "_NET_WM_PID"); */
|
||||
CREATE(NET_WM_PID, "_NET_WM_PID");
|
||||
CREATE(NET_WM_ALLOWED_ACTIONS, "_NET_WM_ALLOWED_ACTIONS");
|
||||
CREATE(NET_WM_USER_TIME, "_NET_WM_USER_TIME");
|
||||
CREATE(NET_WM_USER_TIME_WINDOW, "_NET_WM_USER_TIME_WINDOW");
|
||||
/* CREATE(NET_WM_USER_TIME_WINDOW, "_NET_WM_USER_TIME_WINDOW"); */
|
||||
CREATE(KDE_NET_WM_FRAME_STRUT, "_KDE_NET_WM_FRAME_STRUT");
|
||||
CREATE(NET_FRAME_EXTENTS, "_NET_FRAME_EXTENTS");
|
||||
|
||||
/* CREATE(NET_WM_PING, "_NET_WM_PING"); */
|
||||
CREATE(NET_WM_PING, "_NET_WM_PING");
|
||||
#ifdef SYNC
|
||||
CREATE(NET_WM_SYNC_REQUEST, "_NET_WM_SYNC_REQUEST");
|
||||
CREATE(NET_WM_SYNC_REQUEST_COUNTER, "_NET_WM_SYNC_REQUEST_COUNTER");
|
||||
|
@ -437,6 +437,15 @@ void obt_prop_erase(Window win, Atom prop)
|
|||
void obt_prop_message(gint screen, Window about, Atom messagetype,
|
||||
glong data0, glong data1, glong data2, glong data3,
|
||||
glong data4, glong mask)
|
||||
{
|
||||
obt_prop_message_to(RootWindow(obt_display, screen), about, messagetype,
|
||||
data0, data1, data2, data3, data4, mask);
|
||||
}
|
||||
|
||||
void obt_prop_message_to(Window to, Window about,
|
||||
Atom messagetype,
|
||||
glong data0, glong data1, glong data2, glong data3,
|
||||
glong data4, glong mask)
|
||||
{
|
||||
XEvent ce;
|
||||
ce.xclient.type = ClientMessage;
|
||||
|
@ -449,6 +458,5 @@ void obt_prop_message(gint screen, Window about, Atom messagetype,
|
|||
ce.xclient.data.l[2] = data2;
|
||||
ce.xclient.data.l[3] = data3;
|
||||
ce.xclient.data.l[4] = data4;
|
||||
XSendEvent(obt_display, RootWindow(obt_display, screen), FALSE,
|
||||
mask, &ce);
|
||||
XSendEvent(obt_display, to, FALSE, mask, &ce);
|
||||
}
|
||||
|
|
79
obt/prop.h
79
obt/prop.h
|
@ -84,6 +84,19 @@ typedef enum {
|
|||
OBT_PROP_NET_WM_BOTTOMRIGHT,
|
||||
OBT_PROP_NET_WM_BOTTOMLEFT,
|
||||
|
||||
OBT_PROP_PRIVATE_PADDING1,
|
||||
OBT_PROP_PRIVATE_PADDING2,
|
||||
OBT_PROP_PRIVATE_PADDING3,
|
||||
OBT_PROP_PRIVATE_PADDING4,
|
||||
OBT_PROP_PRIVATE_PADDING5,
|
||||
OBT_PROP_PRIVATE_PADDING6,
|
||||
OBT_PROP_PRIVATE_PADDING7,
|
||||
OBT_PROP_PRIVATE_PADDING8,
|
||||
OBT_PROP_PRIVATE_PADDING9,
|
||||
OBT_PROP_PRIVATE_PADDING10,
|
||||
OBT_PROP_PRIVATE_PADDING11,
|
||||
OBT_PROP_PRIVATE_PADDING12,
|
||||
|
||||
/* Everything below here must go in net_supported on the root window */
|
||||
|
||||
/* root window properties */
|
||||
|
@ -127,14 +140,14 @@ typedef enum {
|
|||
OBT_PROP_NET_WM_STRUT_PARTIAL,
|
||||
OBT_PROP_NET_WM_ICON,
|
||||
OBT_PROP_NET_WM_ICON_GEOMETRY,
|
||||
/* OBT_PROP_NET_WM_PID, */
|
||||
OBT_PROP_NET_WM_PID,
|
||||
OBT_PROP_NET_WM_ALLOWED_ACTIONS,
|
||||
OBT_PROP_NET_WM_USER_TIME,
|
||||
OBT_PROP_NET_WM_USER_TIME_WINDOW,
|
||||
/* OBT_PROP_NET_WM_USER_TIME_WINDOW, */
|
||||
OBT_PROP_NET_FRAME_EXTENTS,
|
||||
|
||||
/* application protocols */
|
||||
/* OBT_PROP_NET_WM_PING, */
|
||||
OBT_PROP_NET_WM_PING,
|
||||
#ifdef SYNC
|
||||
OBT_PROP_NET_WM_SYNC_REQUEST,
|
||||
OBT_PROP_NET_WM_SYNC_REQUEST_COUNTER,
|
||||
|
@ -197,8 +210,6 @@ typedef enum {
|
|||
OBT_PROP_NUM_ATOMS
|
||||
} ObtPropAtom;
|
||||
|
||||
#define OB_PROP_NUM_PUBLIC_ATOMS (OB_PROP_NUM_ATOMS - OB_PROP_NET_SUPPORTED)
|
||||
|
||||
void obt_prop_startup();
|
||||
|
||||
Atom obt_prop_atom(ObtPropAtom a);
|
||||
|
@ -222,34 +233,44 @@ void obt_prop_erase(Window win, Atom prop);
|
|||
void obt_prop_message(gint screen, Window about, Atom messagetype,
|
||||
glong data0, glong data1, glong data2, glong data3,
|
||||
glong data4, glong mask);
|
||||
void obt_prop_message_to(Window to, Window about, Atom messagetype,
|
||||
glong data0, glong data1, glong data2, glong data3,
|
||||
glong data4, glong mask);
|
||||
|
||||
#define PROP_GET32(win, prop, type, ret) \
|
||||
(prop_get32(win, obt_prop_atom(OB_PROP_##prop), prop_atoms.type, ret))
|
||||
#define PROP_GETA32(win, prop, type, ret, nret) \
|
||||
(prop_get_array32(win, obt_prop_atom(OB_PROP_##prop), prop_atoms.type, \
|
||||
ret, nret))
|
||||
#define PROP_GETS(win, prop, type, ret) \
|
||||
(prop_get_string_##type(win, obt_prop_atom(OB_PROP_##prop), ret))
|
||||
#define PROP_GETSS(win, prop, type, ret) \
|
||||
(prop_get_strings_##type(win, obt_prop_atom(OB_PROP_##prop), ret))
|
||||
#define OBT_PROP_ATOM(prop) obt_prop_atom(OBT_PROP_##prop)
|
||||
|
||||
#define PROP_SET32(win, prop, type, val) \
|
||||
prop_set32(win, obt_prop_atom(OB_PROP_##prop), \
|
||||
obt_prop_atom(OB_PROP_##type), val)
|
||||
#define PROP_SETA32(win, prop, type, val, num) \
|
||||
prop_set_array32(win, obt_prop_atom(OB_PROP_##prop), \
|
||||
obt_prop_atom(OB_PROP_##type), val, num)
|
||||
#define PROP_SETS(win, prop, val) \
|
||||
prop_set_string_utf8(win, obt_prop_atom(OB_PROP_##prop), val)
|
||||
#define PROP_SETSS(win, prop, strs) \
|
||||
prop_set_strings_utf8(win, obt_prop_atom(OB_PROP_##prop), strs)
|
||||
#define OBT_PROP_GET32(win, prop, type, ret) \
|
||||
(obt_prop_get32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), ret))
|
||||
#define OBT_PROP_GETA32(win, prop, type, ret, nret) \
|
||||
(obt_prop_get_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
|
||||
ret, nret))
|
||||
#define OBT_PROP_GETS(win, prop, type, ret) \
|
||||
(obt_prop_get_string_##type(win, OBT_PROP_ATOM(prop), ret))
|
||||
#define OBT_PROP_GETSS(win, prop, type, ret) \
|
||||
(obt_prop_get_strings_##type(win, OBT_PROP_ATOM(prop), ret))
|
||||
|
||||
#define PROP_ERASE(win, prop) prop_erase(win, obt_prop_atom(OB_PROP_##prop))
|
||||
#define OBT_PROP_SET32(win, prop, type, val) \
|
||||
(obt_prop_set32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), val))
|
||||
#define OBT_PROP_SETA32(win, prop, type, val, num) \
|
||||
(obt_prop_set_array32(win, OBT_PROP_ATOM(prop), OBT_PROP_ATOM(type), \
|
||||
val, num))
|
||||
#define OBT_PROP_SETS(win, prop, val) \
|
||||
(obt_prop_set_string_utf8(win, OBT_PROP_ATOM(prop), val))
|
||||
#define OBT_PROP_SETSS(win, prop, strs) \
|
||||
(obt_prop_set_strings_utf8(win, OBT_PROP_ATOM(prop), strs))
|
||||
|
||||
#define PROP_MSG(screen, about, msgtype, data0, data1, data2, data3, data4) \
|
||||
(prop_message(screen, about, obt_prop_atom(OB_PROP_##msgtype), \
|
||||
data0, data1, data2, data3, data4, \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask))
|
||||
#define OBT_PROP_ERASE(win, prop) (obt_prop_erase(win, OBT_PROP_ATOM(prop)))
|
||||
|
||||
#define OBT_PROP_MSG(screen, about, msgtype, data0, data1, data2, data3, \
|
||||
data4) \
|
||||
(obt_prop_message(screen, about, OBT_PROP_ATOM(msgtype), \
|
||||
data0, data1, data2, data3, data4, \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask))
|
||||
|
||||
#define OBT_PROP_MSG(to, about, msgtype, data0, data1, data2, data3, \
|
||||
data4, mask) \
|
||||
(obt_prop_message_to(to, OBT_PROP_ATOM(msgtype), \
|
||||
data0, data1, data2, data3, data4, mask))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "openbox/actions.h"
|
||||
#include "openbox/prop.h"
|
||||
#include "openbox/moveresize.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||
|
||||
|
@ -19,8 +19,8 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
|||
guint32 corner;
|
||||
|
||||
corner = data->button != 0 ?
|
||||
prop_atoms.net_wm_moveresize_move :
|
||||
prop_atoms.net_wm_moveresize_move_keyboard;
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD);
|
||||
|
||||
moveresize_start(data->client, data->x, data->y, data->button, corner);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "openbox/actions.h"
|
||||
#include "openbox/prop.h"
|
||||
#include "openbox/moveresize.h"
|
||||
#include "openbox/client.h"
|
||||
#include "openbox/frame.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
typedef struct {
|
||||
gboolean corner_specified;
|
||||
|
@ -37,21 +37,21 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
|||
|
||||
o->corner_specified = TRUE;
|
||||
if (!g_ascii_strcasecmp(s, "top"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_top;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP);
|
||||
else if (!g_ascii_strcasecmp(s, "bottom"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_bottom;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM);
|
||||
else if (!g_ascii_strcasecmp(s, "left"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_left;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT);
|
||||
else if (!g_ascii_strcasecmp(s, "right"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_right;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT);
|
||||
else if (!g_ascii_strcasecmp(s, "topleft"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_topleft;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT);
|
||||
else if (!g_ascii_strcasecmp(s, "topright"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_topright;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT);
|
||||
else if (!g_ascii_strcasecmp(s, "bottomleft"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_bottomleft;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT);
|
||||
else if (!g_ascii_strcasecmp(s, "bottomright"))
|
||||
o->corner = prop_atoms.net_wm_moveresize_size_bottomright;
|
||||
o->corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT);
|
||||
else
|
||||
o->corner_specified = FALSE;
|
||||
|
||||
|
@ -77,7 +77,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
|||
guint32 corner;
|
||||
|
||||
if (!data->button)
|
||||
corner = prop_atoms.net_wm_moveresize_size_keyboard;
|
||||
corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD);
|
||||
else if (o->corner_specified)
|
||||
corner = o->corner; /* it was specified in the binding */
|
||||
else
|
||||
|
@ -163,30 +163,30 @@ static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
|
|||
if (shaded) {
|
||||
/* for shaded windows, you can only resize west/east and move */
|
||||
if (b)
|
||||
return prop_atoms.net_wm_moveresize_size_left;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT);
|
||||
if (c)
|
||||
return prop_atoms.net_wm_moveresize_size_right;
|
||||
return prop_atoms.net_wm_moveresize_move;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT);
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE);
|
||||
}
|
||||
|
||||
if (y < A && y >= C)
|
||||
return prop_atoms.net_wm_moveresize_size_topleft;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT);
|
||||
else if (y >= A && y >= B && a)
|
||||
return prop_atoms.net_wm_moveresize_size_top;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP);
|
||||
else if (y < B && y >= D)
|
||||
return prop_atoms.net_wm_moveresize_size_topright;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT);
|
||||
else if (y < C && y >= E && b)
|
||||
return prop_atoms.net_wm_moveresize_size_left;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT);
|
||||
else if (y < D && y >= F && c)
|
||||
return prop_atoms.net_wm_moveresize_size_right;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT);
|
||||
else if (y < E && y >= G)
|
||||
return prop_atoms.net_wm_moveresize_size_bottomleft;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT);
|
||||
else if (y < G && y < H && d)
|
||||
return prop_atoms.net_wm_moveresize_size_bottom;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM);
|
||||
else if (y >= H && y < F)
|
||||
return prop_atoms.net_wm_moveresize_size_bottomright;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT);
|
||||
else
|
||||
return prop_atoms.net_wm_moveresize_move;
|
||||
return OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE);
|
||||
|
||||
#undef X
|
||||
#undef A
|
||||
|
|
346
openbox/client.c
346
openbox/client.c
|
@ -25,7 +25,6 @@
|
|||
#include "moveresize.h"
|
||||
#include "ping.h"
|
||||
#include "place.h"
|
||||
#include "prop.h"
|
||||
#include "frame.h"
|
||||
#include "session.h"
|
||||
#include "event.h"
|
||||
|
@ -41,6 +40,7 @@
|
|||
#include "render/render.h"
|
||||
#include "gettext.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
|
@ -165,8 +165,8 @@ void client_set_list(void)
|
|||
} else
|
||||
windows = NULL;
|
||||
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
net_client_list, window, (gulong*)windows, size);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_CLIENT_LIST, WINDOW, (gulong*)windows, size);
|
||||
|
||||
if (windows)
|
||||
g_free(windows);
|
||||
|
@ -771,9 +771,9 @@ void client_unmanage(ObClient *self)
|
|||
if (ob_state() != OB_STATE_EXITING) {
|
||||
/* these values should not be persisted across a window
|
||||
unmapping/mapping */
|
||||
PROP_ERASE(self->window, net_wm_desktop);
|
||||
PROP_ERASE(self->window, net_wm_state);
|
||||
PROP_ERASE(self->window, wm_state);
|
||||
OBT_PROP_ERASE(self->window, NET_WM_DESKTOP);
|
||||
OBT_PROP_ERASE(self->window, NET_WM_STATE);
|
||||
OBT_PROP_ERASE(self->window, WM_STATE);
|
||||
} else {
|
||||
/* if we're left in an unmapped state, the client wont be mapped.
|
||||
this is bad, since we will no longer be managing the window on
|
||||
|
@ -927,7 +927,7 @@ static void client_restore_session_state(ObClient *self)
|
|||
self->desktop = (self->session->desktop == DESKTOP_ALL ?
|
||||
self->session->desktop :
|
||||
MIN(screen_num_desktops - 1, self->session->desktop));
|
||||
PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
|
||||
OBT_PROP_SET32(self->window, NET_WM_DESKTOP, CARDINAL, self->desktop);
|
||||
|
||||
self->shaded = self->session->shaded;
|
||||
self->iconic = self->session->iconic;
|
||||
|
@ -1145,10 +1145,11 @@ static void client_get_all(ObClient *self, gboolean real)
|
|||
|
||||
static void client_get_startup_id(ObClient *self)
|
||||
{
|
||||
if (!(PROP_GETS(self->window, net_startup_id, utf8, &self->startup_id)))
|
||||
if (!(OBT_PROP_GETS(self->window, NET_STARTUP_ID, utf8,
|
||||
&self->startup_id)))
|
||||
if (self->group)
|
||||
PROP_GETS(self->group->leader,
|
||||
net_startup_id, utf8, &self->startup_id);
|
||||
OBT_PROP_GETS(self->group->leader,
|
||||
NET_STARTUP_ID, utf8, &self->startup_id);
|
||||
}
|
||||
|
||||
static void client_get_area(ObClient *self)
|
||||
|
@ -1171,7 +1172,7 @@ static void client_get_desktop(ObClient *self)
|
|||
{
|
||||
guint32 d = screen_num_desktops; /* an always-invalid value */
|
||||
|
||||
if (PROP_GET32(self->window, net_wm_desktop, cardinal, &d)) {
|
||||
if (OBT_PROP_GET32(self->window, NET_WM_DESKTOP, CARDINAL, &d)) {
|
||||
if (d >= screen_num_desktops && d != DESKTOP_ALL)
|
||||
self->desktop = screen_num_desktops - 1;
|
||||
else
|
||||
|
@ -1224,32 +1225,32 @@ static void client_get_state(ObClient *self)
|
|||
guint32 *state;
|
||||
guint num;
|
||||
|
||||
if (PROP_GETA32(self->window, net_wm_state, atom, &state, &num)) {
|
||||
if (OBT_PROP_GETA32(self->window, NET_WM_STATE, ATOM, &state, &num)) {
|
||||
gulong i;
|
||||
for (i = 0; i < num; ++i) {
|
||||
if (state[i] == prop_atoms.net_wm_state_modal)
|
||||
if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_MODAL))
|
||||
self->modal = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_shaded)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_SHADED))
|
||||
self->shaded = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_hidden)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_HIDDEN))
|
||||
self->iconic = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_skip_taskbar)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR))
|
||||
self->skip_taskbar = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_skip_pager)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER))
|
||||
self->skip_pager = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_fullscreen)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN))
|
||||
self->fullscreen = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_maximized_vert)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT))
|
||||
self->max_vert = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_maximized_horz)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ))
|
||||
self->max_horz = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_above)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_ABOVE))
|
||||
self->above = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_below)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_BELOW))
|
||||
self->below = TRUE;
|
||||
else if (state[i] == prop_atoms.net_wm_state_demands_attention)
|
||||
else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION))
|
||||
self->demands_attention = TRUE;
|
||||
else if (state[i] == prop_atoms.ob_wm_state_undecorated)
|
||||
else if (state[i] == OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED))
|
||||
self->undecorated = TRUE;
|
||||
}
|
||||
|
||||
|
@ -1433,8 +1434,8 @@ static void client_get_mwm_hints(ObClient *self)
|
|||
|
||||
self->mwmhints.flags = 0; /* default to none */
|
||||
|
||||
if (PROP_GETA32(self->window, motif_wm_hints, motif_wm_hints,
|
||||
&hints, &num)) {
|
||||
if (OBT_PROP_GETA32(self->window, MOTIF_WM_HINTS, MOTIF_WM_HINTS,
|
||||
&hints, &num)) {
|
||||
if (num >= OB_MWM_ELEMENTS) {
|
||||
self->mwmhints.flags = hints[0];
|
||||
self->mwmhints.functions = hints[1];
|
||||
|
@ -1453,26 +1454,27 @@ void client_get_type_and_transientness(ObClient *self)
|
|||
self->type = -1;
|
||||
self->transient = FALSE;
|
||||
|
||||
if (PROP_GETA32(self->window, net_wm_window_type, atom, &val, &num)) {
|
||||
if (OBT_PROP_GETA32(self->window, NET_WM_WINDOW_TYPE, ATOM, &val, &num)) {
|
||||
/* use the first value that we know about in the array */
|
||||
for (i = 0; i < num; ++i) {
|
||||
if (val[i] == prop_atoms.net_wm_window_type_desktop)
|
||||
if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DESKTOP))
|
||||
self->type = OB_CLIENT_TYPE_DESKTOP;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_dock)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK))
|
||||
self->type = OB_CLIENT_TYPE_DOCK;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_toolbar)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_TOOLBAR))
|
||||
self->type = OB_CLIENT_TYPE_TOOLBAR;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_menu)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_MENU))
|
||||
self->type = OB_CLIENT_TYPE_MENU;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_utility)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_UTILITY))
|
||||
self->type = OB_CLIENT_TYPE_UTILITY;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_splash)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_SPLASH))
|
||||
self->type = OB_CLIENT_TYPE_SPLASH;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_dialog)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DIALOG))
|
||||
self->type = OB_CLIENT_TYPE_DIALOG;
|
||||
else if (val[i] == prop_atoms.net_wm_window_type_normal)
|
||||
else if (val[i] == OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_NORMAL))
|
||||
self->type = OB_CLIENT_TYPE_NORMAL;
|
||||
else if (val[i] == prop_atoms.kde_net_wm_window_type_override) {
|
||||
else if (val[i] == OBT_PROP_ATOM(KDE_NET_WM_WINDOW_TYPE_OVERRIDE))
|
||||
{
|
||||
/* prevent this window from getting any decor or
|
||||
functionality */
|
||||
self->mwmhints.flags &= (OB_MWM_FLAG_FUNCTIONS |
|
||||
|
@ -1512,17 +1514,17 @@ void client_get_type_and_transientness(ObClient *self)
|
|||
void client_update_protocols(ObClient *self)
|
||||
{
|
||||
guint32 *proto;
|
||||
guint num_return, i;
|
||||
guint num_ret, i;
|
||||
|
||||
self->focus_notify = FALSE;
|
||||
self->delete_window = FALSE;
|
||||
|
||||
if (PROP_GETA32(self->window, wm_protocols, atom, &proto, &num_return)) {
|
||||
for (i = 0; i < num_return; ++i) {
|
||||
if (proto[i] == prop_atoms.wm_delete_window)
|
||||
if (OBT_PROP_GETA32(self->window, WM_PROTOCOLS, ATOM, &proto, &num_ret)) {
|
||||
for (i = 0; i < num_ret; ++i) {
|
||||
if (proto[i] == OBT_PROP_ATOM(WM_DELETE_WINDOW))
|
||||
/* this means we can request the window to close */
|
||||
self->delete_window = TRUE;
|
||||
else if (proto[i] == prop_atoms.wm_take_focus)
|
||||
else if (proto[i] == OBT_PROP_ATOM(WM_TAKE_FOCUS))
|
||||
/* if this protocol is requested, then the window will be
|
||||
notified whenever we want it to receive focus */
|
||||
self->focus_notify = TRUE;
|
||||
|
@ -1531,7 +1533,7 @@ void client_update_protocols(ObClient *self)
|
|||
pings to determine if it is still alive */
|
||||
self->ping = TRUE;
|
||||
#ifdef SYNC
|
||||
else if (proto[i] == prop_atoms.net_wm_sync_request)
|
||||
else if (proto[i] == OBT_PROP_ATOM(NET_WM_SYNC_REQUEST))
|
||||
/* if this protocol is requested, then resizing the
|
||||
window will be synchronized between the frame and the
|
||||
client */
|
||||
|
@ -1547,7 +1549,8 @@ void client_update_sync_request_counter(ObClient *self)
|
|||
{
|
||||
guint32 i;
|
||||
|
||||
if (PROP_GET32(self->window, net_wm_sync_request_counter, cardinal, &i)) {
|
||||
if (OBT_PROP_GET32(self->window, NET_WM_SYNC_REQUEST_COUNTER, CARDINAL,&i))
|
||||
{
|
||||
self->sync_counter = i;
|
||||
} else
|
||||
self->sync_counter = None;
|
||||
|
@ -1802,32 +1805,32 @@ static void client_change_allowed_actions(ObClient *self)
|
|||
|
||||
/* desktop windows are kept on all desktops */
|
||||
if (self->type != OB_CLIENT_TYPE_DESKTOP)
|
||||
actions[num++] = prop_atoms.net_wm_action_change_desktop;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_CHANGE_DESKTOP);
|
||||
|
||||
if (self->functions & OB_CLIENT_FUNC_SHADE)
|
||||
actions[num++] = prop_atoms.net_wm_action_shade;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_SHADE);
|
||||
if (self->functions & OB_CLIENT_FUNC_CLOSE)
|
||||
actions[num++] = prop_atoms.net_wm_action_close;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_CLOSE);
|
||||
if (self->functions & OB_CLIENT_FUNC_MOVE)
|
||||
actions[num++] = prop_atoms.net_wm_action_move;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_MOVE);
|
||||
if (self->functions & OB_CLIENT_FUNC_ICONIFY)
|
||||
actions[num++] = prop_atoms.net_wm_action_minimize;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_MINIMIZE);
|
||||
if (self->functions & OB_CLIENT_FUNC_RESIZE)
|
||||
actions[num++] = prop_atoms.net_wm_action_resize;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_RESIZE);
|
||||
if (self->functions & OB_CLIENT_FUNC_FULLSCREEN)
|
||||
actions[num++] = prop_atoms.net_wm_action_fullscreen;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_FULLSCREEN);
|
||||
if (self->functions & OB_CLIENT_FUNC_MAXIMIZE) {
|
||||
actions[num++] = prop_atoms.net_wm_action_maximize_horz;
|
||||
actions[num++] = prop_atoms.net_wm_action_maximize_vert;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_HORZ);
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_VERT);
|
||||
}
|
||||
if (self->functions & OB_CLIENT_FUNC_ABOVE)
|
||||
actions[num++] = prop_atoms.net_wm_action_above;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_ABOVE);
|
||||
if (self->functions & OB_CLIENT_FUNC_BELOW)
|
||||
actions[num++] = prop_atoms.net_wm_action_below;
|
||||
actions[num++] = OBT_PROP_ATOM(NET_WM_ACTION_BELOW);
|
||||
if (self->functions & OB_CLIENT_FUNC_UNDECORATE)
|
||||
actions[num++] = prop_atoms.ob_wm_action_undecorate;
|
||||
actions[num++] = OBT_PROP_ATOM(OB_WM_ACTION_UNDECORATE);
|
||||
|
||||
PROP_SETA32(self->window, net_wm_allowed_actions, atom, actions, num);
|
||||
OBT_PROP_SETA32(self->window, NET_WM_ALLOWED_ACTIONS, ATOM, actions, num);
|
||||
|
||||
/* make sure the window isn't breaking any rules now */
|
||||
|
||||
|
@ -1945,10 +1948,10 @@ void client_update_title(ObClient *self)
|
|||
g_free(self->title);
|
||||
|
||||
/* try netwm */
|
||||
if (!PROP_GETS(self->window, net_wm_name, utf8, &data)) {
|
||||
if (!OBT_PROP_GETS(self->window, NET_WM_NAME, utf8, &data)) {
|
||||
/* try old x stuff */
|
||||
if (!(PROP_GETS(self->window, wm_name, locale, &data)
|
||||
|| PROP_GETS(self->window, wm_name, utf8, &data))) {
|
||||
if (!(OBT_PROP_GETS(self->window, WM_NAME, locale, &data)
|
||||
|| OBT_PROP_GETS(self->window, WM_NAME, utf8, &data))) {
|
||||
if (self->transient) {
|
||||
/*
|
||||
GNOME alert windows are not given titles:
|
||||
|
@ -1975,7 +1978,7 @@ void client_update_title(ObClient *self)
|
|||
g_free(data);
|
||||
}
|
||||
|
||||
PROP_SETS(self->window, net_wm_visible_name, visible);
|
||||
OBT_PROP_SETS(self->window, NET_WM_VISIBLE_NAME, visible);
|
||||
self->title = visible;
|
||||
|
||||
if (self->frame)
|
||||
|
@ -1986,10 +1989,10 @@ void client_update_title(ObClient *self)
|
|||
g_free(self->icon_title);
|
||||
|
||||
/* try netwm */
|
||||
if (!PROP_GETS(self->window, net_wm_icon_name, utf8, &data))
|
||||
if (!OBT_PROP_GETS(self->window, NET_WM_ICON_NAME, utf8, &data))
|
||||
/* try old x stuff */
|
||||
if (!(PROP_GETS(self->window, wm_icon_name, locale, &data) ||
|
||||
PROP_GETS(self->window, wm_icon_name, utf8, &data)))
|
||||
if (!(OBT_PROP_GETS(self->window, WM_ICON_NAME, locale, &data) ||
|
||||
OBT_PROP_GETS(self->window, WM_ICON_NAME, utf8, &data)))
|
||||
data = g_strdup(self->title);
|
||||
|
||||
if (self->client_machine) {
|
||||
|
@ -2007,7 +2010,7 @@ void client_update_title(ObClient *self)
|
|||
g_free(data);
|
||||
}
|
||||
|
||||
PROP_SETS(self->window, net_wm_visible_icon_name, visible);
|
||||
OBT_PROP_SETS(self->window, NET_WM_VISIBLE_ICON_NAME, visible);
|
||||
self->icon_title = visible;
|
||||
}
|
||||
|
||||
|
@ -2018,8 +2021,9 @@ void client_update_strut(ObClient *self)
|
|||
gboolean got = FALSE;
|
||||
StrutPartial strut;
|
||||
|
||||
if (PROP_GETA32(self->window, net_wm_strut_partial, cardinal,
|
||||
&data, &num)) {
|
||||
if (OBT_PROP_GETA32(self->window, NET_WM_STRUT_PARTIAL, CARDINAL,
|
||||
&data, &num))
|
||||
{
|
||||
if (num == 12) {
|
||||
got = TRUE;
|
||||
STRUT_PARTIAL_SET(strut,
|
||||
|
@ -2031,7 +2035,7 @@ void client_update_strut(ObClient *self)
|
|||
}
|
||||
|
||||
if (!got &&
|
||||
PROP_GETA32(self->window, net_wm_strut, cardinal, &data, &num)) {
|
||||
OBT_PROP_GETA32(self->window, NET_WM_STRUT, CARDINAL, &data, &num)) {
|
||||
if (num == 4) {
|
||||
Rect *a;
|
||||
|
||||
|
@ -2077,7 +2081,7 @@ void client_update_icons(ObClient *self)
|
|||
g_free(self->icons);
|
||||
self->nicons = 0;
|
||||
|
||||
if (PROP_GETA32(self->window, net_wm_icon, cardinal, &data, &num)) {
|
||||
if (OBT_PROP_GETA32(self->window, NET_WM_ICON, CARDINAL, &data, &num)) {
|
||||
/* figure out how many valid icons are in here */
|
||||
i = 0;
|
||||
while (num - i > 2) {
|
||||
|
@ -2159,7 +2163,7 @@ void client_update_icons(ObClient *self)
|
|||
(((icon[i] >> RrDefaultRedOffset) & 0xff) << 16) +
|
||||
(((icon[i] >> RrDefaultGreenOffset) & 0xff) << 8) +
|
||||
(((icon[i] >> RrDefaultBlueOffset) & 0xff) << 0);
|
||||
PROP_SETA32(self->window, net_wm_icon, cardinal, data, 48*48+2);
|
||||
OBT_PROP_SETA32(self->window, NET_WM_ICON, CARDINAL, data, 48*48+2);
|
||||
g_free(data);
|
||||
} else if (self->frame)
|
||||
/* don't draw the icon empty if we're just setting one now anyways,
|
||||
|
@ -2174,8 +2178,8 @@ void client_update_icon_geometry(ObClient *self)
|
|||
|
||||
RECT_SET(self->icon_geometry, 0, 0, 0, 0);
|
||||
|
||||
if (PROP_GETA32(self->window, net_wm_icon_geometry, cardinal, &data, &num)
|
||||
&& num == 4)
|
||||
if (OBT_PROP_GETA32(self->window, NET_WM_ICON_GEOMETRY, CARDINAL,
|
||||
&data, &num) && num == 4)
|
||||
{
|
||||
/* don't let them set it with an area < 0 */
|
||||
RECT_SET(self->icon_geometry, data[0], data[1],
|
||||
|
@ -2190,23 +2194,23 @@ static void client_get_session_ids(ObClient *self)
|
|||
gchar *s;
|
||||
gchar **ss;
|
||||
|
||||
if (!PROP_GET32(self->window, wm_client_leader, window, &leader))
|
||||
if (!OBT_PROP_GET32(self->window, WM_CLIENT_LEADER, WINDOW, &leader))
|
||||
leader = None;
|
||||
|
||||
/* get the SM_CLIENT_ID */
|
||||
got = FALSE;
|
||||
if (leader)
|
||||
got = PROP_GETS(leader, sm_client_id, locale, &self->sm_client_id);
|
||||
got = OBT_PROP_GETS(leader, SM_CLIENT_ID, locale, &self->sm_client_id);
|
||||
if (!got)
|
||||
PROP_GETS(self->window, sm_client_id, locale, &self->sm_client_id);
|
||||
OBT_PROP_GETS(self->window, SM_CLIENT_ID, locale, &self->sm_client_id);
|
||||
|
||||
/* get the WM_CLASS (name and class). make them "" if they are not
|
||||
provided */
|
||||
got = FALSE;
|
||||
if (leader)
|
||||
got = PROP_GETSS(leader, wm_class, locale, &ss);
|
||||
got = OBT_PROP_GETSS(leader, WM_CLASS, locale, &ss);
|
||||
if (!got)
|
||||
got = PROP_GETSS(self->window, wm_class, locale, &ss);
|
||||
got = OBT_PROP_GETSS(self->window, WM_CLASS, locale, &ss);
|
||||
|
||||
if (got) {
|
||||
if (ss[0]) {
|
||||
|
@ -2223,9 +2227,9 @@ static void client_get_session_ids(ObClient *self)
|
|||
/* get the WM_WINDOW_ROLE. make it "" if it is not provided */
|
||||
got = FALSE;
|
||||
if (leader)
|
||||
got = PROP_GETS(leader, wm_window_role, locale, &s);
|
||||
got = OBT_PROP_GETS(leader, WM_WINDOW_ROLE, locale, &s);
|
||||
if (!got)
|
||||
got = PROP_GETS(self->window, wm_window_role, locale, &s);
|
||||
got = OBT_PROP_GETS(self->window, WM_WINDOW_ROLE, locale, &s);
|
||||
|
||||
if (got)
|
||||
self->role = s;
|
||||
|
@ -2236,9 +2240,9 @@ static void client_get_session_ids(ObClient *self)
|
|||
got = FALSE;
|
||||
|
||||
if (leader)
|
||||
got = PROP_GETSS(leader, wm_command, locale, &ss);
|
||||
got = OBT_PROP_GETSS(leader, WM_COMMAND, locale, &ss);
|
||||
if (!got)
|
||||
got = PROP_GETSS(self->window, wm_command, locale, &ss);
|
||||
got = OBT_PROP_GETSS(self->window, WM_COMMAND, locale, &ss);
|
||||
|
||||
if (got) {
|
||||
/* merge/mash them all together */
|
||||
|
@ -2261,9 +2265,9 @@ static void client_get_session_ids(ObClient *self)
|
|||
/* get the WM_CLIENT_MACHINE */
|
||||
got = FALSE;
|
||||
if (leader)
|
||||
got = PROP_GETS(leader, wm_client_machine, locale, &s);
|
||||
got = OBT_PROP_GETS(leader, WM_CLIENT_MACHINE, locale, &s);
|
||||
if (!got)
|
||||
got = PROP_GETS(self->window, wm_client_machine, locale, &s);
|
||||
got = OBT_PROP_GETS(self->window, WM_CLIENT_MACHINE, locale, &s);
|
||||
|
||||
if (got) {
|
||||
gchar localhost[128];
|
||||
|
@ -2298,12 +2302,12 @@ static void client_change_wm_state(ObClient *self)
|
|||
self->wmstate = NormalState;
|
||||
|
||||
if (old != self->wmstate) {
|
||||
PROP_MSG(self->window, kde_wm_change_state,
|
||||
self->wmstate, 1, 0, 0);
|
||||
OBT_PROP_MSG(ob_screen, self->window, KDE_WM_CHANGE_STATE,
|
||||
self->wmstate, 1, 0, 0, 0);
|
||||
|
||||
state[0] = self->wmstate;
|
||||
state[1] = None;
|
||||
PROP_SETA32(self->window, wm_state, wm_state, state, 2);
|
||||
OBT_PROP_SETA32(self->window, WM_STATE, WM_STATE, state, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2314,30 +2318,30 @@ static void client_change_state(ObClient *self)
|
|||
|
||||
num = 0;
|
||||
if (self->modal)
|
||||
netstate[num++] = prop_atoms.net_wm_state_modal;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_MODAL);
|
||||
if (self->shaded)
|
||||
netstate[num++] = prop_atoms.net_wm_state_shaded;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_SHADED);
|
||||
if (self->iconic)
|
||||
netstate[num++] = prop_atoms.net_wm_state_hidden;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_HIDDEN);
|
||||
if (self->skip_taskbar)
|
||||
netstate[num++] = prop_atoms.net_wm_state_skip_taskbar;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR);
|
||||
if (self->skip_pager)
|
||||
netstate[num++] = prop_atoms.net_wm_state_skip_pager;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER);
|
||||
if (self->fullscreen)
|
||||
netstate[num++] = prop_atoms.net_wm_state_fullscreen;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN);
|
||||
if (self->max_vert)
|
||||
netstate[num++] = prop_atoms.net_wm_state_maximized_vert;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT);
|
||||
if (self->max_horz)
|
||||
netstate[num++] = prop_atoms.net_wm_state_maximized_horz;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ);
|
||||
if (self->above)
|
||||
netstate[num++] = prop_atoms.net_wm_state_above;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_ABOVE);
|
||||
if (self->below)
|
||||
netstate[num++] = prop_atoms.net_wm_state_below;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_BELOW);
|
||||
if (self->demands_attention)
|
||||
netstate[num++] = prop_atoms.net_wm_state_demands_attention;
|
||||
netstate[num++] = OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION);
|
||||
if (self->undecorated)
|
||||
netstate[num++] = prop_atoms.ob_wm_state_undecorated;
|
||||
PROP_SETA32(self->window, net_wm_state, atom, netstate, num);
|
||||
netstate[num++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
|
||||
OBT_PROP_SETA32(self->window, NET_WM_STATE, ATOM, netstate, num);
|
||||
|
||||
if (self->frame)
|
||||
frame_adjust_state(self->frame);
|
||||
|
@ -2636,7 +2640,7 @@ static void client_apply_startup_state(ObClient *self,
|
|||
client_configure(self, x, y, w, h, FALSE, TRUE, FALSE);
|
||||
|
||||
/* set the desktop hint, to make sure that it always exists */
|
||||
PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
|
||||
OBT_PROP_SET32(self->window, NET_WM_DESKTOP, CARDINAL, self->desktop);
|
||||
|
||||
/* nothing to do for the other states:
|
||||
skip_taskbar
|
||||
|
@ -3235,9 +3239,9 @@ void client_close(ObClient *self)
|
|||
client_kill(self);
|
||||
else
|
||||
/* request the client to close with WM_DELETE_WINDOW */
|
||||
PROP_MSG_TO(self->window, self->window, wm_protocols,
|
||||
prop_atoms.wm_delete_window, event_curtime, 0, 0, 0,
|
||||
NoEventMask);
|
||||
OBT_PROP_MSG_TO(self->window, self->window, WM_PROTOCOLS,
|
||||
OBT_PROP_ATOM(WM_DELETE_WINDOW), event_curtime, 0, 0,
|
||||
NoEventMask);
|
||||
}
|
||||
|
||||
void client_kill(ObClient *self)
|
||||
|
@ -3295,7 +3299,7 @@ static void client_set_desktop_recursive(ObClient *self,
|
|||
|
||||
old = self->desktop;
|
||||
self->desktop = target;
|
||||
PROP_SET32(self->window, net_wm_desktop, cardinal, target);
|
||||
OBT_PROP_SET32(self->window, NET_WM_DESKTOP, CARDINAL, target);
|
||||
/* the frame can display the current desktop state */
|
||||
frame_adjust_state(self->frame);
|
||||
/* 'move' the window to the new desktop */
|
||||
|
@ -3391,9 +3395,9 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
|
|||
gboolean below = self->below;
|
||||
gint i;
|
||||
|
||||
if (!(action == prop_atoms.net_wm_state_add ||
|
||||
action == prop_atoms.net_wm_state_remove ||
|
||||
action == prop_atoms.net_wm_state_toggle))
|
||||
if (!(action == OBT_PROP_ATOM(NET_WM_STATE_ADD) ||
|
||||
action == OBT_PROP_ATOM(NET_WM_STATE_REMOVE) ||
|
||||
action == OBT_PROP_ATOM(NET_WM_STATE_TOGGLE)))
|
||||
/* an invalid action was passed to the client message, ignore it */
|
||||
return;
|
||||
|
||||
|
@ -3403,103 +3407,103 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
|
|||
if (!state) continue;
|
||||
|
||||
/* if toggling, then pick whether we're adding or removing */
|
||||
if (action == prop_atoms.net_wm_state_toggle) {
|
||||
if (state == prop_atoms.net_wm_state_modal)
|
||||
action = modal ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_maximized_vert)
|
||||
action = self->max_vert ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_maximized_horz)
|
||||
action = self->max_horz ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_shaded)
|
||||
action = shaded ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_skip_taskbar)
|
||||
if (action == OBT_PROP_ATOM(NET_WM_STATE_TOGGLE)) {
|
||||
if (state == OBT_PROP_ATOM(NET_WM_STATE_MODAL))
|
||||
action = modal ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT))
|
||||
action = self->max_vert ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ))
|
||||
action = self->max_horz ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_SHADED))
|
||||
action = shaded ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR))
|
||||
action = self->skip_taskbar ?
|
||||
prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_skip_pager)
|
||||
OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER))
|
||||
action = self->skip_pager ?
|
||||
prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_hidden)
|
||||
OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_HIDDEN))
|
||||
action = self->iconic ?
|
||||
prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_fullscreen)
|
||||
OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN))
|
||||
action = fullscreen ?
|
||||
prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_above)
|
||||
action = self->above ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_below)
|
||||
action = self->below ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.net_wm_state_demands_attention)
|
||||
OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_ABOVE))
|
||||
action = self->above ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_BELOW))
|
||||
action = self->below ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION))
|
||||
action = self->demands_attention ?
|
||||
prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
else if (state == prop_atoms.ob_wm_state_undecorated)
|
||||
action = undecorated ? prop_atoms.net_wm_state_remove :
|
||||
prop_atoms.net_wm_state_add;
|
||||
OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
else if (state == OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED))
|
||||
action = undecorated ? OBT_PROP_ATOM(NET_WM_STATE_REMOVE) :
|
||||
OBT_PROP_ATOM(NET_WM_STATE_ADD);
|
||||
}
|
||||
|
||||
if (action == prop_atoms.net_wm_state_add) {
|
||||
if (state == prop_atoms.net_wm_state_modal) {
|
||||
if (action == OBT_PROP_ATOM(NET_WM_STATE_ADD)) {
|
||||
if (state == OBT_PROP_ATOM(NET_WM_STATE_MODAL)) {
|
||||
modal = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_maximized_vert) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT)) {
|
||||
max_vert = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_maximized_horz) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ)) {
|
||||
max_horz = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_shaded) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SHADED)) {
|
||||
shaded = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_skip_taskbar) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR)) {
|
||||
self->skip_taskbar = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_skip_pager) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER)) {
|
||||
self->skip_pager = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_hidden) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_HIDDEN)) {
|
||||
iconic = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_fullscreen) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN)) {
|
||||
fullscreen = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_above) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_ABOVE)) {
|
||||
above = TRUE;
|
||||
below = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_below) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_BELOW)) {
|
||||
above = FALSE;
|
||||
below = TRUE;
|
||||
} else if (state == prop_atoms.net_wm_state_demands_attention) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION)){
|
||||
demands_attention = TRUE;
|
||||
} else if (state == prop_atoms.ob_wm_state_undecorated) {
|
||||
} else if (state == OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED)) {
|
||||
undecorated = TRUE;
|
||||
}
|
||||
|
||||
} else { /* action == prop_atoms.net_wm_state_remove */
|
||||
if (state == prop_atoms.net_wm_state_modal) {
|
||||
} else { /* action == OBT_PROP_ATOM(NET_WM_STATE_REMOVE) */
|
||||
if (state == OBT_PROP_ATOM(NET_WM_STATE_MODAL)) {
|
||||
modal = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_maximized_vert) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT)) {
|
||||
max_vert = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_maximized_horz) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ)) {
|
||||
max_horz = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_shaded) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SHADED)) {
|
||||
shaded = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_skip_taskbar) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR)) {
|
||||
self->skip_taskbar = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_skip_pager) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER)) {
|
||||
self->skip_pager = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_hidden) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_HIDDEN)) {
|
||||
iconic = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_fullscreen) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN)) {
|
||||
fullscreen = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_above) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_ABOVE)) {
|
||||
above = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_below) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_BELOW)) {
|
||||
below = FALSE;
|
||||
} else if (state == prop_atoms.net_wm_state_demands_attention) {
|
||||
} else if (state == OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION)){
|
||||
demands_attention = FALSE;
|
||||
} else if (state == prop_atoms.ob_wm_state_undecorated) {
|
||||
} else if (state == OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED)) {
|
||||
undecorated = FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -3624,11 +3628,11 @@ gboolean client_focus(ObClient *self)
|
|||
if (self->focus_notify) {
|
||||
XEvent ce;
|
||||
ce.xclient.type = ClientMessage;
|
||||
ce.xclient.message_type = prop_atoms.wm_protocols;
|
||||
ce.xclient.message_type = OBT_PROP_ATOM(WM_PROTOCOLS);
|
||||
ce.xclient.display = obt_display;
|
||||
ce.xclient.window = self->window;
|
||||
ce.xclient.format = 32;
|
||||
ce.xclient.data.l[0] = prop_atoms.wm_take_focus;
|
||||
ce.xclient.data.l[0] = OBT_PROP_ATOM(WM_TAKE_FOCUS);
|
||||
ce.xclient.data.l[1] = event_curtime;
|
||||
ce.xclient.data.l[2] = 0l;
|
||||
ce.xclient.data.l[3] = 0l;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "frame.h"
|
||||
#include "moveresize.h"
|
||||
#include "event.h"
|
||||
#include "prop.h"
|
||||
#include "gettext.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -140,7 +140,7 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
|
|||
|
||||
screen_pointer_pos(&x, &y);
|
||||
moveresize_start(c, x, y, 0,
|
||||
prop_atoms.net_wm_moveresize_move_keyboard);
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD));
|
||||
break;
|
||||
case CLIENT_RESIZE:
|
||||
/* this needs to grab the keyboard so hide the menu */
|
||||
|
@ -149,7 +149,7 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
|
|||
|
||||
screen_pointer_pos(&x, &y);
|
||||
moveresize_start(c, x, y, 0,
|
||||
prop_atoms.net_wm_moveresize_size_keyboard);
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD));
|
||||
break;
|
||||
case CLIENT_CLOSE:
|
||||
client_close(c);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "actions.h"
|
||||
#include "prop.h"
|
||||
#include "translate.h"
|
||||
#include "client.h"
|
||||
#include "screen.h"
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
#include "debug.h"
|
||||
#include "dock.h"
|
||||
#include "screen.h"
|
||||
#include "prop.h"
|
||||
#include "config.h"
|
||||
#include "grab.h"
|
||||
#include "openbox.h"
|
||||
#include "render/theme.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#define DOCK_EVENT_MASK (ButtonPressMask | ButtonReleaseMask | \
|
||||
EnterWindowMask | LeaveWindowMask)
|
||||
|
@ -99,8 +99,8 @@ void dock_startup(gboolean reconfig)
|
|||
XSetWindowBorderWidth(obt_display, dock->frame, ob_rr_theme->obwidth);
|
||||
|
||||
/* Setting the window type so xcompmgr can tell what it is */
|
||||
PROP_SET32(dock->frame, net_wm_window_type, atom,
|
||||
prop_atoms.net_wm_window_type_dock);
|
||||
OBT_PROP_SET32(dock->frame, NET_WM_WINDOW_TYPE, ATOM,
|
||||
OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK));
|
||||
|
||||
g_hash_table_insert(window_map, &dock->frame, dock);
|
||||
stacking_add(DOCK_AS_WINDOW(dock));
|
||||
|
@ -136,7 +136,7 @@ void dock_add(Window win, XWMHints *wmhints)
|
|||
app->icon_win = (wmhints->flags & IconWindowHint) ?
|
||||
wmhints->icon_window : win;
|
||||
|
||||
if (PROP_GETSS(app->win, wm_class, locale, &data)) {
|
||||
if (OBT_PROP_GETSS(app->win, WM_CLASS, locale, &data)) {
|
||||
if (data[0]) {
|
||||
app->name = g_strdup(data[0]);
|
||||
if (data[1])
|
||||
|
|
114
openbox/event.c
114
openbox/event.c
|
@ -24,7 +24,6 @@
|
|||
#include "dock.h"
|
||||
#include "actions.h"
|
||||
#include "client.h"
|
||||
#include "prop.h"
|
||||
#include "config.h"
|
||||
#include "screen.h"
|
||||
#include "frame.h"
|
||||
|
@ -42,6 +41,7 @@
|
|||
#include "translate.h"
|
||||
#include "ping.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
@ -652,7 +652,9 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
else if (e->type == ClientMessage) {
|
||||
/* This is for _NET_WM_REQUEST_FRAME_EXTENTS messages. They come for
|
||||
windows that are not managed yet. */
|
||||
if (e->xclient.message_type == prop_atoms.net_request_frame_extents) {
|
||||
if (e->xclient.message_type ==
|
||||
OBT_PROP_ATOM(NET_REQUEST_FRAME_EXTENTS))
|
||||
{
|
||||
/* Pretend to manage the client, getting information used to
|
||||
determine its decorations */
|
||||
ObClient *c = client_fake_manage(e->xclient.window);
|
||||
|
@ -663,8 +665,8 @@ static void event_process(const XEvent *ec, gpointer data)
|
|||
vals[1] = c->frame->size.right;
|
||||
vals[2] = c->frame->size.top;
|
||||
vals[3] = c->frame->size.bottom;
|
||||
PROP_SETA32(e->xclient.window, net_frame_extents,
|
||||
cardinal, vals, 4);
|
||||
OBT_PROP_SETA32(e->xclient.window, NET_FRAME_EXTENTS,
|
||||
CARDINAL, vals, 4);
|
||||
|
||||
/* Free the pretend client */
|
||||
client_fake_unmanage(c);
|
||||
|
@ -744,7 +746,7 @@ static void event_handle_root(XEvent *e)
|
|||
if (e->xclient.format != 32) break;
|
||||
|
||||
msgtype = e->xclient.message_type;
|
||||
if (msgtype == prop_atoms.net_current_desktop) {
|
||||
if (msgtype == OBT_PROP_ATOM(NET_CURRENT_DESKTOP)) {
|
||||
guint d = e->xclient.data.l[0];
|
||||
if (d < screen_num_desktops) {
|
||||
event_curtime = e->xclient.data.l[1];
|
||||
|
@ -754,13 +756,13 @@ static void event_handle_root(XEvent *e)
|
|||
"a timestamp\n");
|
||||
screen_set_desktop(d, TRUE);
|
||||
}
|
||||
} else if (msgtype == prop_atoms.net_number_of_desktops) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_NUMBER_OF_DESKTOPS)) {
|
||||
guint d = e->xclient.data.l[0];
|
||||
if (d > 0 && d <= 1000)
|
||||
screen_set_num_desktops(d);
|
||||
} else if (msgtype == prop_atoms.net_showing_desktop) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_SHOWING_DESKTOP)) {
|
||||
screen_show_desktop(e->xclient.data.l[0] != 0, NULL);
|
||||
} else if (msgtype == prop_atoms.ob_control) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(OB_CONTROL)) {
|
||||
ob_debug("OB_CONTROL: %d\n", e->xclient.data.l[0]);
|
||||
if (e->xclient.data.l[0] == 1)
|
||||
ob_reconfigure();
|
||||
|
@ -774,11 +776,11 @@ static void event_handle_root(XEvent *e)
|
|||
}
|
||||
break;
|
||||
case PropertyNotify:
|
||||
if (e->xproperty.atom == prop_atoms.net_desktop_names) {
|
||||
if (e->xproperty.atom == OBT_PROP_ATOM(NET_DESKTOP_NAMES)) {
|
||||
ob_debug("UPDATE DESKTOP NAMES\n");
|
||||
screen_update_desktop_names();
|
||||
}
|
||||
else if (e->xproperty.atom == prop_atoms.net_desktop_layout)
|
||||
else if (e->xproperty.atom == OBT_PROP_ATOM(NET_DESKTOP_LAYOUT))
|
||||
screen_update_layout();
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
|
@ -1279,7 +1281,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
if (e->xclient.format != 32) return;
|
||||
|
||||
msgtype = e->xclient.message_type;
|
||||
if (msgtype == prop_atoms.wm_change_state) {
|
||||
if (msgtype == OBT_PROP_ATOM(WM_CHANGE_STATE)) {
|
||||
/* compress changes into a single change */
|
||||
while (XCheckTypedWindowEvent(obt_display, client->window,
|
||||
e->type, &ce)) {
|
||||
|
@ -1293,7 +1295,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
e->xclient = ce.xclient;
|
||||
}
|
||||
client_set_wm_state(client, e->xclient.data.l[0]);
|
||||
} else if (msgtype == prop_atoms.net_wm_desktop) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_WM_DESKTOP)) {
|
||||
/* compress changes into a single change */
|
||||
while (XCheckTypedWindowEvent(obt_display, client->window,
|
||||
e->type, &ce)) {
|
||||
|
@ -1310,7 +1312,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
(unsigned)e->xclient.data.l[0] == DESKTOP_ALL)
|
||||
client_set_desktop(client, (unsigned)e->xclient.data.l[0],
|
||||
FALSE, FALSE);
|
||||
} else if (msgtype == prop_atoms.net_wm_state) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_WM_STATE)) {
|
||||
gulong ignore_start;
|
||||
|
||||
/* can't compress these */
|
||||
|
@ -1328,10 +1330,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
e->xclient.data.l[1], e->xclient.data.l[2]);
|
||||
if (!config_focus_under_mouse)
|
||||
event_end_ignore_all_enters(ignore_start);
|
||||
} else if (msgtype == prop_atoms.net_close_window) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_CLOSE_WINDOW)) {
|
||||
ob_debug("net_close_window for 0x%lx\n", client->window);
|
||||
client_close(client);
|
||||
} else if (msgtype == prop_atoms.net_active_window) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_ACTIVE_WINDOW)) {
|
||||
ob_debug("net_active_window for 0x%lx source=%s\n",
|
||||
client->window,
|
||||
(e->xclient.data.l[0] == 0 ? "unknown" :
|
||||
|
@ -1354,42 +1356,42 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
client_activate(client, FALSE, TRUE, TRUE,
|
||||
(e->xclient.data.l[0] == 0 ||
|
||||
e->xclient.data.l[0] == 2));
|
||||
} else if (msgtype == prop_atoms.net_wm_moveresize) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_WM_MOVERESIZE)) {
|
||||
ob_debug("net_wm_moveresize for 0x%lx direction %d\n",
|
||||
client->window, e->xclient.data.l[2]);
|
||||
if ((Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_topleft ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_top ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_topright ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_right ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_right ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_bottomright ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_bottom ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_bottomleft ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_left ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_move ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_size_keyboard ||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD) ||
|
||||
(Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_move_keyboard) {
|
||||
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD))
|
||||
{
|
||||
moveresize_start(client, e->xclient.data.l[0],
|
||||
e->xclient.data.l[1], e->xclient.data.l[3],
|
||||
e->xclient.data.l[2]);
|
||||
}
|
||||
else if ((Atom)e->xclient.data.l[2] ==
|
||||
prop_atoms.net_wm_moveresize_cancel)
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_CANCEL))
|
||||
moveresize_end(TRUE);
|
||||
} else if (msgtype == prop_atoms.net_moveresize_window) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_MOVERESIZE_WINDOW)) {
|
||||
gint ograv, x, y, w, h;
|
||||
|
||||
ograv = client->gravity;
|
||||
|
@ -1438,7 +1440,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
client_configure(client, x, y, w, h, FALSE, TRUE, FALSE);
|
||||
|
||||
client->gravity = ograv;
|
||||
} else if (msgtype == prop_atoms.net_restack_window) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_RESTACK_WINDOW)) {
|
||||
if (e->xclient.data.l[0] != 2) {
|
||||
ob_debug_type(OB_DEBUG_APP_BUGS,
|
||||
"_NET_RESTACK_WINDOW sent for window %s with "
|
||||
|
@ -1504,19 +1506,19 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
|
||||
if (a == b)
|
||||
continue;
|
||||
if ((a == prop_atoms.net_wm_name ||
|
||||
a == prop_atoms.wm_name ||
|
||||
a == prop_atoms.net_wm_icon_name ||
|
||||
a == prop_atoms.wm_icon_name)
|
||||
if ((a == OBT_PROP_ATOM(NET_WM_NAME) ||
|
||||
a == OBT_PROP_ATOM(WM_NAME) ||
|
||||
a == OBT_PROP_ATOM(NET_WM_ICON_NAME) ||
|
||||
a == OBT_PROP_ATOM(WM_ICON_NAME))
|
||||
&&
|
||||
(b == prop_atoms.net_wm_name ||
|
||||
b == prop_atoms.wm_name ||
|
||||
b == prop_atoms.net_wm_icon_name ||
|
||||
b == prop_atoms.wm_icon_name)) {
|
||||
(b == OBT_PROP_ATOM(NET_WM_NAME) ||
|
||||
b == OBT_PROP_ATOM(WM_NAME) ||
|
||||
b == OBT_PROP_ATOM(NET_WM_ICON_NAME) ||
|
||||
b == OBT_PROP_ATOM(WM_ICON_NAME))) {
|
||||
continue;
|
||||
}
|
||||
if (a == prop_atoms.net_wm_icon &&
|
||||
b == prop_atoms.net_wm_icon)
|
||||
if (a == OBT_PROP_ATOM(NET_WM_ICON) &&
|
||||
b == OBT_PROP_ATOM(NET_WM_ICON))
|
||||
continue;
|
||||
|
||||
XPutBackEvent(obt_display, &ce);
|
||||
|
@ -1542,32 +1544,32 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
/* type may have changed, so update the layer */
|
||||
client_calc_layer(client);
|
||||
client_setup_decor_and_functions(client, TRUE);
|
||||
} else if (msgtype == prop_atoms.net_wm_name ||
|
||||
msgtype == prop_atoms.wm_name ||
|
||||
msgtype == prop_atoms.net_wm_icon_name ||
|
||||
msgtype == prop_atoms.wm_icon_name) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(NET_WM_NAME) ||
|
||||
msgtype == OBT_PROP_ATOM(WM_NAME) ||
|
||||
msgtype == OBT_PROP_ATOM(NET_WM_ICON_NAME) ||
|
||||
msgtype == OBT_PROP_ATOM(WM_ICON_NAME)) {
|
||||
client_update_title(client);
|
||||
} else if (msgtype == prop_atoms.wm_protocols) {
|
||||
} else if (msgtype == OBT_PROP_ATOM(WM_PROTOCOLS)) {
|
||||
client_update_protocols(client);
|
||||
client_setup_decor_and_functions(client, TRUE);
|
||||
}
|
||||
else if (msgtype == prop_atoms.net_wm_strut) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_STRUT)) {
|
||||
client_update_strut(client);
|
||||
}
|
||||
else if (msgtype == prop_atoms.net_wm_strut_partial) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_STRUT_PARTIAL)) {
|
||||
client_update_strut(client);
|
||||
}
|
||||
else if (msgtype == prop_atoms.net_wm_icon) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_ICON)) {
|
||||
client_update_icons(client);
|
||||
}
|
||||
else if (msgtype == prop_atoms.net_wm_icon_geometry) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_ICON_GEOMETRY)) {
|
||||
client_update_icon_geometry(client);
|
||||
}
|
||||
else if (msgtype == prop_atoms.net_wm_user_time) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_USER_TIME)) {
|
||||
guint32 t;
|
||||
if (client == focus_client &&
|
||||
PROP_GET32(client->window, net_wm_user_time, cardinal, &t) &&
|
||||
t && !event_time_after(t, e->xproperty.time) &&
|
||||
OBT_PROP_GET32(client->window, NET_WM_USER_TIME, CARDINAL, &t)
|
||||
&& t && !event_time_after(t, e->xproperty.time) &&
|
||||
(!event_last_user_time ||
|
||||
event_time_after(t, event_last_user_time)))
|
||||
{
|
||||
|
@ -1575,7 +1577,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
|||
}
|
||||
}
|
||||
#ifdef SYNC
|
||||
else if (msgtype == prop_atoms.net_wm_sync_request_counter) {
|
||||
else if (msgtype == OBT_PROP_ATOM(NET_WM_SYNC_REQUEST_COUNTER)) {
|
||||
client_update_sync_request_counter(client);
|
||||
}
|
||||
#endif
|
||||
|
@ -2038,7 +2040,7 @@ Time event_get_server_time(void)
|
|||
XEvent event;
|
||||
|
||||
XChangeProperty(obt_display, screen_support_win,
|
||||
prop_atoms.wm_class, prop_atoms.string,
|
||||
OBT_PROP_ATOM(WM_CLASS), OBT_PROP_ATOM(STRING),
|
||||
8, PropModeAppend, NULL, 0);
|
||||
XWindowEvent(obt_display, screen_support_win, PropertyChangeMask, &event);
|
||||
return event.xproperty.time;
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
#include "group.h"
|
||||
#include "focus_cycle.h"
|
||||
#include "screen.h"
|
||||
#include "prop.h"
|
||||
#include "keyboard.h"
|
||||
#include "focus.h"
|
||||
#include "stacking.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <glib.h>
|
||||
|
@ -91,8 +91,8 @@ void focus_set_client(ObClient *client)
|
|||
/* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */
|
||||
if (ob_state() != OB_STATE_EXITING) {
|
||||
active = client ? client->window : None;
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_active_window, window, active);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_ACTIVE_WINDOW, WINDOW, active);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "frame.h"
|
||||
#include "client.h"
|
||||
#include "openbox.h"
|
||||
#include "prop.h"
|
||||
#include "grab.h"
|
||||
#include "config.h"
|
||||
#include "framerender.h"
|
||||
|
@ -30,6 +29,7 @@
|
|||
#include "screen.h"
|
||||
#include "render/theme.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask | \
|
||||
ButtonPressMask | ButtonReleaseMask | \
|
||||
|
@ -859,10 +859,10 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
|
|||
vals[1] = self->size.right;
|
||||
vals[2] = self->size.top;
|
||||
vals[3] = self->size.bottom;
|
||||
PROP_SETA32(self->client->window, net_frame_extents,
|
||||
cardinal, vals, 4);
|
||||
PROP_SETA32(self->client->window, kde_net_wm_frame_strut,
|
||||
cardinal, vals, 4);
|
||||
OBT_PROP_SETA32(self->client->window, NET_FRAME_EXTENTS,
|
||||
CARDINAL, vals, 4);
|
||||
OBT_PROP_SETA32(self->client->window, KDE_NET_WM_FRAME_STRUT,
|
||||
CARDINAL, vals, 4);
|
||||
}
|
||||
|
||||
/* if this occurs while we are focus cycling, the indicator needs to
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "grab.h"
|
||||
#include "client.h"
|
||||
#include "actions.h"
|
||||
#include "prop.h"
|
||||
#include "menuframe.h"
|
||||
#include "config.h"
|
||||
#include "keytree.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "actions.h"
|
||||
#include "event.h"
|
||||
#include "client.h"
|
||||
#include "prop.h"
|
||||
#include "grab.h"
|
||||
#include "frame.h"
|
||||
#include "translate.h"
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "grab.h"
|
||||
#include "framerender.h"
|
||||
#include "screen.h"
|
||||
#include "prop.h"
|
||||
#include "client.h"
|
||||
#include "frame.h"
|
||||
#include "openbox.h"
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include "render/render.h"
|
||||
#include "render/theme.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <glib.h>
|
||||
|
@ -167,8 +167,8 @@ static void popup_coords(ObClient *c, const gchar *format, gint a, gint b)
|
|||
void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
|
||||
{
|
||||
ObCursor cur;
|
||||
gboolean mv = (cnr == prop_atoms.net_wm_moveresize_move ||
|
||||
cnr == prop_atoms.net_wm_moveresize_move_keyboard);
|
||||
gboolean mv = (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE) ||
|
||||
cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD));
|
||||
gint up = 1;
|
||||
gint left = 1;
|
||||
|
||||
|
@ -178,32 +178,37 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr)
|
|||
(c->functions & OB_CLIENT_FUNC_RESIZE)))
|
||||
return;
|
||||
|
||||
if (cnr == prop_atoms.net_wm_moveresize_size_topleft) {
|
||||
if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT)) {
|
||||
cur = OB_CURSOR_NORTHWEST;
|
||||
up = left = -1;
|
||||
} else if (cnr == prop_atoms.net_wm_moveresize_size_top) {
|
||||
}
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP)) {
|
||||
cur = OB_CURSOR_NORTH;
|
||||
up = -1;
|
||||
} else if (cnr == prop_atoms.net_wm_moveresize_size_topright) {
|
||||
}
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT)) {
|
||||
cur = OB_CURSOR_NORTHEAST;
|
||||
up = -1;
|
||||
} else if (cnr == prop_atoms.net_wm_moveresize_size_right)
|
||||
}
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT))
|
||||
cur = OB_CURSOR_EAST;
|
||||
else if (cnr == prop_atoms.net_wm_moveresize_size_bottomright)
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT))
|
||||
cur = OB_CURSOR_SOUTHEAST;
|
||||
else if (cnr == prop_atoms.net_wm_moveresize_size_bottom)
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM))
|
||||
cur = OB_CURSOR_SOUTH;
|
||||
else if (cnr == prop_atoms.net_wm_moveresize_size_bottomleft) {
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)) {
|
||||
cur = OB_CURSOR_SOUTHWEST;
|
||||
left = -1;
|
||||
} else if (cnr == prop_atoms.net_wm_moveresize_size_left) {
|
||||
}
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT)) {
|
||||
cur = OB_CURSOR_WEST;
|
||||
left = -1;
|
||||
} else if (cnr == prop_atoms.net_wm_moveresize_size_keyboard)
|
||||
}
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD))
|
||||
cur = OB_CURSOR_SOUTHEAST;
|
||||
else if (cnr == prop_atoms.net_wm_moveresize_move)
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE))
|
||||
cur = OB_CURSOR_MOVE;
|
||||
else if (cnr == prop_atoms.net_wm_moveresize_move_keyboard)
|
||||
else if (cnr == OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD))
|
||||
cur = OB_CURSOR_MOVE;
|
||||
else
|
||||
g_assert_not_reached();
|
||||
|
@ -381,11 +386,11 @@ static void do_resize(void)
|
|||
|
||||
/* tell the client what we're waiting for */
|
||||
ce.xclient.type = ClientMessage;
|
||||
ce.xclient.message_type = prop_atoms.wm_protocols;
|
||||
ce.xclient.message_type = OBT_PROP_ATOM(WM_PROTOCOLS);
|
||||
ce.xclient.display = obt_display;
|
||||
ce.xclient.window = moveresize_client->window;
|
||||
ce.xclient.format = 32;
|
||||
ce.xclient.data.l[0] = prop_atoms.net_wm_sync_request;
|
||||
ce.xclient.data.l[0] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST);
|
||||
ce.xclient.data.l[1] = event_curtime;
|
||||
ce.xclient.data.l[2] = XSyncValueLow32(val);
|
||||
ce.xclient.data.l[3] = XSyncValueHigh32(val);
|
||||
|
@ -837,41 +842,44 @@ gboolean moveresize_event(XEvent *e)
|
|||
gint dw, dh;
|
||||
ObDirection dir;
|
||||
|
||||
if (corner == prop_atoms.net_wm_moveresize_size_topleft) {
|
||||
if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT)) {
|
||||
dw = -(e->xmotion.x_root - start_x);
|
||||
dh = -(e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_NORTHWEST;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_top) {
|
||||
} else if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP)) {
|
||||
dw = 0;
|
||||
dh = -(e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_NORTH;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_topright) {
|
||||
} else if (corner ==
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT)) {
|
||||
dw = (e->xmotion.x_root - start_x);
|
||||
dh = -(e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_NORTHEAST;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_right) {
|
||||
} else if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT)) {
|
||||
dw = (e->xmotion.x_root - start_x);
|
||||
dh = 0;
|
||||
dir = OB_DIRECTION_EAST;
|
||||
} else if (corner ==
|
||||
prop_atoms.net_wm_moveresize_size_bottomright) {
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT)) {
|
||||
dw = (e->xmotion.x_root - start_x);
|
||||
dh = (e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_SOUTHEAST;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_bottom) {
|
||||
} else if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM))
|
||||
{
|
||||
dw = 0;
|
||||
dh = (e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_SOUTH;
|
||||
} else if (corner ==
|
||||
prop_atoms.net_wm_moveresize_size_bottomleft) {
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT)) {
|
||||
dw = -(e->xmotion.x_root - start_x);
|
||||
dh = (e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_SOUTHWEST;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_left) {
|
||||
} else if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT)) {
|
||||
dw = -(e->xmotion.x_root - start_x);
|
||||
dh = 0;
|
||||
dir = OB_DIRECTION_WEST;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
|
||||
} else if (corner ==
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD)) {
|
||||
dw = (e->xmotion.x_root - start_x);
|
||||
dh = (e->xmotion.y_root - start_y);
|
||||
dir = OB_DIRECTION_SOUTHEAST;
|
||||
|
@ -885,15 +893,15 @@ gboolean moveresize_event(XEvent *e)
|
|||
cur_w += dw;
|
||||
cur_h += dh;
|
||||
|
||||
if (corner == prop_atoms.net_wm_moveresize_size_topleft ||
|
||||
corner == prop_atoms.net_wm_moveresize_size_left ||
|
||||
corner == prop_atoms.net_wm_moveresize_size_bottomleft)
|
||||
if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT) ||
|
||||
corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT) ||
|
||||
corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT))
|
||||
{
|
||||
cur_x -= dw;
|
||||
}
|
||||
if (corner == prop_atoms.net_wm_moveresize_size_topleft ||
|
||||
corner == prop_atoms.net_wm_moveresize_size_top ||
|
||||
corner == prop_atoms.net_wm_moveresize_size_topright)
|
||||
if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT) ||
|
||||
corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP) ||
|
||||
corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT))
|
||||
{
|
||||
cur_y -= dh;
|
||||
}
|
||||
|
@ -913,10 +921,12 @@ gboolean moveresize_event(XEvent *e)
|
|||
e->xkey.keycode == ob_keycode(OB_KEY_DOWN) ||
|
||||
e->xkey.keycode == ob_keycode(OB_KEY_UP))
|
||||
{
|
||||
if (corner == prop_atoms.net_wm_moveresize_size_keyboard) {
|
||||
if (corner == OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD)) {
|
||||
resize_with_keys(e->xkey.keycode, e->xkey.state);
|
||||
used = TRUE;
|
||||
} else if (corner == prop_atoms.net_wm_moveresize_move_keyboard) {
|
||||
} else if (corner ==
|
||||
OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD))
|
||||
{
|
||||
move_with_keys(e->xkey.keycode, e->xkey.state);
|
||||
used = TRUE;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "event.h"
|
||||
#include "menu.h"
|
||||
#include "client.h"
|
||||
#include "prop.h"
|
||||
#include "screen.h"
|
||||
#include "actions.h"
|
||||
#include "startupnotify.h"
|
||||
|
@ -48,6 +47,7 @@
|
|||
#include "render/render.h"
|
||||
#include "render/theme.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
|
@ -145,13 +145,11 @@ gint main(gint argc, gchar **argv)
|
|||
ob_exit_with_error(_("Failed to open the display from the DISPLAY environment variable."));
|
||||
|
||||
if (remote_control) {
|
||||
prop_startup();
|
||||
|
||||
/* Send client message telling the OB process to:
|
||||
* remote_control = 1 -> reconfigure
|
||||
* remote_control = 2 -> restart */
|
||||
PROP_MSG(RootWindow(obt_display, ob_screen),
|
||||
ob_control, remote_control, 0, 0, 0);
|
||||
OBT_PROP_MSG(ob_screen, RootWindow(obt_display, ob_screen),
|
||||
OB_CONTROL, remote_control, 0, 0, 0, 0);
|
||||
obt_display_close(obt_display);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
@ -204,8 +202,6 @@ gint main(gint argc, gchar **argv)
|
|||
cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
|
||||
XC_top_left_corner);
|
||||
|
||||
prop_startup(); /* get atoms values for the display */
|
||||
|
||||
if (screen_annex()) { /* it will be ours! */
|
||||
do {
|
||||
modkeys_startup(reconfigure);
|
||||
|
@ -265,8 +261,8 @@ gint main(gint argc, gchar **argv)
|
|||
if (ob_rr_theme == NULL)
|
||||
ob_exit_with_error(_("Unable to load a theme."));
|
||||
|
||||
PROP_SETS(RootWindow(obt_display, ob_screen),
|
||||
ob_theme, ob_rr_theme->name);
|
||||
OBT_PROP_SETS(RootWindow(obt_display, ob_screen),
|
||||
OB_THEME, ob_rr_theme->name);
|
||||
}
|
||||
|
||||
if (reconfigure) {
|
||||
|
@ -308,8 +304,8 @@ gint main(gint argc, gchar **argv)
|
|||
focus_nothing();
|
||||
|
||||
/* focus what was focused if a wm was already running */
|
||||
if (PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
net_active_window, window, &xid) &&
|
||||
if (OBT_PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
NET_ACTIVE_WINDOW, WINDOW, &xid) &&
|
||||
(w = g_hash_table_lookup(window_map, &xid)) &&
|
||||
WINDOW_IS_CLIENT(w))
|
||||
{
|
||||
|
|
470
openbox/prop.c
470
openbox/prop.c
|
@ -1,470 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
|
||||
|
||||
prop.c for the Openbox window manager
|
||||
Copyright (c) 2006 Mikael Magnusson
|
||||
Copyright (c) 2003-2007 Dana Jansens
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
See the COPYING file for a copy of the GNU General Public License.
|
||||
*/
|
||||
|
||||
#include "prop.h"
|
||||
#include "openbox.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
Atoms prop_atoms;
|
||||
|
||||
#define CREATE(var, name) (prop_atoms.var = \
|
||||
XInternAtom(obt_display, name, FALSE))
|
||||
|
||||
void prop_startup(void)
|
||||
{
|
||||
CREATE(cardinal, "CARDINAL");
|
||||
CREATE(window, "WINDOW");
|
||||
CREATE(pixmap, "PIXMAP");
|
||||
CREATE(atom, "ATOM");
|
||||
CREATE(string, "STRING");
|
||||
CREATE(utf8, "UTF8_STRING");
|
||||
|
||||
CREATE(manager, "MANAGER");
|
||||
|
||||
CREATE(wm_colormap_windows, "WM_COLORMAP_WINDOWS");
|
||||
CREATE(wm_protocols, "WM_PROTOCOLS");
|
||||
CREATE(wm_state, "WM_STATE");
|
||||
CREATE(wm_change_state, "WM_CHANGE_STATE");
|
||||
CREATE(wm_delete_window, "WM_DELETE_WINDOW");
|
||||
CREATE(wm_take_focus, "WM_TAKE_FOCUS");
|
||||
CREATE(wm_name, "WM_NAME");
|
||||
CREATE(wm_icon_name, "WM_ICON_NAME");
|
||||
CREATE(wm_class, "WM_CLASS");
|
||||
CREATE(wm_window_role, "WM_WINDOW_ROLE");
|
||||
CREATE(wm_client_machine, "WM_CLIENT_MACHINE");
|
||||
CREATE(wm_command, "WM_COMMAND");
|
||||
CREATE(wm_client_leader, "WM_CLIENT_LEADER");
|
||||
CREATE(motif_wm_hints, "_MOTIF_WM_HINTS");
|
||||
|
||||
CREATE(sm_client_id, "SM_CLIENT_ID");
|
||||
|
||||
CREATE(net_wm_full_placement, "_NET_WM_FULL_PLACEMENT");
|
||||
|
||||
CREATE(net_supported, "_NET_SUPPORTED");
|
||||
CREATE(net_client_list, "_NET_CLIENT_LIST");
|
||||
CREATE(net_client_list_stacking, "_NET_CLIENT_LIST_STACKING");
|
||||
CREATE(net_number_of_desktops, "_NET_NUMBER_OF_DESKTOPS");
|
||||
CREATE(net_desktop_geometry, "_NET_DESKTOP_GEOMETRY");
|
||||
CREATE(net_desktop_viewport, "_NET_DESKTOP_VIEWPORT");
|
||||
CREATE(net_current_desktop, "_NET_CURRENT_DESKTOP");
|
||||
CREATE(net_desktop_names, "_NET_DESKTOP_NAMES");
|
||||
CREATE(net_active_window, "_NET_ACTIVE_WINDOW");
|
||||
/* CREATE(net_restack_window, "_NET_RESTACK_WINDOW");*/
|
||||
CREATE(net_workarea, "_NET_WORKAREA");
|
||||
CREATE(net_supporting_wm_check, "_NET_SUPPORTING_WM_CHECK");
|
||||
CREATE(net_desktop_layout, "_NET_DESKTOP_LAYOUT");
|
||||
CREATE(net_showing_desktop, "_NET_SHOWING_DESKTOP");
|
||||
|
||||
CREATE(net_close_window, "_NET_CLOSE_WINDOW");
|
||||
CREATE(net_wm_moveresize, "_NET_WM_MOVERESIZE");
|
||||
CREATE(net_moveresize_window, "_NET_MOVERESIZE_WINDOW");
|
||||
CREATE(net_request_frame_extents, "_NET_REQUEST_FRAME_EXTENTS");
|
||||
CREATE(net_restack_window, "_NET_RESTACK_WINDOW");
|
||||
|
||||
CREATE(net_startup_id, "_NET_STARTUP_ID");
|
||||
|
||||
CREATE(net_wm_name, "_NET_WM_NAME");
|
||||
CREATE(net_wm_visible_name, "_NET_WM_VISIBLE_NAME");
|
||||
CREATE(net_wm_icon_name, "_NET_WM_ICON_NAME");
|
||||
CREATE(net_wm_visible_icon_name, "_NET_WM_VISIBLE_ICON_NAME");
|
||||
CREATE(net_wm_desktop, "_NET_WM_DESKTOP");
|
||||
CREATE(net_wm_window_type, "_NET_WM_WINDOW_TYPE");
|
||||
CREATE(net_wm_state, "_NET_WM_STATE");
|
||||
CREATE(net_wm_strut, "_NET_WM_STRUT");
|
||||
CREATE(net_wm_strut_partial, "_NET_WM_STRUT_PARTIAL");
|
||||
CREATE(net_wm_icon, "_NET_WM_ICON");
|
||||
CREATE(net_wm_icon_geometry, "_NET_WM_ICON_GEOMETRY");
|
||||
CREATE(net_wm_pid, "_NET_WM_PID");
|
||||
CREATE(net_wm_allowed_actions, "_NET_WM_ALLOWED_ACTIONS");
|
||||
CREATE(net_wm_user_time, "_NET_WM_USER_TIME");
|
||||
/* CREATE(net_wm_user_time_window, "_NET_WM_USER_TIME_WINDOW"); */
|
||||
CREATE(kde_net_wm_frame_strut, "_KDE_NET_WM_FRAME_STRUT");
|
||||
CREATE(net_frame_extents, "_NET_FRAME_EXTENTS");
|
||||
|
||||
CREATE(net_wm_ping, "_NET_WM_PING");
|
||||
#ifdef SYNC
|
||||
CREATE(net_wm_sync_request, "_NET_WM_SYNC_REQUEST");
|
||||
CREATE(net_wm_sync_request_counter, "_NET_WM_SYNC_REQUEST_COUNTER");
|
||||
#endif
|
||||
|
||||
CREATE(net_wm_window_type_desktop, "_NET_WM_WINDOW_TYPE_DESKTOP");
|
||||
CREATE(net_wm_window_type_dock, "_NET_WM_WINDOW_TYPE_DOCK");
|
||||
CREATE(net_wm_window_type_toolbar, "_NET_WM_WINDOW_TYPE_TOOLBAR");
|
||||
CREATE(net_wm_window_type_menu, "_NET_WM_WINDOW_TYPE_MENU");
|
||||
CREATE(net_wm_window_type_utility, "_NET_WM_WINDOW_TYPE_UTILITY");
|
||||
CREATE(net_wm_window_type_splash, "_NET_WM_WINDOW_TYPE_SPLASH");
|
||||
CREATE(net_wm_window_type_dialog, "_NET_WM_WINDOW_TYPE_DIALOG");
|
||||
CREATE(net_wm_window_type_normal, "_NET_WM_WINDOW_TYPE_NORMAL");
|
||||
|
||||
prop_atoms.net_wm_moveresize_size_topleft = 0;
|
||||
prop_atoms.net_wm_moveresize_size_top = 1;
|
||||
prop_atoms.net_wm_moveresize_size_topright = 2;
|
||||
prop_atoms.net_wm_moveresize_size_right = 3;
|
||||
prop_atoms.net_wm_moveresize_size_bottomright = 4;
|
||||
prop_atoms.net_wm_moveresize_size_bottom = 5;
|
||||
prop_atoms.net_wm_moveresize_size_bottomleft = 6;
|
||||
prop_atoms.net_wm_moveresize_size_left = 7;
|
||||
prop_atoms.net_wm_moveresize_move = 8;
|
||||
prop_atoms.net_wm_moveresize_size_keyboard = 9;
|
||||
prop_atoms.net_wm_moveresize_move_keyboard = 10;
|
||||
prop_atoms.net_wm_moveresize_cancel = 11;
|
||||
|
||||
CREATE(net_wm_action_move, "_NET_WM_ACTION_MOVE");
|
||||
CREATE(net_wm_action_resize, "_NET_WM_ACTION_RESIZE");
|
||||
CREATE(net_wm_action_minimize, "_NET_WM_ACTION_MINIMIZE");
|
||||
CREATE(net_wm_action_shade, "_NET_WM_ACTION_SHADE");
|
||||
CREATE(net_wm_action_maximize_horz, "_NET_WM_ACTION_MAXIMIZE_HORZ");
|
||||
CREATE(net_wm_action_maximize_vert, "_NET_WM_ACTION_MAXIMIZE_VERT");
|
||||
CREATE(net_wm_action_fullscreen, "_NET_WM_ACTION_FULLSCREEN");
|
||||
CREATE(net_wm_action_change_desktop, "_NET_WM_ACTION_CHANGE_DESKTOP");
|
||||
CREATE(net_wm_action_close, "_NET_WM_ACTION_CLOSE");
|
||||
CREATE(net_wm_action_above, "_NET_WM_ACTION_ABOVE");
|
||||
CREATE(net_wm_action_below, "_NET_WM_ACTION_BELOW");
|
||||
|
||||
CREATE(net_wm_state_modal, "_NET_WM_STATE_MODAL");
|
||||
/* CREATE(net_wm_state_sticky, "_NET_WM_STATE_STICKY");*/
|
||||
CREATE(net_wm_state_maximized_vert, "_NET_WM_STATE_MAXIMIZED_VERT");
|
||||
CREATE(net_wm_state_maximized_horz, "_NET_WM_STATE_MAXIMIZED_HORZ");
|
||||
CREATE(net_wm_state_shaded, "_NET_WM_STATE_SHADED");
|
||||
CREATE(net_wm_state_skip_taskbar, "_NET_WM_STATE_SKIP_TASKBAR");
|
||||
CREATE(net_wm_state_skip_pager, "_NET_WM_STATE_SKIP_PAGER");
|
||||
CREATE(net_wm_state_hidden, "_NET_WM_STATE_HIDDEN");
|
||||
CREATE(net_wm_state_fullscreen, "_NET_WM_STATE_FULLSCREEN");
|
||||
CREATE(net_wm_state_above, "_NET_WM_STATE_ABOVE");
|
||||
CREATE(net_wm_state_below, "_NET_WM_STATE_BELOW");
|
||||
CREATE(net_wm_state_demands_attention, "_NET_WM_STATE_DEMANDS_ATTENTION");
|
||||
|
||||
prop_atoms.net_wm_state_add = 1;
|
||||
prop_atoms.net_wm_state_remove = 0;
|
||||
prop_atoms.net_wm_state_toggle = 2;
|
||||
|
||||
prop_atoms.net_wm_orientation_horz = 0;
|
||||
prop_atoms.net_wm_orientation_vert = 1;
|
||||
prop_atoms.net_wm_topleft = 0;
|
||||
prop_atoms.net_wm_topright = 1;
|
||||
prop_atoms.net_wm_bottomright = 2;
|
||||
prop_atoms.net_wm_bottomleft = 3;
|
||||
|
||||
CREATE(kde_wm_change_state, "_KDE_WM_CHANGE_STATE");
|
||||
CREATE(kde_net_wm_window_type_override,"_KDE_NET_WM_WINDOW_TYPE_OVERRIDE");
|
||||
|
||||
/*
|
||||
CREATE(rootpmapid, "_XROOTPMAP_ID");
|
||||
CREATE(esetrootid, "ESETROOT_PMAP_ID");
|
||||
*/
|
||||
|
||||
CREATE(openbox_pid, "_OPENBOX_PID");
|
||||
CREATE(ob_theme, "_OB_THEME");
|
||||
CREATE(ob_wm_action_undecorate, "_OB_WM_ACTION_UNDECORATE");
|
||||
CREATE(ob_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
|
||||
CREATE(ob_control, "_OB_CONTROL");
|
||||
}
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* this just isn't used... and it also breaks on 64bit, watch out
|
||||
static gboolean get(Window win, Atom prop, Atom type, gint size,
|
||||
guchar **data, gulong num)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gint res;
|
||||
guchar *xdata = NULL;
|
||||
Atom ret_type;
|
||||
gint ret_size;
|
||||
gulong ret_items, bytes_left;
|
||||
glong num32 = 32 / size * num; /\* num in 32-bit elements *\/
|
||||
|
||||
res = XGetWindowProperty(display, win, prop, 0l, num32,
|
||||
FALSE, type, &ret_type, &ret_size,
|
||||
&ret_items, &bytes_left, &xdata);
|
||||
if (res == Success && ret_items && xdata) {
|
||||
if (ret_size == size && ret_items >= num) {
|
||||
*data = g_memdup(xdata, num * (size / 8));
|
||||
ret = TRUE;
|
||||
}
|
||||
XFree(xdata);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
static gboolean get_prealloc(Window win, Atom prop, Atom type, gint size,
|
||||
guchar *data, gulong num)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gint res;
|
||||
guchar *xdata = NULL;
|
||||
Atom ret_type;
|
||||
gint ret_size;
|
||||
gulong ret_items, bytes_left;
|
||||
glong num32 = 32 / size * num; /* num in 32-bit elements */
|
||||
|
||||
res = XGetWindowProperty(obt_display, win, prop, 0l, num32,
|
||||
FALSE, type, &ret_type, &ret_size,
|
||||
&ret_items, &bytes_left, &xdata);
|
||||
if (res == Success && ret_items && xdata) {
|
||||
if (ret_size == size && ret_items >= num) {
|
||||
guint i;
|
||||
for (i = 0; i < num; ++i)
|
||||
switch (size) {
|
||||
case 8:
|
||||
data[i] = xdata[i];
|
||||
break;
|
||||
case 16:
|
||||
((guint16*)data)[i] = ((gushort*)xdata)[i];
|
||||
break;
|
||||
case 32:
|
||||
((guint32*)data)[i] = ((gulong*)xdata)[i];
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached(); /* unhandled size */
|
||||
}
|
||||
ret = TRUE;
|
||||
}
|
||||
XFree(xdata);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean get_all(Window win, Atom prop, Atom type, gint size,
|
||||
guchar **data, guint *num)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gint res;
|
||||
guchar *xdata = NULL;
|
||||
Atom ret_type;
|
||||
gint ret_size;
|
||||
gulong ret_items, bytes_left;
|
||||
|
||||
res = XGetWindowProperty(obt_display, win, prop, 0l, G_MAXLONG,
|
||||
FALSE, type, &ret_type, &ret_size,
|
||||
&ret_items, &bytes_left, &xdata);
|
||||
if (res == Success) {
|
||||
if (ret_size == size && ret_items > 0) {
|
||||
guint i;
|
||||
|
||||
*data = g_malloc(ret_items * (size / 8));
|
||||
for (i = 0; i < ret_items; ++i)
|
||||
switch (size) {
|
||||
case 8:
|
||||
(*data)[i] = xdata[i];
|
||||
break;
|
||||
case 16:
|
||||
((guint16*)*data)[i] = ((gushort*)xdata)[i];
|
||||
break;
|
||||
case 32:
|
||||
((guint32*)*data)[i] = ((gulong*)xdata)[i];
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached(); /* unhandled size */
|
||||
}
|
||||
*num = ret_items;
|
||||
ret = TRUE;
|
||||
}
|
||||
XFree(xdata);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean get_stringlist(Window win, Atom prop, gchar ***list, gint *nstr)
|
||||
{
|
||||
XTextProperty tprop;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
if (XGetTextProperty(obt_display, win, &tprop, prop) && tprop.nitems) {
|
||||
if (XTextPropertyToStringList(&tprop, list, nstr))
|
||||
ret = TRUE;
|
||||
XFree(tprop.value);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret)
|
||||
{
|
||||
return get_prealloc(win, prop, type, 32, (guchar*)ret, 1);
|
||||
}
|
||||
|
||||
gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
|
||||
guint *nret)
|
||||
{
|
||||
return get_all(win, prop, type, 32, (guchar**)ret, nret);
|
||||
}
|
||||
|
||||
gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret)
|
||||
{
|
||||
gchar **list;
|
||||
gint nstr;
|
||||
gchar *s;
|
||||
|
||||
if (get_stringlist(win, prop, &list, &nstr) && nstr) {
|
||||
s = g_locale_to_utf8(list[0], -1, NULL, NULL, NULL);
|
||||
XFreeStringList(list);
|
||||
if (s) {
|
||||
*ret = s;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret)
|
||||
{
|
||||
GSList *strs = NULL, *it;
|
||||
gchar *raw, *p;
|
||||
guint num, i, count = 0;
|
||||
|
||||
if (get_all(win, prop, prop_atoms.string, 8, (guchar**)&raw, &num)) {
|
||||
|
||||
p = raw;
|
||||
while (p < raw + num) {
|
||||
++count;
|
||||
strs = g_slist_append(strs, p);
|
||||
p += strlen(p) + 1; /* next string */
|
||||
}
|
||||
|
||||
*ret = g_new0(gchar*, count + 1);
|
||||
(*ret)[count] = NULL; /* null terminated list */
|
||||
|
||||
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
||||
(*ret)[i] = g_locale_to_utf8(it->data, -1, NULL, NULL, NULL);
|
||||
/* make sure translation did not fail */
|
||||
if (!(*ret)[i])
|
||||
(*ret)[i] = g_strdup("");
|
||||
}
|
||||
g_free(raw);
|
||||
g_slist_free(strs);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret)
|
||||
{
|
||||
gchar *raw;
|
||||
gchar *str;
|
||||
guint num;
|
||||
|
||||
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
||||
str = g_strndup(raw, num); /* grab the first string from the list */
|
||||
g_free(raw);
|
||||
if (g_utf8_validate(str, -1, NULL)) {
|
||||
*ret = str;
|
||||
return TRUE;
|
||||
}
|
||||
g_free(str);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret)
|
||||
{
|
||||
GSList *strs = NULL, *it;
|
||||
gchar *raw, *p;
|
||||
guint num, i, count = 0;
|
||||
|
||||
if (get_all(win, prop, prop_atoms.utf8, 8, (guchar**)&raw, &num)) {
|
||||
|
||||
p = raw;
|
||||
while (p < raw + num) {
|
||||
++count;
|
||||
strs = g_slist_append(strs, p);
|
||||
p += strlen(p) + 1; /* next string */
|
||||
}
|
||||
|
||||
*ret = g_new0(gchar*, count + 1);
|
||||
|
||||
for (i = 0, it = strs; it; ++i, it = g_slist_next(it)) {
|
||||
if (g_utf8_validate(it->data, -1, NULL))
|
||||
(*ret)[i] = g_strdup(it->data);
|
||||
else
|
||||
(*ret)[i] = g_strdup("");
|
||||
}
|
||||
g_free(raw);
|
||||
g_slist_free(strs);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void prop_set32(Window win, Atom prop, Atom type, gulong val)
|
||||
{
|
||||
XChangeProperty(obt_display, win, prop, type, 32, PropModeReplace,
|
||||
(guchar*)&val, 1);
|
||||
}
|
||||
|
||||
void prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
|
||||
guint num)
|
||||
{
|
||||
XChangeProperty(obt_display, win, prop, type, 32, PropModeReplace,
|
||||
(guchar*)val, num);
|
||||
}
|
||||
|
||||
void prop_set_string_utf8(Window win, Atom prop, const gchar *val)
|
||||
{
|
||||
XChangeProperty(obt_display, win, prop, prop_atoms.utf8, 8,
|
||||
PropModeReplace, (const guchar*)val, strlen(val));
|
||||
}
|
||||
|
||||
void prop_set_strings_utf8(Window win, Atom prop, gchar **strs)
|
||||
{
|
||||
GString *str;
|
||||
gchar **s;
|
||||
|
||||
str = g_string_sized_new(0);
|
||||
for (s = strs; *s; ++s) {
|
||||
str = g_string_append(str, *s);
|
||||
str = g_string_append_c(str, '\0');
|
||||
}
|
||||
XChangeProperty(obt_display, win, prop, prop_atoms.utf8, 8,
|
||||
PropModeReplace, (guchar*)str->str, str->len);
|
||||
g_string_free(str, TRUE);
|
||||
}
|
||||
|
||||
void prop_erase(Window win, Atom prop)
|
||||
{
|
||||
XDeleteProperty(obt_display, win, prop);
|
||||
}
|
||||
|
||||
void prop_message(Window about, Atom messagetype, glong data0, glong data1,
|
||||
glong data2, glong data3, glong mask)
|
||||
{
|
||||
prop_message_to(RootWindow(obt_display, ob_screen), about, messagetype,
|
||||
data0, data1, data2, data3, 0, mask);
|
||||
}
|
||||
|
||||
void prop_message_to(Window to, Window about, Atom messagetype,
|
||||
glong data0, glong data1, glong data2,
|
||||
glong data3, glong data4, glong mask)
|
||||
{
|
||||
XEvent ce;
|
||||
ce.xclient.type = ClientMessage;
|
||||
ce.xclient.message_type = messagetype;
|
||||
ce.xclient.display = obt_display;
|
||||
ce.xclient.window = about;
|
||||
ce.xclient.format = 32;
|
||||
ce.xclient.data.l[0] = data0;
|
||||
ce.xclient.data.l[1] = data1;
|
||||
ce.xclient.data.l[2] = data2;
|
||||
ce.xclient.data.l[3] = data3;
|
||||
ce.xclient.data.l[4] = data4;
|
||||
XSendEvent(obt_display, to, FALSE, mask, &ce);
|
||||
}
|
255
openbox/prop.h
255
openbox/prop.h
|
@ -1,255 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
|
||||
|
||||
prop.h for the Openbox window manager
|
||||
Copyright (c) 2006 Mikael Magnusson
|
||||
Copyright (c) 2003-2007 Dana Jansens
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
See the COPYING file for a copy of the GNU General Public License.
|
||||
*/
|
||||
|
||||
#ifndef __atoms_h
|
||||
#define __atoms_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <glib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
/*! The atoms on the X server which this class will cache */
|
||||
typedef struct Atoms {
|
||||
/* types */
|
||||
Atom cardinal; /*!< The atom which represents the Cardinal data type */
|
||||
Atom window; /*!< The atom which represents window ids */
|
||||
Atom pixmap; /*!< The atom which represents pixmap ids */
|
||||
Atom atom; /*!< The atom which represents atom values */
|
||||
Atom string; /*!< The atom which represents ascii strings */
|
||||
Atom utf8; /*!< The atom which represents utf8-encoded strings */
|
||||
|
||||
/* selection stuff */
|
||||
Atom manager;
|
||||
|
||||
/* window hints */
|
||||
Atom wm_colormap_windows;
|
||||
Atom wm_protocols;
|
||||
Atom wm_state;
|
||||
Atom wm_delete_window;
|
||||
Atom wm_take_focus;
|
||||
Atom wm_change_state;
|
||||
Atom wm_name;
|
||||
Atom wm_icon_name;
|
||||
Atom wm_class;
|
||||
Atom wm_window_role;
|
||||
Atom wm_client_machine;
|
||||
Atom wm_command;
|
||||
Atom wm_client_leader;
|
||||
Atom motif_wm_hints;
|
||||
|
||||
/* SM atoms */
|
||||
Atom sm_client_id;
|
||||
|
||||
/* NETWM atoms */
|
||||
|
||||
/* Atoms that are used inside messages - these don't go in net_supported */
|
||||
|
||||
Atom net_wm_moveresize_size_topleft;
|
||||
Atom net_wm_moveresize_size_top;
|
||||
Atom net_wm_moveresize_size_topright;
|
||||
Atom net_wm_moveresize_size_right;
|
||||
Atom net_wm_moveresize_size_bottomright;
|
||||
Atom net_wm_moveresize_size_bottom;
|
||||
Atom net_wm_moveresize_size_bottomleft;
|
||||
Atom net_wm_moveresize_size_left;
|
||||
Atom net_wm_moveresize_move;
|
||||
Atom net_wm_moveresize_size_keyboard;
|
||||
Atom net_wm_moveresize_move_keyboard;
|
||||
Atom net_wm_moveresize_cancel;
|
||||
|
||||
Atom net_wm_state_add;
|
||||
Atom net_wm_state_remove;
|
||||
Atom net_wm_state_toggle;
|
||||
|
||||
Atom net_wm_orientation_horz;
|
||||
Atom net_wm_orientation_vert;
|
||||
Atom net_wm_topleft;
|
||||
Atom net_wm_topright;
|
||||
Atom net_wm_bottomright;
|
||||
Atom net_wm_bottomleft;
|
||||
|
||||
/* Everything below here must go in net_supported on the root window */
|
||||
|
||||
/* root window properties */
|
||||
Atom net_supported;
|
||||
Atom net_client_list;
|
||||
Atom net_client_list_stacking;
|
||||
Atom net_number_of_desktops;
|
||||
Atom net_desktop_geometry;
|
||||
Atom net_desktop_viewport;
|
||||
Atom net_current_desktop;
|
||||
Atom net_desktop_names;
|
||||
Atom net_active_window;
|
||||
/* Atom net_restack_window;*/
|
||||
Atom net_workarea;
|
||||
Atom net_supporting_wm_check;
|
||||
Atom net_desktop_layout;
|
||||
Atom net_showing_desktop;
|
||||
|
||||
/* root window messages */
|
||||
Atom net_close_window;
|
||||
Atom net_wm_moveresize;
|
||||
Atom net_moveresize_window;
|
||||
Atom net_request_frame_extents;
|
||||
Atom net_restack_window;
|
||||
|
||||
/* helpful hints to apps that aren't used for anything */
|
||||
Atom net_wm_full_placement;
|
||||
|
||||
/* startup-notification extension */
|
||||
Atom net_startup_id;
|
||||
|
||||
/* application window properties */
|
||||
Atom net_wm_name;
|
||||
Atom net_wm_visible_name;
|
||||
Atom net_wm_icon_name;
|
||||
Atom net_wm_visible_icon_name;
|
||||
Atom net_wm_desktop;
|
||||
Atom net_wm_window_type;
|
||||
Atom net_wm_state;
|
||||
Atom net_wm_strut;
|
||||
Atom net_wm_strut_partial;
|
||||
Atom net_wm_icon;
|
||||
Atom net_wm_icon_geometry;
|
||||
Atom net_wm_pid;
|
||||
Atom net_wm_allowed_actions;
|
||||
Atom net_wm_user_time;
|
||||
/* Atom net_wm_user_time_window; */
|
||||
Atom net_frame_extents;
|
||||
|
||||
/* application protocols */
|
||||
Atom net_wm_ping;
|
||||
#ifdef SYNC
|
||||
Atom net_wm_sync_request;
|
||||
Atom net_wm_sync_request_counter;
|
||||
#endif
|
||||
|
||||
Atom net_wm_window_type_desktop;
|
||||
Atom net_wm_window_type_dock;
|
||||
Atom net_wm_window_type_toolbar;
|
||||
Atom net_wm_window_type_menu;
|
||||
Atom net_wm_window_type_utility;
|
||||
Atom net_wm_window_type_splash;
|
||||
Atom net_wm_window_type_dialog;
|
||||
Atom net_wm_window_type_normal;
|
||||
|
||||
Atom net_wm_action_move;
|
||||
Atom net_wm_action_resize;
|
||||
Atom net_wm_action_minimize;
|
||||
Atom net_wm_action_shade;
|
||||
/* Atom net_wm_action_stick;*/
|
||||
Atom net_wm_action_maximize_horz;
|
||||
Atom net_wm_action_maximize_vert;
|
||||
Atom net_wm_action_fullscreen;
|
||||
Atom net_wm_action_change_desktop;
|
||||
Atom net_wm_action_close;
|
||||
Atom net_wm_action_above;
|
||||
Atom net_wm_action_below;
|
||||
|
||||
Atom net_wm_state_modal;
|
||||
/* Atom net_wm_state_sticky;*/
|
||||
Atom net_wm_state_maximized_vert;
|
||||
Atom net_wm_state_maximized_horz;
|
||||
Atom net_wm_state_shaded;
|
||||
Atom net_wm_state_skip_taskbar;
|
||||
Atom net_wm_state_skip_pager;
|
||||
Atom net_wm_state_hidden;
|
||||
Atom net_wm_state_fullscreen;
|
||||
Atom net_wm_state_above;
|
||||
Atom net_wm_state_below;
|
||||
Atom net_wm_state_demands_attention;
|
||||
|
||||
/* KDE atoms */
|
||||
|
||||
Atom kde_wm_change_state;
|
||||
Atom kde_net_wm_frame_strut;
|
||||
Atom kde_net_wm_window_type_override;
|
||||
|
||||
/*
|
||||
Atom rootpmapid;
|
||||
Atom esetrootid;
|
||||
*/
|
||||
|
||||
/* Openbox specific atoms */
|
||||
|
||||
Atom ob_wm_action_undecorate;
|
||||
Atom ob_wm_state_undecorated;
|
||||
Atom openbox_pid; /* this is depreecated in favour of ob_control */
|
||||
Atom ob_theme;
|
||||
Atom ob_control;
|
||||
} Atoms;
|
||||
extern Atoms prop_atoms;
|
||||
|
||||
void prop_startup();
|
||||
|
||||
gboolean prop_get32(Window win, Atom prop, Atom type, guint32 *ret);
|
||||
gboolean prop_get_array32(Window win, Atom prop, Atom type, guint32 **ret,
|
||||
guint *nret);
|
||||
gboolean prop_get_string_locale(Window win, Atom prop, gchar **ret);
|
||||
gboolean prop_get_string_utf8(Window win, Atom prop, gchar **ret);
|
||||
gboolean prop_get_strings_locale(Window win, Atom prop, gchar ***ret);
|
||||
gboolean prop_get_strings_utf8(Window win, Atom prop, gchar ***ret);
|
||||
|
||||
void prop_set32(Window win, Atom prop, Atom type, gulong val);
|
||||
void prop_set_array32(Window win, Atom prop, Atom type, gulong *val,
|
||||
guint num);
|
||||
void prop_set_string_utf8(Window win, Atom prop, const gchar *val);
|
||||
void prop_set_strings_utf8(Window win, Atom prop, gchar **strs);
|
||||
|
||||
void prop_erase(Window win, Atom prop);
|
||||
|
||||
void prop_message(Window about, Atom messagetype, glong data0, glong data1,
|
||||
glong data2, glong data3, glong mask);
|
||||
void prop_message_to(Window to, Window about, Atom messagetype,
|
||||
glong data0, glong data1, glong data2,
|
||||
glong data3, glong data4, glong mask);
|
||||
|
||||
#define PROP_GET32(win, prop, type, ret) \
|
||||
(prop_get32(win, prop_atoms.prop, prop_atoms.type, ret))
|
||||
#define PROP_GETA32(win, prop, type, ret, nret) \
|
||||
(prop_get_array32(win, prop_atoms.prop, prop_atoms.type, ret, \
|
||||
nret))
|
||||
#define PROP_GETS(win, prop, type, ret) \
|
||||
(prop_get_string_##type(win, prop_atoms.prop, ret))
|
||||
#define PROP_GETSS(win, prop, type, ret) \
|
||||
(prop_get_strings_##type(win, prop_atoms.prop, ret))
|
||||
|
||||
#define PROP_SET32(win, prop, type, val) \
|
||||
prop_set32(win, prop_atoms.prop, prop_atoms.type, val)
|
||||
#define PROP_SETA32(win, prop, type, val, num) \
|
||||
prop_set_array32(win, prop_atoms.prop, prop_atoms.type, val, num)
|
||||
#define PROP_SETS(win, prop, val) \
|
||||
prop_set_string_utf8(win, prop_atoms.prop, val)
|
||||
#define PROP_SETSS(win, prop, strs) \
|
||||
prop_set_strings_utf8(win, prop_atoms.prop, strs)
|
||||
|
||||
#define PROP_ERASE(win, prop) prop_erase(win, prop_atoms.prop)
|
||||
|
||||
#define PROP_MSG(about, msgtype, data0, data1, data2, data3) \
|
||||
(prop_message(about, prop_atoms.msgtype, data0, data1, data2, data3, \
|
||||
SubstructureNotifyMask | SubstructureRedirectMask))
|
||||
|
||||
#define PROP_MSG_TO(to, about, msgtype, data0, data1, data2, data3, data4, \
|
||||
mask) \
|
||||
(prop_message_to(to, about, prop_atoms.msgtype, \
|
||||
data0, data1, data2, data3, data4, mask))
|
||||
|
||||
#endif
|
261
openbox/screen.c
261
openbox/screen.c
|
@ -20,7 +20,6 @@
|
|||
#include "debug.h"
|
||||
#include "openbox.h"
|
||||
#include "dock.h"
|
||||
#include "prop.h"
|
||||
#include "grab.h"
|
||||
#include "startupnotify.h"
|
||||
#include "moveresize.h"
|
||||
|
@ -36,6 +35,7 @@
|
|||
#include "render/render.h"
|
||||
#include "gettext.h"
|
||||
#include "obt/display.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -146,9 +146,10 @@ static gboolean replace_wm(void)
|
|||
}
|
||||
|
||||
/* Send client message indicating that we are now the WM */
|
||||
prop_message(RootWindow(obt_display, ob_screen), prop_atoms.manager,
|
||||
timestamp, wm_sn_atom, screen_support_win, 0,
|
||||
SubstructureNotifyMask);
|
||||
obt_prop_message(ob_screen, RootWindow(obt_display, ob_screen),
|
||||
OBT_PROP_ATOM(MANAGER),
|
||||
timestamp, wm_sn_atom, screen_support_win, 0, 0,
|
||||
SubstructureNotifyMask);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -158,7 +159,6 @@ gboolean screen_annex(void)
|
|||
XSetWindowAttributes attrib;
|
||||
pid_t pid;
|
||||
gint i, num_support;
|
||||
Atom *prop_atoms_start, *wm_supported_pos;
|
||||
gulong *supported;
|
||||
|
||||
/* create the netwm support window */
|
||||
|
@ -195,113 +195,110 @@ gboolean screen_annex(void)
|
|||
|
||||
/* set the OPENBOX_PID hint */
|
||||
pid = getpid();
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
openbox_pid, cardinal, pid);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
OPENBOX_PID, CARDINAL, pid);
|
||||
|
||||
/* set supporting window */
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_supporting_wm_check, window, screen_support_win);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_SUPPORTING_WM_CHECK, WINDOW, screen_support_win);
|
||||
|
||||
/* set properties on the supporting window */
|
||||
PROP_SETS(screen_support_win, net_wm_name, "Openbox");
|
||||
PROP_SET32(screen_support_win, net_supporting_wm_check,
|
||||
window, screen_support_win);
|
||||
OBT_PROP_SETS(screen_support_win, NET_WM_NAME, "Openbox");
|
||||
OBT_PROP_SET32(screen_support_win, NET_SUPPORTING_WM_CHECK,
|
||||
WINDOW, screen_support_win);
|
||||
|
||||
/* set the _NET_SUPPORTED_ATOMS hint */
|
||||
|
||||
/* this is all the atoms after net_supported in the prop_atoms struct */
|
||||
prop_atoms_start = (Atom*)&prop_atoms;
|
||||
wm_supported_pos = (Atom*)&(prop_atoms.net_supported);
|
||||
num_support = sizeof(prop_atoms) / sizeof(Atom) -
|
||||
(wm_supported_pos - prop_atoms_start) - 1;
|
||||
/* this is all the atoms after NET_SUPPORTED in the ObtPropAtoms enum */
|
||||
num_support = OBT_PROP_NUM_ATOMS - OBT_PROP_NET_SUPPORTED - 1;
|
||||
i = 0;
|
||||
supported = g_new(gulong, num_support);
|
||||
supported[i++] = prop_atoms.net_supporting_wm_check;
|
||||
supported[i++] = prop_atoms.net_wm_full_placement;
|
||||
supported[i++] = prop_atoms.net_current_desktop;
|
||||
supported[i++] = prop_atoms.net_number_of_desktops;
|
||||
supported[i++] = prop_atoms.net_desktop_geometry;
|
||||
supported[i++] = prop_atoms.net_desktop_viewport;
|
||||
supported[i++] = prop_atoms.net_active_window;
|
||||
supported[i++] = prop_atoms.net_workarea;
|
||||
supported[i++] = prop_atoms.net_client_list;
|
||||
supported[i++] = prop_atoms.net_client_list_stacking;
|
||||
supported[i++] = prop_atoms.net_desktop_names;
|
||||
supported[i++] = prop_atoms.net_close_window;
|
||||
supported[i++] = prop_atoms.net_desktop_layout;
|
||||
supported[i++] = prop_atoms.net_showing_desktop;
|
||||
supported[i++] = prop_atoms.net_wm_name;
|
||||
supported[i++] = prop_atoms.net_wm_visible_name;
|
||||
supported[i++] = prop_atoms.net_wm_icon_name;
|
||||
supported[i++] = prop_atoms.net_wm_visible_icon_name;
|
||||
supported[i++] = prop_atoms.net_wm_desktop;
|
||||
supported[i++] = prop_atoms.net_wm_strut;
|
||||
supported[i++] = prop_atoms.net_wm_strut_partial;
|
||||
supported[i++] = prop_atoms.net_wm_icon;
|
||||
supported[i++] = prop_atoms.net_wm_icon_geometry;
|
||||
supported[i++] = prop_atoms.net_wm_window_type;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_desktop;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_dock;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_toolbar;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_menu;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_utility;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_splash;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_dialog;
|
||||
supported[i++] = prop_atoms.net_wm_window_type_normal;
|
||||
supported[i++] = prop_atoms.net_wm_allowed_actions;
|
||||
supported[i++] = prop_atoms.net_wm_action_move;
|
||||
supported[i++] = prop_atoms.net_wm_action_resize;
|
||||
supported[i++] = prop_atoms.net_wm_action_minimize;
|
||||
supported[i++] = prop_atoms.net_wm_action_shade;
|
||||
supported[i++] = prop_atoms.net_wm_action_maximize_horz;
|
||||
supported[i++] = prop_atoms.net_wm_action_maximize_vert;
|
||||
supported[i++] = prop_atoms.net_wm_action_fullscreen;
|
||||
supported[i++] = prop_atoms.net_wm_action_change_desktop;
|
||||
supported[i++] = prop_atoms.net_wm_action_close;
|
||||
supported[i++] = prop_atoms.net_wm_action_above;
|
||||
supported[i++] = prop_atoms.net_wm_action_below;
|
||||
supported[i++] = prop_atoms.net_wm_state;
|
||||
supported[i++] = prop_atoms.net_wm_state_modal;
|
||||
supported[i++] = prop_atoms.net_wm_state_maximized_vert;
|
||||
supported[i++] = prop_atoms.net_wm_state_maximized_horz;
|
||||
supported[i++] = prop_atoms.net_wm_state_shaded;
|
||||
supported[i++] = prop_atoms.net_wm_state_skip_taskbar;
|
||||
supported[i++] = prop_atoms.net_wm_state_skip_pager;
|
||||
supported[i++] = prop_atoms.net_wm_state_hidden;
|
||||
supported[i++] = prop_atoms.net_wm_state_fullscreen;
|
||||
supported[i++] = prop_atoms.net_wm_state_above;
|
||||
supported[i++] = prop_atoms.net_wm_state_below;
|
||||
supported[i++] = prop_atoms.net_wm_state_demands_attention;
|
||||
supported[i++] = prop_atoms.net_moveresize_window;
|
||||
supported[i++] = prop_atoms.net_wm_moveresize;
|
||||
supported[i++] = prop_atoms.net_wm_user_time;
|
||||
supported[i++] = OBT_PROP_ATOM(NET_SUPPORTING_WM_CHECK);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_FULL_PLACEMENT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_CURRENT_DESKTOP);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_NUMBER_OF_DESKTOPS);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_GEOMETRY);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_VIEWPORT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_ACTIVE_WINDOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WORKAREA);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_CLIENT_LIST);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_CLIENT_LIST_STACKING);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_NAMES);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_CLOSE_WINDOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_DESKTOP_LAYOUT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_SHOWING_DESKTOP);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_NAME);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_VISIBLE_NAME);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ICON_NAME);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_VISIBLE_ICON_NAME);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_DESKTOP);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STRUT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STRUT_PARTIAL);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ICON);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ICON_GEOMETRY);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DESKTOP);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_TOOLBAR);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_MENU);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_UTILITY);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_SPLASH);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DIALOG);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_NORMAL);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ALLOWED_ACTIONS);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MOVE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_RESIZE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MINIMIZE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_SHADE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_HORZ);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_MAXIMIZE_VERT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_FULLSCREEN);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_CHANGE_DESKTOP);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_CLOSE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_ABOVE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_ACTION_BELOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MODAL);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SHADED);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_TASKBAR);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_SKIP_PAGER);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_HIDDEN);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_FULLSCREEN);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_ABOVE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_BELOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_STATE_DEMANDS_ATTENTION);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_MOVERESIZE_WINDOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_MOVERESIZE);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_USER_TIME);
|
||||
/*
|
||||
supported[i++] = prop_atoms.net_wm_user_time_window;
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_USER_TIME_WINDOW);
|
||||
*/
|
||||
supported[i++] = prop_atoms.net_frame_extents;
|
||||
supported[i++] = prop_atoms.net_request_frame_extents;
|
||||
supported[i++] = prop_atoms.net_restack_window;
|
||||
supported[i++] = prop_atoms.net_startup_id;
|
||||
supported[i++] = OBT_PROP_ATOM(NET_FRAME_EXTENTS);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_REQUEST_FRAME_EXTENTS);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_RESTACK_WINDOW);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_STARTUP_ID);
|
||||
#ifdef SYNC
|
||||
supported[i++] = prop_atoms.net_wm_sync_request;
|
||||
supported[i++] = prop_atoms.net_wm_sync_request_counter;
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST_COUNTER);
|
||||
#endif
|
||||
supported[i++] = prop_atoms.net_wm_pid;
|
||||
supported[i++] = prop_atoms.net_wm_ping;
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_PID);
|
||||
supported[i++] = OBT_PROP_ATOM(NET_WM_PING);
|
||||
|
||||
supported[i++] = prop_atoms.kde_wm_change_state;
|
||||
supported[i++] = prop_atoms.kde_net_wm_frame_strut;
|
||||
supported[i++] = prop_atoms.kde_net_wm_window_type_override;
|
||||
supported[i++] = OBT_PROP_ATOM(KDE_WM_CHANGE_STATE);
|
||||
supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_FRAME_STRUT);
|
||||
supported[i++] = OBT_PROP_ATOM(KDE_NET_WM_WINDOW_TYPE_OVERRIDE);
|
||||
|
||||
supported[i++] = prop_atoms.ob_wm_action_undecorate;
|
||||
supported[i++] = prop_atoms.ob_wm_state_undecorated;
|
||||
supported[i++] = prop_atoms.openbox_pid;
|
||||
supported[i++] = prop_atoms.ob_theme;
|
||||
supported[i++] = prop_atoms.ob_control;
|
||||
supported[i++] = OBT_PROP_ATOM(OB_WM_ACTION_UNDECORATE);
|
||||
supported[i++] = OBT_PROP_ATOM(OB_WM_STATE_UNDECORATED);
|
||||
supported[i++] = OBT_PROP_ATOM(OPENBOX_PID);
|
||||
supported[i++] = OBT_PROP_ATOM(OB_THEME);
|
||||
supported[i++] = OBT_PROP_ATOM(OB_CONTROL);
|
||||
g_assert(i == num_support);
|
||||
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
net_supported, atom, supported, num_support);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_SUPPORTED, ATOM, supported, num_support);
|
||||
g_free(supported);
|
||||
|
||||
screen_tell_ksplash();
|
||||
|
@ -364,8 +361,8 @@ void screen_startup(gboolean reconfig)
|
|||
screen_resize();
|
||||
|
||||
/* have names already been set for the desktops? */
|
||||
if (PROP_GETSS(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_names, utf8, &names))
|
||||
if (OBT_PROP_GETSS(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_NAMES, utf8, &names))
|
||||
{
|
||||
g_strfreev(names);
|
||||
namesexist = TRUE;
|
||||
|
@ -387,8 +384,8 @@ void screen_startup(gboolean reconfig)
|
|||
names[i] = g_strdup(it->data);
|
||||
|
||||
/* set the root window property */
|
||||
PROP_SETSS(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_names,names);
|
||||
OBT_PROP_SETSS(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_NAMES, names);
|
||||
|
||||
g_strfreev(names);
|
||||
}
|
||||
|
@ -398,8 +395,8 @@ void screen_startup(gboolean reconfig)
|
|||
this will also set the default names from the config file up for
|
||||
desktops that don't have names yet */
|
||||
screen_num_desktops = 0;
|
||||
if (PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
net_number_of_desktops, cardinal, &d))
|
||||
if (OBT_PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
NET_NUMBER_OF_DESKTOPS, CARDINAL, &d))
|
||||
screen_set_num_desktops(d);
|
||||
/* restore from session if possible */
|
||||
else if (session_num_desktops)
|
||||
|
@ -409,8 +406,8 @@ void screen_startup(gboolean reconfig)
|
|||
|
||||
screen_desktop = screen_num_desktops; /* something invalid */
|
||||
/* start on the current desktop when a wm was already running */
|
||||
if (PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
net_current_desktop, cardinal, &d) &&
|
||||
if (OBT_PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||
NET_CURRENT_DESKTOP, CARDINAL, &d) &&
|
||||
d < screen_num_desktops)
|
||||
{
|
||||
screen_set_desktop(d, FALSE);
|
||||
|
@ -424,8 +421,8 @@ void screen_startup(gboolean reconfig)
|
|||
|
||||
/* don't start in showing-desktop mode */
|
||||
screen_showing_desktop = FALSE;
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_showing_desktop, cardinal, screen_showing_desktop);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_SHOWING_DESKTOP, CARDINAL, screen_showing_desktop);
|
||||
|
||||
if (session_desktop_layout_present &&
|
||||
screen_validate_layout(&session_desktop_layout))
|
||||
|
@ -447,11 +444,11 @@ void screen_shutdown(gboolean reconfig)
|
|||
NoEventMask);
|
||||
|
||||
/* we're not running here no more! */
|
||||
PROP_ERASE(RootWindow(obt_display, ob_screen), openbox_pid);
|
||||
OBT_PROP_ERASE(RootWindow(obt_display, ob_screen), OPENBOX_PID);
|
||||
/* not without us */
|
||||
PROP_ERASE(RootWindow(obt_display, ob_screen), net_supported);
|
||||
OBT_PROP_ERASE(RootWindow(obt_display, ob_screen), NET_SUPPORTED);
|
||||
/* don't keep this mode */
|
||||
PROP_ERASE(RootWindow(obt_display, ob_screen), net_showing_desktop);
|
||||
OBT_PROP_ERASE(RootWindow(obt_display, ob_screen), NET_SHOWING_DESKTOP);
|
||||
|
||||
XDestroyWindow(obt_display, screen_support_win);
|
||||
|
||||
|
@ -476,8 +473,8 @@ void screen_resize(void)
|
|||
/* Set the _NET_DESKTOP_GEOMETRY hint */
|
||||
screen_physical_size.width = geometry[0] = w;
|
||||
screen_physical_size.height = geometry[1] = h;
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_geometry, cardinal, geometry, 2);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_GEOMETRY, CARDINAL, geometry, 2);
|
||||
|
||||
if (ob_state() == OB_STATE_STARTING)
|
||||
return;
|
||||
|
@ -501,13 +498,13 @@ void screen_set_num_desktops(guint num)
|
|||
|
||||
old = screen_num_desktops;
|
||||
screen_num_desktops = num;
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_number_of_desktops, cardinal, num);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_NUMBER_OF_DESKTOPS, CARDINAL, num);
|
||||
|
||||
/* set the viewport hint */
|
||||
viewport = g_new0(gulong, num * 2);
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_viewport, cardinal, viewport, num * 2);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_VIEWPORT, CARDINAL, viewport, num * 2);
|
||||
g_free(viewport);
|
||||
|
||||
/* the number of rows/columns will differ */
|
||||
|
@ -602,8 +599,8 @@ void screen_set_desktop(guint num, gboolean dofocus)
|
|||
|
||||
if (previous == num) return;
|
||||
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_current_desktop, cardinal, num);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_CURRENT_DESKTOP, CARDINAL, num);
|
||||
|
||||
/* This whole thing decides when/how to save the screen_last_desktop so
|
||||
that it can be restored later if you want */
|
||||
|
@ -1092,13 +1089,13 @@ void screen_update_layout(void)
|
|||
screen_desktop_layout.rows = 1;
|
||||
screen_desktop_layout.columns = screen_num_desktops;
|
||||
|
||||
if (PROP_GETA32(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_layout, cardinal, &data, &num)) {
|
||||
if (OBT_PROP_GETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_LAYOUT, CARDINAL, &data, &num)) {
|
||||
if (num == 3 || num == 4) {
|
||||
|
||||
if (data[0] == prop_atoms.net_wm_orientation_vert)
|
||||
if (data[0] == OBT_PROP_ATOM(NET_WM_ORIENTATION_VERT))
|
||||
l.orientation = OB_ORIENTATION_VERT;
|
||||
else if (data[0] == prop_atoms.net_wm_orientation_horz)
|
||||
else if (data[0] == OBT_PROP_ATOM(NET_WM_ORIENTATION_HORZ))
|
||||
l.orientation = OB_ORIENTATION_HORZ;
|
||||
else
|
||||
return;
|
||||
|
@ -1106,13 +1103,13 @@ void screen_update_layout(void)
|
|||
if (num < 4)
|
||||
l.start_corner = OB_CORNER_TOPLEFT;
|
||||
else {
|
||||
if (data[3] == prop_atoms.net_wm_topleft)
|
||||
if (data[3] == OBT_PROP_ATOM(NET_WM_TOPLEFT))
|
||||
l.start_corner = OB_CORNER_TOPLEFT;
|
||||
else if (data[3] == prop_atoms.net_wm_topright)
|
||||
else if (data[3] == OBT_PROP_ATOM(NET_WM_TOPRIGHT))
|
||||
l.start_corner = OB_CORNER_TOPRIGHT;
|
||||
else if (data[3] == prop_atoms.net_wm_bottomright)
|
||||
else if (data[3] == OBT_PROP_ATOM(NET_WM_BOTTOMRIGHT))
|
||||
l.start_corner = OB_CORNER_BOTTOMRIGHT;
|
||||
else if (data[3] == prop_atoms.net_wm_bottomleft)
|
||||
else if (data[3] == OBT_PROP_ATOM(NET_WM_BOTTOMLEFT))
|
||||
l.start_corner = OB_CORNER_BOTTOMLEFT;
|
||||
else
|
||||
return;
|
||||
|
@ -1137,8 +1134,8 @@ void screen_update_desktop_names(void)
|
|||
g_strfreev(screen_desktop_names);
|
||||
screen_desktop_names = NULL;
|
||||
|
||||
if (PROP_GETSS(RootWindow(obt_display, ob_screen),
|
||||
net_desktop_names, utf8, &screen_desktop_names))
|
||||
if (OBT_PROP_GETSS(RootWindow(obt_display, ob_screen),
|
||||
NET_DESKTOP_NAMES, utf8, &screen_desktop_names))
|
||||
for (i = 0; screen_desktop_names[i] && i < screen_num_desktops; ++i);
|
||||
else
|
||||
i = 0;
|
||||
|
@ -1164,8 +1161,8 @@ void screen_update_desktop_names(void)
|
|||
|
||||
/* if we changed any names, then set the root property so we can
|
||||
all agree on the names */
|
||||
PROP_SETSS(RootWindow(obt_display, ob_screen), net_desktop_names,
|
||||
screen_desktop_names);
|
||||
OBT_PROP_SETSS(RootWindow(obt_display, ob_screen), NET_DESKTOP_NAMES,
|
||||
screen_desktop_names);
|
||||
}
|
||||
|
||||
/* resize the pager for these names */
|
||||
|
@ -1232,8 +1229,8 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
|
|||
}
|
||||
|
||||
show = !!show; /* make it boolean */
|
||||
PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
net_showing_desktop, cardinal, show);
|
||||
OBT_PROP_SET32(RootWindow(obt_display, ob_screen),
|
||||
NET_SHOWING_DESKTOP, CARDINAL, show);
|
||||
}
|
||||
|
||||
void screen_install_colormap(ObClient *client, gboolean install)
|
||||
|
@ -1457,8 +1454,8 @@ void screen_update_areas(void)
|
|||
|
||||
/* all the work areas are not used here, only the ones for the first
|
||||
monitor are */
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen), net_workarea, cardinal,
|
||||
dims, 4 * screen_num_desktops);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen), NET_WORKAREA, CARDINAL,
|
||||
dims, 4 * screen_num_desktops);
|
||||
|
||||
/* the area has changed, adjust all the windows if they need it */
|
||||
for (it = client_list; it; it = g_list_next(it))
|
||||
|
|
|
@ -38,7 +38,6 @@ GList* session_state_find(struct _ObClient *c) { return NULL; }
|
|||
#include "debug.h"
|
||||
#include "openbox.h"
|
||||
#include "client.h"
|
||||
#include "prop.h"
|
||||
#include "focus.h"
|
||||
#include "gettext.h"
|
||||
#include "parser/parse.h"
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
#include "openbox.h"
|
||||
#include "prop.h"
|
||||
#include "screen.h"
|
||||
#include "focus.h"
|
||||
#include "client.h"
|
||||
|
@ -26,6 +25,7 @@
|
|||
#include "frame.h"
|
||||
#include "window.h"
|
||||
#include "debug.h"
|
||||
#include "obt/prop.h"
|
||||
|
||||
GList *stacking_list = NULL;
|
||||
/*! When true, stacking changes will not be reflected on the screen. This is
|
||||
|
@ -54,8 +54,8 @@ void stacking_set_list(void)
|
|||
}
|
||||
}
|
||||
|
||||
PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
net_client_list_stacking, window, (gulong*)windows, i);
|
||||
OBT_PROP_SETA32(RootWindow(obt_display, ob_screen),
|
||||
NET_CLIENT_LIST_STACKING, WINDOW, (gulong*)windows, i);
|
||||
|
||||
g_free(windows);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue