[X2Go-Commits] [x2gokdrive] 01/01: Focus handling
git-admin at x2go.org
git-admin at x2go.org
Thu Feb 3 17:06:54 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 abc35a56b319509f9c2d6e4573b1ab47d9b44b19
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date: Thu Feb 3 10:06:33 2022 -0600
Focus handling
---
x2gokdriveremote.c | 24 +++++++++++++++++++++++-
x2gokdriveremote.h | 1 +
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index e07f553..691ea70 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -37,6 +37,7 @@
#include "x2gokdriveremote.h"
#include "x2gokdriveselection.h"
#include "x2gokdrivelog.h"
+#include "inputstr.h"
#include <zlib.h>
#include <propertyst.h>
@@ -2588,6 +2589,8 @@ void client_win_change(char* buff)
int16_t ny=*((int16_t*)(buff+14));
uint16_t nw=*((int16_t*)(buff+16));
uint16_t nh=*((int16_t*)(buff+18));
+ uint8_t focus=*((int8_t*)(buff+20));
+
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);
@@ -2698,6 +2701,15 @@ void client_win_change(char* buff)
EPHYR_DBG("Client request to move : %p on top of %p",pWin, pSib);
ReflectStackChange(pWin, pSib, VTOther);
}
+ if(rw->hasFocus!=focus)
+ {
+ EPHYR_DBG("Focus changed for 0x%X",winId);
+ rw->hasFocus=focus;
+ if(focus)
+ {
+ SetInputFocus(wClient(pWin), inputInfo.keyboard, pWin->drawable.id, RevertToParent, CurrentTime, TRUE);
+ }
+ }
}
void set_client_version(uint16_t ver, uint16_t os)
@@ -3742,6 +3754,8 @@ void remote_check_window(WindowPtr win)
uint8_t winType=WINDOW_TYPE_NORMAL;
int16_t x,y;
uint16_t w,h,bw;
+ uint32_t focusWinId=0;
+ FocusClassPtr focus = inputInfo.keyboard->focus;
WindowPtr parPtr;
WindowPtr nextSibPtr, tmpPtr;
parPtr=win->parent;
@@ -3786,7 +3800,12 @@ void remote_check_window(WindowPtr win)
* if window is not in list, create and send to client. If not same, update and send to client
* if some list windows not there anymore, delete and send notification
*/
-
+ if (focus->win == NoneWin)
+ focusWinId = None;
+ else if (focus->win == PointerRootWin)
+ focusWinId = PointerRoot;
+ else
+ focusWinId = focus->win->drawable.id;
if(win->optional && win->optional->userProps)
{
PropertyPtr prop=win->optional->userProps;
@@ -3952,6 +3971,9 @@ void remote_check_window(WindowPtr win)
}
}
+ rwin->hasFocus=(win->drawable.id==focusWinId);
+
+
rwin->foundInWinTree=TRUE;
rwin->x=x;
rwin->y=y;
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index 0e6ecc9..8f463e2 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -366,6 +366,7 @@ struct remoteWindow
int16_t x,y;
uint16_t w,h,bw;
int8_t visibility;
+ int8_t hasFocus;
uint8_t winType;
char* name;
BOOL foundInWinTree;
--
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