Skip to content

Commit 485ebae

Browse files
committed
Name msg_* properly
1 parent a15af6d commit 485ebae

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

gui-agent/vmside.c

+31-25
Original file line numberDiff line numberDiff line change
@@ -1673,11 +1673,11 @@ static void handle_keypress(Ghandles * g, XID UNUSED(winid))
16731673

16741674
static void handle_button(Ghandles * g, XID winid)
16751675
{
1676-
struct msg_button key;
1676+
struct msg_button msg;
16771677
struct genlist *l = list_lookup(windows_list, winid);
16781678

16791679

1680-
read_data(g->vchan, (char *) &key, sizeof(key));
1680+
read_data(g->vchan, (char *) &msg, sizeof(msg));
16811681
if (l && l->data && ((struct window_data*)l->data)->is_docked) {
16821682
/* get position of embeder, not icon itself*/
16831683
winid = ((struct window_data*)l->data)->embeder;
@@ -1687,19 +1687,19 @@ static void handle_button(Ghandles * g, XID winid)
16871687
if (g->log_level > 1)
16881688
fprintf(stderr,
16891689
"send buttonevent, win 0x%x type=%d button=%d\n",
1690-
(int) winid, key.type, key.button);
1691-
feed_xdriver(g, 'B', key.button, key.type == ButtonPress ? 1 : 0);
1690+
(int) winid, msg.type, msg.button);
1691+
feed_xdriver(g, 'B', msg.button, msg.type == ButtonPress ? 1 : 0);
16921692
}
16931693

16941694
static void handle_motion(Ghandles * g, XID winid)
16951695
{
1696-
struct msg_motion key;
1696+
struct msg_motion msg;
16971697
// XMotionEvent event;
16981698
XWindowAttributes attr;
16991699
int ret;
17001700
struct genlist *l = list_lookup(windows_list, winid);
17011701

1702-
read_data(g->vchan, (char *) &key, sizeof(key));
1702+
read_data(g->vchan, (char *) &msg, sizeof(msg));
17031703
if (l && l->data && ((struct window_data*)l->data)->is_docked) {
17041704
/* get position of embeder, not icon itself*/
17051705
winid = ((struct window_data*)l->data)->embeder;
@@ -1712,14 +1712,14 @@ static void handle_motion(Ghandles * g, XID winid)
17121712
return;
17131713
};
17141714

1715-
feed_xdriver(g, 'M', attr.x + key.x, attr.y + key.y);
1715+
feed_xdriver(g, 'M', attr.x + msg.x, attr.y + msg.y);
17161716
}
17171717

17181718
// ensure that LeaveNotify is delivered to the window - if pointer is still
17191719
// above this window, place stub window between pointer and the window
17201720
static void handle_crossing(Ghandles * g, XID winid)
17211721
{
1722-
struct msg_crossing key;
1722+
struct msg_crossing msg;
17231723
XWindowAttributes attr;
17241724
int ret;
17251725
struct genlist *l = list_lookup(windows_list, winid);
@@ -1731,9 +1731,9 @@ static void handle_crossing(Ghandles * g, XID winid)
17311731
winid = ((struct window_data*)l->data)->embeder;
17321732
}
17331733

1734-
read_data(g->vchan, (char *) &key, sizeof(key));
1734+
read_data(g->vchan, (char *) &msg, sizeof(msg));
17351735

1736-
if (key.mode != NotifyNormal)
1736+
if (msg.mode != NotifyNormal)
17371737
return;
17381738
ret = XGetWindowAttributes(g->display, winid, &attr);
17391739
if (ret != 1) {
@@ -1743,11 +1743,11 @@ static void handle_crossing(Ghandles * g, XID winid)
17431743
return;
17441744
};
17451745

1746-
if (key.type == EnterNotify) {
1746+
if (msg.type == EnterNotify) {
17471747
// hide stub window
17481748
XUnmapWindow(g->display, g->stub_win);
1749-
feed_xdriver(g, 'M', attr.x + key.x, attr.y + key.y);
1750-
} else if (key.type == LeaveNotify) {
1749+
feed_xdriver(g, 'M', attr.x + msg.x, attr.y + msg.y);
1750+
} else if (msg.type == LeaveNotify) {
17511751
XID window_under_pointer, root_returned;
17521752
int root_x, root_y, win_x, win_y;
17531753
unsigned int mask_return;
@@ -1771,7 +1771,7 @@ static void handle_crossing(Ghandles * g, XID winid)
17711771
XRaiseWindow(g->display, g->stub_win);
17721772
}
17731773
} else {
1774-
fprintf(stderr, "Invalid crossing event: %d\n", key.type);
1774+
fprintf(stderr, "Invalid crossing event: %d\n", msg.type);
17751775
}
17761776

17771777
}
@@ -1794,16 +1794,15 @@ static void take_focus(Ghandles * g, XID winid)
17941794
(int) winid);
17951795
}
17961796

1797-
static void handle_focus(Ghandles * g, XID winid)
1797+
static void handle_focus_helper(Ghandles * g, XID winid, struct msg_focus msg)
17981798
{
1799-
struct msg_focus key;
18001799
struct genlist *l;
18011800
int use_take_focus = false;
18021801

1803-
read_data(g->vchan, (char *) &key, sizeof(key));
1802+
read_data(g->vchan, (char *) &msg, sizeof(msg));
18041803

1805-
if (key.type == FocusIn) {
1806-
if (key.mode == NotifyNormal) {
1804+
if (msg.type == FocusIn) {
1805+
if (msg.mode == NotifyNormal) {
18071806
XSetInputFocus(g->display, winid, RevertToNone, g->time);
18081807
XRaiseWindow(g->display, winid);
18091808
if (g->log_level > 1)
@@ -1822,14 +1821,14 @@ static void handle_focus(Ghandles * g, XID winid)
18221821
if (use_take_focus)
18231822
take_focus(g, winid);
18241823
}
1825-
if (key.mode == NotifyGrab) {
1824+
if (msg.mode == NotifyGrab) {
18261825
XGrabPointer(g->display, winid, false, 0, GrabModeSync, GrabModeSync, None, None, CurrentTime);
18271826
}
1828-
if (key.mode == NotifyNormal || key.mode == NotifyUngrab) {
1827+
if (msg.mode == NotifyNormal || msg.mode == NotifyUngrab) {
18291828
XUngrabPointer(g->display, CurrentTime);
18301829
}
1831-
} else if (key.type == FocusOut) {
1832-
if (key.mode == NotifyNormal) {
1830+
} else if (msg.type == FocusOut) {
1831+
if (msg.mode == NotifyNormal) {
18331832
int ignore;
18341833
XID winid_focused;
18351834
XGetInputFocus(g->display, &winid_focused, &ignore);
@@ -1839,15 +1838,22 @@ static void handle_focus(Ghandles * g, XID winid)
18391838
fprintf(stderr, "0x%x lost focus\n", (int) winid);
18401839
}
18411840
}
1842-
if (key.mode == NotifyGrab) {
1841+
if (msg.mode == NotifyGrab) {
18431842
XGrabPointer(g->display, g->root_win, false, 0, GrabModeSync, GrabModeSync, None, None, CurrentTime);
18441843
}
1845-
if (key.mode == NotifyUngrab) {
1844+
if (msg.mode == NotifyUngrab) {
18461845
XUngrabPointer(g->display, CurrentTime);
18471846
}
18481847
}
18491848
}
18501849

1850+
static void handle_focus(Ghandles * g, XID winid)
1851+
{
1852+
struct msg_focus msg;
1853+
read_data(g->vchan, (char *) &msg, sizeof(msg));
1854+
return handle_focus_helper(g, winid, msg);
1855+
}
1856+
18511857
static int bitset(unsigned char *keys, int num)
18521858
{
18531859
return (keys[num / 8] >> (num % 8)) & 1;

0 commit comments

Comments
 (0)