[X2Go-Commits] [x2gokdrive] 01/01: Handling minimizing windows.
git-admin at x2go.org
git-admin at x2go.org
Wed Feb 9 22:08:51 CET 2022
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch feature/rootless-mode
in repository x2gokdrive.
commit cd6bb1d38399f84642ac620855d5e38a06c9a580
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Wed Feb 9 15:08:25 2022 -0600
Handling minimizing windows.
---
x2gokdriveremote.c | 54 ++++++++++++++++++++++++++++++++++++++++++++----------
x2gokdriveremote.h | 7 +++++--
2 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index 59d18db..58b262b 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -2586,11 +2586,6 @@ clientReadNotify(int fd, int ready, void *data)
client_win_change(buff);
break;
}
- case WINCLOSE:
- {
- client_win_close(buff);
- break;
- }
default:
{
EPHYR_DBG("UNSUPPORTED EVENT: %d",event_type);
@@ -2652,12 +2647,11 @@ ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)
WindowsRestructured();
}
-void client_win_close(char* buff)
+void client_win_close(uint32_t winId)
{
WindowPtr pWin;
- uint32_t winId=*((uint32_t*)(buff+4));
xEvent e;
-// EPHYR_DBG("Client request win close: 0x%x",winId);
+ // EPHYR_DBG("Client request win close: 0x%x",winId);
pWin=remote_find_window_on_screen_by_id(winId, remoteVars.ephyrScreen->pScreen->root);
if(!pWin)
{
@@ -2676,6 +2670,29 @@ void client_win_close(char* buff)
DeliverEvents(pWin, &e, 1, NullWindow);
}
+void client_win_iconify(uint32_t winId)
+{
+ WindowPtr pWin;
+ xEvent e;
+ EPHYR_DBG("Client request win iconify: 0x%x",winId);
+ pWin=remote_find_window_on_screen_by_id(winId, remoteVars.ephyrScreen->pScreen->root);
+ if(!pWin)
+ {
+ EPHYR_DBG("Window with ID 0x%X not found on current screen",winId);
+ return;
+ }
+ e.u.u.type = ClientMessage;
+ e.u.u.detail = 32;
+ e.u.clientMessage.window = winId;
+ e.u.clientMessage.u.l.type = MakeAtom("WM_CHANGE_STATE",strlen("WM_CHANGE_STATE"),FALSE);
+ e.u.clientMessage.u.l.longs0 = 3;//iconicState
+ e.u.clientMessage.u.l.longs1 = 0;
+ e.u.clientMessage.u.l.longs2 = 0;
+ e.u.clientMessage.u.l.longs3 = 0;
+ e.u.clientMessage.u.l.longs4 = 0;
+ DeliverEvents(pWin->parent, &e, 1, NullWindow);
+}
+
void client_win_change(char* buff)
{
@@ -2690,8 +2707,9 @@ void client_win_change(char* buff)
uint16_t nw=*((int16_t*)(buff+16));
uint16_t nh=*((int16_t*)(buff+18));
uint8_t focus=*((int8_t*)(buff+20));
-
+ uint8_t newstate=*((int8_t*)(buff+21));
BOOL move=FALSE, resize=FALSE, restack=FALSE;
+
// EPHYR_DBG("Client request win change: %p %d:%d %dx%d",fptr, nx,ny,nw,nh);
pWin=remote_find_window_on_screen_by_id(winId, remoteVars.ephyrScreen->pScreen->root);
if(!pWin)
@@ -2700,6 +2718,18 @@ void client_win_change(char* buff)
return;
}
+ if(newstate==WIN_DELETED)
+ {
+ client_win_close(winId);
+ return;
+ }
+ if(newstate==WIN_ICONIFIED)
+ {
+ client_win_iconify(winId);
+ ReflectStackChange(pWin, 0, VTOther);
+ return;
+ }
+
pParent = pWin->parent;
pSib=0;
if(newSibId)
@@ -4014,7 +4044,11 @@ void remote_check_window(WindowPtr win)
}
}
}
-/* if(prop->propertyName==MakeAtom("WM_NAME", strlen("WM_NAME"),FALSE) && prop->data)
+ if(prop->propertyName==MakeAtom("WM_STATE", strlen("WM_STATE"),FALSE) && prop->data)
+ {
+ EPHYR_DBG("-- WM_STATE: %d",*((uint32_t*)(prop->data)));
+ }
+ /* if(prop->propertyName==MakeAtom("WM_NAME", strlen("WM_NAME"),FALSE) && prop->data)
{
// EPHYR_DBG("-- Name: %s",(char*)prop->data);
}
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index 6e07a67..eb67378 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -133,6 +133,9 @@ enum WinType{WINDOW_TYPE_DESKTOP, WINDOW_TYPE_DOCK, WINDOW_TYPE_TOOLBAR, WINDOW_
WINDOW_TYPE_DIALOG, WINDOW_TYPE_DROPDOWN_MENU, WINDOW_TYPE_POPUP_MENU, WINDOW_TYPE_TOOLTIP, WINDOW_TYPE_NOTIFICATION,
WINDOW_TYPE_COMBO, WINDOW_TYPE_DND, WINDOW_TYPE_NORMAL};
+//new state requested by WINCHANGE event
+enum WinState{WIN_UNCHANGED, WIN_DELETED, WIN_ICONIFIED};
+
//Size of 1 window update (new or changed window) = 4xwinId + type of update + 7 coordinates + visibility + type of window + size of name buffer + icon_size
#define WINUPDSIZE 4*sizeof(uint32_t) + sizeof(int8_t) + 7*sizeof(int16_t) + sizeof(int8_t) + sizeof(int8_t) + sizeof(int16_t) + sizeof(int32_t)
//Size of 1 window update (deleted window) = winId + type of update
@@ -163,7 +166,6 @@ enum WinType{WINDOW_TYPE_DESKTOP, WINDOW_TYPE_DOCK, WINDOW_TYPE_TOOLBAR, WINDOW_
#define KEEPALIVE 12
#define CACHEREBUILD 13
#define WINCHANGE 14
-#define WINCLOSE 15
#define EVLENGTH 41
@@ -558,7 +560,8 @@ WindowPtr remote_find_window_on_screen_by_id(uint32_t winId, WindowPtr root);
void remote_process_window_updates(void);
void send_reinit_notification(void);
void client_win_change(char* buff);
-void client_win_close(char* buff);
+void client_win_close(uint32_t winId);
+void client_win_iconify(uint32_t winId);
void remote_check_rootless_windows_for_updates(KdScreenInfo *screen);
#endif /* X2GOKDRIVE_REMOTE_H */
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gokdrive.git
More information about the x2go-commits
mailing list