Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
convert send_to_ws() and client_msg() to XCB
[spectrwm.git]
/
spectrwm.c
diff --git
a/spectrwm.c
b/spectrwm.c
index
87fa847
..
605ba36
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-626,6
+626,18
@@
void update_window(struct ws_win *);
void spawn_select(struct swm_region *, union arg *, char *, int *);
unsigned char *get_win_name(xcb_window_t);
xcb_atom_t get_atom_from_string(const char *);
void spawn_select(struct swm_region *, union arg *, char *, int *);
unsigned char *get_win_name(xcb_window_t);
xcb_atom_t get_atom_from_string(const char *);
+void map_window_raised(xcb_window_t);
+
+void
+map_window_raised(xcb_window_t win)
+{
+ uint32_t val = XCB_STACK_MODE_ABOVE;
+
+ xcb_configure_window(conn, win,
+ XCB_CONFIG_WINDOW_STACK_MODE, &val);
+
+ xcb_map_window(conn, win);
+}
xcb_atom_t
get_atom_from_string(const char *str)
xcb_atom_t
get_atom_from_string(const char *str)
@@
-1810,7
+1822,7
@@
bar_toggle(struct swm_region *r, union arg *args)
for (i = 0; i < num_screens; i++)
TAILQ_FOREACH(tmpr, &screens[i].rl, entry)
if (tmpr->bar)
for (i = 0; i < num_screens; i++)
TAILQ_FOREACH(tmpr, &screens[i].rl, entry)
if (tmpr->bar)
- XMapRaised(display, tmpr->bar->id);
+ map_window_raised(tmpr->bar->id);
}
bar_enabled = !bar_enabled;
}
bar_enabled = !bar_enabled;
@@
-1933,7
+1945,7
@@
bar_setup(struct swm_region *r)
XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE);
if (bar_enabled)
XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE);
if (bar_enabled)
- XMapRaised(display, r->bar->id);
+ map_window_raised(r->bar->id);
DNPRINTF(SWM_D_BAR, "bar_setup: window: 0x%lx, (x,y) w x h: (%d,%d) "
"%d x %d\n", WINID(r->bar), X(r->bar), Y(r->bar), WIDTH(r->bar),
DNPRINTF(SWM_D_BAR, "bar_setup: window: 0x%lx, (x,y) w x h: (%d,%d) "
"%d x %d\n", WINID(r->bar), X(r->bar), Y(r->bar), WIDTH(r->bar),
@@
-2011,21
+2023,23
@@
version(struct swm_region *r, union arg *args)
}
void
}
void
-client_msg(struct ws_win *win, Atom a)
+client_msg(struct ws_win *win, xcb_atom_t a)
{
{
- XClientMessageEvent cm;
+ xcb_client_message_event_t ev;
if (win == NULL)
return;
if (win == NULL)
return;
- bzero(&cm, sizeof cm);
- cm.type = ClientMessage;
- cm.window = win->id;
- cm.message_type = aprot;
- cm.format = 32;
- cm.data.l[0] = a;
- cm.data.l[1] = CurrentTime;
- XSendEvent(display, win->id, False, 0L, (XEvent *)&cm);
+ bzero(&ev, sizeof ev);
+ ev.response_type = XCB_CLIENT_MESSAGE;
+ ev.window = win->id;
+ ev.type = aprot;
+ ev.format = 32;
+ ev.data.data32[0] = a;
+ ev.data.data32[1] = XCB_CURRENT_TIME;
+
+ xcb_send_event(conn, False, win->id,
+ XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
}
/* synthetic response to a ConfigureRequest when not making a change */
}
/* synthetic response to a ConfigureRequest when not making a change */
@@
-2545,7
+2559,7
@@
focus_win(struct ws_win *win)
win->ws->r->s->c[SWM_S_COLOR_FOCUS].color);
if (win->ws->cur_layout->flags & SWM_L_MAPONFOCUS ||
win->ws->always_raise)
win->ws->r->s->c[SWM_S_COLOR_FOCUS].color);
if (win->ws->cur_layout->flags & SWM_L_MAPONFOCUS ||
win->ws->always_raise)
- XMapRaised(display, win->id);
+ map_window_raised(win->id);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win->s->root,
ewmh[_NET_ACTIVE_WINDOW].atom, XCB_ATOM_WINDOW, 32, 1,
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win->s->root,
ewmh[_NET_ACTIVE_WINDOW].atom, XCB_ATOM_WINDOW, 32, 1,
@@
-3376,7
+3390,7
@@
stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip)
if (XGetWindowAttributes(display, win->id, &wa))
if (wa.map_state == IsUnmapped)
if (XGetWindowAttributes(display, win->id, &wa))
if (wa.map_state == IsUnmapped)
- XMapRaised(display, win->id);
+ map_window_raised(win->id);
last_h = win_g.h;
i++;
last_h = win_g.h;
i++;
@@
-3396,12
+3410,12
@@
notiles:
}
stack_floater(win, ws->r);
}
stack_floater(win, ws->r);
- XMapRaised(display, win->id);
+ map_window_raised(win->id);
}
if (fs_win) {
stack_floater(fs_win, ws->r);
}
if (fs_win) {
stack_floater(fs_win, ws->r);
- XMapRaised(display, fs_win->id);
+ map_window_raised(fs_win->id);
}
}
}
}
@@
-3563,7
+3577,7
@@
max_stack(struct workspace *ws, struct swm_geometry *g)
/* put the last transient on top */
if (wintrans) {
if (parent)
/* put the last transient on top */
if (wintrans) {
if (parent)
- XMapRaised(display, parent->id);
+ map_window_raised(parent->id);
stack_floater(wintrans, ws->r);
focus_magic(wintrans);
}
stack_floater(wintrans, ws->r);
focus_magic(wintrans);
}
@@
-3575,8
+3589,8
@@
send_to_ws(struct swm_region *r, union arg *args)
int wsid = args->id;
struct ws_win *win = NULL, *parent;
struct workspace *ws, *nws;
int wsid = args->id;
struct ws_win *win = NULL, *parent;
struct workspace *ws, *nws;
- Atom ws_idx_atom = 0;
- unsigned char ws_idx_str[SWM_PROPLEN];
+ xcb_atom_t ws_idx_atom = XCB_ATOM_NONE;
+ char ws_idx_str[SWM_PROPLEN];
union arg a;
if (wsid >= workspace_limit)
union arg a;
if (wsid >= workspace_limit)
@@
-3615,14
+3629,15
@@
send_to_ws(struct swm_region *r, union arg *args)
win->ws = nws;
/* Try to update the window's workspace property */
win->ws = nws;
/* Try to update the window's workspace property */
- ws_idx_atom = XInternAtom(display, "_SWM_WS", False);
+ ws_idx_atom = get_atom_from_string("_SWM_WS");
if (ws_idx_atom &&
if (ws_idx_atom &&
- snprintf((char *)ws_idx_str, SWM_PROPLEN, "%d", nws->idx) <
+ snprintf(ws_idx_str, SWM_PROPLEN, "%d", nws->idx) <
SWM_PROPLEN) {
DNPRINTF(SWM_D_PROP, "send_to_ws: set property: _SWM_WS: %s\n",
ws_idx_str);
SWM_PROPLEN) {
DNPRINTF(SWM_D_PROP, "send_to_ws: set property: _SWM_WS: %s\n",
ws_idx_str);
- XChangeProperty(display, win->id, ws_idx_atom, XA_STRING, 8,
- PropModeReplace, ws_idx_str, strlen((char *)ws_idx_str));
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, win->id,
+ ws_idx_atom, XCB_ATOM_STRING, 8, strlen(ws_idx_str),
+ ws_idx_str);
}
stack();
}
stack();
@@
-3860,7
+3875,7
@@
search_win(struct swm_region *r, union arg *args)
TAILQ_INSERT_TAIL(&search_wl, sw, entry);
sw->gc = XCreateGC(display, w, 0, &gcv);
TAILQ_INSERT_TAIL(&search_wl, sw, entry);
sw->gc = XCreateGC(display, w, 0, &gcv);
- XMapRaised(display, w);
+ map_window_raised(w);
XSetForeground(display, sw->gc, r->s->c[SWM_S_COLOR_BAR].color);
DRAWSTRING(display, w, bar_fs, sw->gc, 2,
XSetForeground(display, sw->gc, r->s->c[SWM_S_COLOR_BAR].color);
DRAWSTRING(display, w, bar_fs, sw->gc, 2,
@@
-6490,7
+6505,7
@@
manage_window(xcb_window_t id)
/* floaters need to be mapped if they are in the current workspace */
if ((win->floating || win->transient) && (ws->idx == r->ws->idx))
/* floaters need to be mapped if they are in the current workspace */
if ((win->floating || win->transient) && (ws->idx == r->ws->idx))
- XMapRaised(display, win->id);
+ map_window_raised(win->id);
return (win);
}
return (win);
}
@@
-6969,7
+6984,7
@@
propertynotify(XEvent *e)
if (ev->state == PropertyDelete && ev->atom == a_swm_iconic) {
update_iconic(win, 0);
if (ev->state == PropertyDelete && ev->atom == a_swm_iconic) {
update_iconic(win, 0);
- XMapRaised(display, win->id);
+ map_window_raised(win->id);
stack();
focus_win(win);
return;
stack();
focus_win(win);
return;