[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 79b50d0f90: Avoid extra sync if we didn't get the right wmstate
From: |
Po Lu |
Subject: |
master 79b50d0f90: Avoid extra sync if we didn't get the right wmstate |
Date: |
Thu, 31 Mar 2022 20:48:38 -0400 (EDT) |
branch: master
commit 79b50d0f90707f28d8ce7d83e03c54c3572af782
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Avoid extra sync if we didn't get the right wmstate
* src/xterm.c (x_dnd_get_wm_state_and_proto): Always set proto
version.
(x_dnd_get_target_window): Optimize accordingly.
---
src/xterm.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index 3c71ddf395..aec78dece5 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2164,10 +2164,9 @@ x_dnd_get_wm_state_and_proto (struct x_display_info
*dpyinfo,
x_uncatch_errors ();
if (rc)
- {
- *wmstate_out = *(unsigned long *) data;
- *proto_out = x_dnd_get_window_proto (dpyinfo, window);
- }
+ *wmstate_out = *(unsigned long *) data;
+
+ *proto_out = x_dnd_get_window_proto (dpyinfo, window);
if (data)
XFree (data);
@@ -2210,6 +2209,7 @@ x_dnd_get_wm_state_and_proto (struct x_display_info
*dpyinfo,
reply = xcb_get_property_reply (dpyinfo->xcb_connection,
xdnd_proto_cookie, &error);
+ *proto_out = -1;
if (!reply)
free (error);
else
@@ -2217,8 +2217,6 @@ x_dnd_get_wm_state_and_proto (struct x_display_info
*dpyinfo,
if (reply->format == 32
&& xcb_get_property_value_length (reply) >= 4)
*proto_out = *(uint32_t *) xcb_get_property_value (reply);
- else
- *proto_out = -1;
free (reply);
}
@@ -2359,17 +2357,10 @@ x_dnd_get_target_window (struct x_display_info *dpyinfo,
if (child_return)
{
if (x_dnd_get_wm_state_and_proto (dpyinfo, child_return,
- &wmstate, &proto))
- {
- *proto_out = proto;
- x_uncatch_errors ();
-
- return child_return;
- }
-
- proto = x_dnd_get_window_proto (dpyinfo, child_return);
-
- if (proto != -1)
+ &wmstate, &proto)
+ /* Proto is set by x_dnd_get_wm_state even if getting
+ the wm state failed. */
+ || proto != -1)
{
*proto_out = proto;
x_uncatch_errors ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 79b50d0f90: Avoid extra sync if we didn't get the right wmstate,
Po Lu <=