From ce649c02747e45208dedfed1ee7a329a24652ecd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 25 May 2020 19:54:15 +0200 Subject: nxagent: add names to some windows in DEBUG mode --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 12 +++++++ nx-X11/programs/Xserver/hw/nxagent/Screen.c | 51 ++++++++++++++++++++++++---- nx-X11/programs/Xserver/hw/nxagent/Window.c | 26 ++++++++++++++ 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 5ba3d5d12..9adc67a21 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1125,6 +1125,18 @@ void nxagentOpenConfineWindow(void) nxagentConfineWindow); } + #ifdef DEBUG + { + char *winname = NULL; + if (-1 != asprintf(&winname, "%s Confine", nxagentWindowName)) + { + Xutf8SetWMProperties(nxagentDisplay, nxagentConfineWindow, + winname, winname, NULL , 0 , NULL, NULL, NULL); + SAFE_free(winname); + } + } + #endif + #ifdef TEST fprintf(stderr, "%s: Created agent's confine window with id [0x%x].\n", __func__, nxagentConfineWindow); #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 52ecea854..e2ceede23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -466,9 +466,23 @@ Window nxagentCreateIconWindow(void) } } + char *winname = NULL; + #ifdef DEBUG + if (-1 == asprintf(&winname, "%s Icon", nxagentWindowName)) + { + /* If memory allocation wasn't possible, or some other error + occurs, these functions will return -1, and the contents of + winname are undefined. */ + winname = NULL; + } + #endif + Xutf8SetWMProperties(nxagentDisplay, w, - nxagentWindowName, nxagentWindowName, - NULL , 0 , sizeHints, wmHints, NULL); + winname ? winname : nxagentWindowName, + winname ? winname : nxagentWindowName, + NULL , 0 , sizeHints, wmHints, NULL); + + SAFE_free(winname); SAFE_XFree(sizeHints); SAFE_XFree(wmHints); @@ -1768,6 +1782,18 @@ N/A fprintf(stderr, "NXAGENT_WINDOW_ID: INPUT_WINDOW:[%d],WID:[0x%x]\n", pScreen->myNum, nxagentInputWindows[pScreen->myNum]); } + #ifdef DEBUG + { + char *winname = NULL; + if (-1 != asprintf(&winname, "%s Input", nxagentWindowName)) + { + Xutf8SetWMProperties(nxagentDisplay, nxagentInputWindows[pScreen->myNum], + winname, winname, NULL , 0 , NULL, NULL, NULL); + SAFE_free(winname); + } + } + #endif + #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Created new input window for screen [%d] with id [0x%x].\n", pScreen->myNum, nxagentInputWindows[pScreen->myNum]); @@ -1873,11 +1899,24 @@ N/A } } + char *winname = NULL; + #ifdef DEBUG + if (-1 == asprintf(&winname, "%s Default[%d]", nxagentWindowName, pScreen->myNum)) + { + /* If memory allocation wasn't possible, or some other error + occurs, these functions will return -1, and the contents of + winname are undefined. */ + winname = NULL; + } + #endif + Xutf8SetWMProperties(nxagentDisplay, - nxagentDefaultWindows[pScreen->myNum], - nxagentWindowName, - nxagentWindowName, - argv , argc , sizeHints, wmHints, NULL); + nxagentDefaultWindows[pScreen->myNum], + winname ? winname : nxagentWindowName, + winname ? winname : nxagentWindowName, + argv , argc , sizeHints, wmHints, NULL); + + SAFE_free(winname); SAFE_XFree(sizeHints); SAFE_XFree(wmHints); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 56ca30c4e..97c4700e4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -403,6 +403,19 @@ Bool nxagentCreateWindow(WindowPtr pWin) { fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id); } + + #ifdef DEBUG + { + char *winname = NULL; + if (-1 != asprintf(&winname, "%s Private[0x%lx]", nxagentWindowName, pWin->drawable.id)) + { + Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + winname, winname, NULL , 0 , NULL, NULL, NULL); + SAFE_free(winname); + } + } + #endif + #ifdef TEST fprintf(stderr, "nxagentCreateWindow: Created new window with id [0x%x].\n", nxagentWindowPriv(pWin)->window); @@ -2995,6 +3008,19 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer { fprintf(stderr, "NXAGENT_WINDOW_ID: PRIVATE_WINDOW,WID:[0x%x],INT:[0x%x]\n", nxagentWindowPriv(pWin)->window, pWin->drawable.id); } + + #ifdef DEBUG + { + char *winname = NULL; + if (-1 != asprintf(&winname, "%s Private[0x%lx]", nxagentWindowName, pWin->drawable.id)) + { + Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + winname, winname, NULL , 0 , NULL, NULL, NULL); + SAFE_free(winname); + } + } + #endif + #ifdef TEST fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n", nxagentWindowPriv(pWin)->window); -- cgit v1.2.3