Mail Archives: cygwin/2022/04/25/23:54:57
X-Recipient: | archive-cygwin AT delorie DOT com
|
X-Original-To: | cygwin AT cygwin DOT com
|
Delivered-To: | cygwin AT cygwin DOT com
|
DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 78D493858C56
|
Authentication-Results: | sourceware.org;
|
| dmarc=pass (p=none dis=none) header.from=gmail.com
|
Authentication-Results: | sourceware.org; spf=pass smtp.mailfrom=gmail.com
|
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
|
| h=mime-version:from:date:message-id:subject:to;
|
| bh=JCWMJI99WEkKxB5eiTR6iZ7mNADC8p8bKI7bUJfUkOc=;
|
| b=n1A7WNmmsaoTmHzSDTBKCQQpQqSLJ8O/5DyF0uBNRSsngOM9HB3n1tSR3pa/c/4Sk5
|
| Wc6QReDWvRUYToYuaW0FKFzedUT/3enfnfeBmD8aFjwZl+JSXi5OnUcp8RdPVYAhejIh
|
| hZtp80wzjWkfCzwk9GKMWpapj1PnK8IpKTKw1hDINduJaiNAeRHOZCxqY8Cr/vNoEZBm
|
| ra6fajVDDuV+BG7tfd+cwLwzCNfsv9sjXVfXNx242JGXQRcORhNf+wZdRLvl6gYMVP35
|
| uYFQqDIXmMv0phbTELrwWI/Sr8Hs8O3eYyWqBR/XLdQ2EUJXiEj8SgZm3JgfjBoNkEYm
|
| fDAA==
|
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed;
|
| d=1e100.net; s=20210112;
|
| h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
|
| bh=JCWMJI99WEkKxB5eiTR6iZ7mNADC8p8bKI7bUJfUkOc=;
|
| b=p/Jn9xUs9dB2BEcTifLabbWb20FImYQ5LR8p2Q/0aU7ZMGDsym/sgJZbgMrFr7dsKp
|
| sAETdttPN81Vavwc3p8XZJMpO8zeRA3gWZo8F51OIIdjkKzu+DIgEyIfuaEj+Us/B2FN
|
| 75y414Jjqj53Uue1jSnpgqQeWQ0Kek15mGJaCU4CN4Edobx9+ny5qOpK8i9lWtuetAFN
|
| U+PPR3a0jyuWCQZsTrdTg3TwRL6QLGpBqJlbIYseZnIfeIdkVtvWYZTtl28azAh5Cfit
|
| BgbTUp8ebAbWL5oIlLc+gslPfhpoGVLNe1s1DmQtx1ULLOPjs/yMNH3aR44J4ibCdlsE
|
| oCcQ==
|
X-Gm-Message-State: | AOAM531MCgoveMxINCOLqI/lAZCGatN7iW80VVV1dLK8kuSp2PGKGaqJ
|
| xMqqEJltQNPw+rJN+drYhgKX4VSHfGnUbqNS5hM+emkN7K0=
|
X-Google-Smtp-Source: | ABdhPJwDvFG/qW2Ri+FTyTt2Lz/+abaIJdQBEaP5soLuaws2d32KOrJfNzqEr2WFHW4FKAbfoLOcaWYmv5/K7tdxVw0=
|
X-Received: | by 2002:a92:6c08:0:b0:2c6:123f:48c9 with SMTP id
|
| h8-20020a926c08000000b002c6123f48c9mr8770887ilc.22.1650945246478; Mon, 25 Apr
|
| 2022 20:54:06 -0700 (PDT)
|
MIME-Version: | 1.0
|
From: | "S.J. Luo" <sjaluo AT gmail DOT com>
|
Date: | Tue, 26 Apr 2022 11:53:56 +0800
|
Message-ID: | <CAMoHPCaPjj-XyzRXc4yv1U5=1PXK_tASbEd5Caxi0dSPZA89og@mail.gmail.com>
|
Subject: | Window flickering problem in XWin multiwindow mode
|
To: | cygwin AT cygwin DOT com
|
X-Spam-Status: | No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED,
|
| DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
|
| SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4
|
X-Spam-Checker-Version: | SpamAssassin 3.4.4 (2020-01-24) on
|
| server2.sourceware.org
|
X-BeenThere: | cygwin AT cygwin DOT com
|
X-Mailman-Version: | 2.1.29
|
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com>
|
List-Archive: | <https://cygwin.com/pipermail/cygwin/>
|
List-Post: | <mailto:cygwin AT cygwin DOT com>
|
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help>
|
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>,
|
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
|
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
|
Hi,
I have some EDA tools running on a Linux machine and display on my Windows
PC using xorg-server-21.1.3 XWin multiwindow mode
Sometimes the application window flickers forever for an unknown reason.
The problem became more severe after my PC upgrade to Windows10.
Googling the problem, I did not find such issue reported.
I decided to take advantage of open source nature and solve it by myself.
After re-compiling and debugging, I found a calling loop triggered.
Here I eliminate the detail of the cause. I may write later if someone requires.
Knowing the root cause, I am now able to demonstrate the issue with a small
test case as well as a patch that works for me. Both are attached below.
SL
The test case:
==============
/* Compile : gcc -o flicker2 flicker2.c -lX11 */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void SetMax(Display *dpy, Window win, int val)
{
XEvent xev;
Atom wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
Atom max_horz = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
Atom max_vert = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False);
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
xev.xclient.window = win;
xev.xclient.message_type = wm_state;
xev.xclient.format = 32;
xev.xclient.data.l[0] = val; // _NET_WM_STATE_ADD or _NET_WM_STATE_REMOVE
xev.xclient.data.l[1] = max_horz;
xev.xclient.data.l[2] = max_vert;
XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureNotifyMask, &xev);
}
int main(void) {
Display *display;
Window win;
XEvent X;
int screen;
if (!(display = XOpenDisplay(NULL)))
exit(1);
screen = DefaultScreen(display);
win = XCreateSimpleWindow(display, RootWindow(display, screen), 10,
10, 100, 100, 0,
BlackPixel(display, screen),
WhitePixel(display, screen));
XMapWindow(display, win);
SetMax(display, win, 1);
SetMax(display, win, 0);
XSelectInput(display, win, KeyPressMask | StructureNotifyMask);
while (1) {
XNextEvent(display, &X);
}
XCloseDisplay(display);
return 0;
}
==============
and the patch I have applied
=======================
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -153,6 +153,9 @@ static void
static WMMsgNodePtr PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo);
+static Bool
+ HaveMessage(WMMsgQueuePtr pQueue, UINT msg, xcb_window_t iWindow);
+
static Bool
InitQueue(WMMsgQueuePtr pQueue);
@@ -319,7 +322,6 @@ PopMessage(WMMsgQueuePtr pQueue, WMInfoPtr pWMInfo)
return pNode;
}
-#if 0
/*
* HaveMessage -
*/
@@ -331,12 +333,11 @@ HaveMessage(WMMsgQueuePtr pQueue, UINT msg,
xcb_window_t iWindow)
for (pNode = pQueue->pHead; pNode != NULL; pNode = pNode->pNext) {
if (pNode->msg.msg == msg && pNode->msg.iWindow == iWindow)
- return True;
+ return TRUE;
}
- return False;
+ return FALSE;
}
-#endif
/*
* InitQueue - Initialize the Window Manager message queue
@@ -1173,7 +1174,9 @@ winMultiWindowWMProc(void *pArg)
break;
case WM_WM_CHANGE_STATE:
- UpdateState(pWMInfo, pNode->msg.iWindow, pNode->msg.dwID);
+ if(!HaveMessage(&pWMInfo->wmMsgQueue, pNode->msg.msg,
pNode->msg.iWindow))
+ UpdateState(pWMInfo, pNode->msg.iWindow, pNode->msg.dwID);
+
break;
default:
=======================
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
- Raw text -