Skip to content

Commit

Permalink
vmside: Rename wm_state to net_wm_state.
Browse files Browse the repository at this point in the history
The internal variable "wm_state" is used to store the X atom
"_NET_WM_STATE".  Rename this variable to "net_wm_state" to avoid
confusion, because "WM_STATE" is something different from
"_NET_WM_STATE" and we need to handle both.
  • Loading branch information
Benjamin Moody committed Dec 11, 2020
1 parent 70a8f14 commit ea4931e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gui-agent/vmside.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct _global_handles {
Atom tray_opcode; /* Atom: _NET_SYSTEM_TRAY_MESSAGE_OPCODE */
Atom xembed_info; /* Atom: _XEMBED_INFO */
Atom utf8_string_atom; /* Atom: UTF8_STRING */
Atom wm_state; /* Atom: _NET_WM_STATE */
Atom net_wm_state; /* Atom: _NET_WM_STATE */
Atom wm_state_fullscreen; /* Atom: _NET_WM_STATE_FULLSCREEN */
Atom wm_state_demands_attention; /* Atom: _NET_WM_STATE_DEMANDS_ATTENTION */
Atom wm_take_focus; /* Atom: WM_TAKE_FOCUS */
Expand Down Expand Up @@ -783,7 +783,7 @@ static void send_window_state(Ghandles * g, XID window)
struct msg_window_flags flags;

/* FIXME: only first 10 elements are parsed */
ret = XGetWindowProperty(g->display, window, g->wm_state, 0, 10,
ret = XGetWindowProperty(g->display, window, g->net_wm_state, 0, 10,
False, XA_ATOM, &act_type, &act_fmt, &nitems, &bytesleft, (unsigned char**)&state_list);
if (ret != Success)
return;
Expand Down Expand Up @@ -838,7 +838,7 @@ static void process_xevent_unmap(Ghandles * g, XID window)
hdr.window = window;
hdr.untrusted_len = 0;
write_struct(g->vchan, hdr);
XDeleteProperty(g->display, window, g->wm_state);
XDeleteProperty(g->display, window, g->net_wm_state);
}

static void process_xevent_destroy(Ghandles * g, XID window)
Expand Down Expand Up @@ -1249,7 +1249,7 @@ static void process_xevent_message(Ghandles * g, XClientMessageEvent * ev)
fprintf(stderr, "unhandled tray opcode: %ld\n",
ev->data.l[1]);
}
} else if (ev->message_type == g->wm_state) {
} else if (ev->message_type == g->net_wm_state) {
struct msg_hdr hdr;
struct msg_window_flags msg;

Expand Down Expand Up @@ -1552,7 +1552,7 @@ static void mkghandles(Ghandles * g)
g->tray_opcode =
XInternAtom(g->display, "_NET_SYSTEM_TRAY_OPCODE", False);
g->xembed_info = XInternAtom(g->display, "_XEMBED_INFO", False);
g->wm_state = XInternAtom(g->display, "_NET_WM_STATE", False);
g->net_wm_state = XInternAtom(g->display, "_NET_WM_STATE", False);
g->wm_state_fullscreen = XInternAtom(g->display, "_NET_WM_STATE_FULLSCREEN", False);
g->wm_state_demands_attention = XInternAtom(g->display, "_NET_WM_STATE_DEMANDS_ATTENTION", False);
g->wm_take_focus = XInternAtom(g->display, "WM_TAKE_FOCUS", False);
Expand Down Expand Up @@ -2082,7 +2082,7 @@ static void handle_window_flags(Ghandles *g, XID winid)
read_data(g->vchan, (char *) &msg_flags, sizeof(msg_flags));

/* FIXME: only first 10 elements are parsed */
ret = XGetWindowProperty(g->display, winid, g->wm_state, 0, 10,
ret = XGetWindowProperty(g->display, winid, g->net_wm_state, 0, 10,
False, XA_ATOM, &act_type, &act_fmt, &nitems, &bytesleft, (unsigned char**)&state_list);
if (ret != Success)
return;
Expand Down Expand Up @@ -2115,7 +2115,7 @@ static void handle_window_flags(Ghandles *g, XID winid)
if (!changed)
return;

XChangeProperty(g->display, winid, g->wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)new_state_list, j);
XChangeProperty(g->display, winid, g->net_wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)new_state_list, j);
}

static void handle_message(Ghandles * g)
Expand Down

0 comments on commit ea4931e

Please sign in to comment.