[X2Go-Commits] [x2gokdrive] 01/01: set initial geometry form the -geometry command line option.

git-admin at x2go.org git-admin at x2go.org
Fri Jul 29 20:16:32 CEST 2022


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gokdrive.

commit dc303b2596a114c6721984a792d9594f6f33824f
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Fri Jul 29 13:16:23 2022 -0500

    set initial geometry form the -geometry command line option.
---
 debian/changelog   |  1 +
 x2gokdriveinit.c   |  5 +++--
 x2gokdriveremote.c | 22 ++++++++++++++++++++++
 x2gokdriveremote.h |  3 +++
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d2eacde..7d5feb2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,7 @@ x2gokdrive (0.0.0.1-0x2go1) UNRELEASED; urgency=medium
     - improve icon handling in rootless mode.
     - don't show invisible windows.
     - sending KEYRELEASE immediately after KEYPRESS to avoid the "key sticking".
+    - set initial geometry form the -geometry command line option.
 
   [ Mihai Moldovan ]
   * Initial release:
diff --git a/x2gokdriveinit.c b/x2gokdriveinit.c
index 7a4bbfa..e66c4ac 100644
--- a/x2gokdriveinit.c
+++ b/x2gokdriveinit.c
@@ -239,6 +239,7 @@ ddxProcessArgument(int argc, char **argv, int i)
         if ((i + 1) < argc)
         {
             /* compat with nxagent */
+            remote_set_init_geometry(argv[i+1]);
             return 2;
         }
 
@@ -348,14 +349,14 @@ OsVendorInit(void)
 
 //       }
 
+    remote_init();
 #if XORG_VERSION_CURRENT < 11999901
     KdOsInit(&EphyrOsFuncs);
 #endif
     if (serverGeneration == 1) {
         if (!KdCardInfoLast()) {
-            processScreenArg("800x600", NULL);
+            processScreenArg(remote_get_init_geometry(), NULL);
         }
-        remote_init();
     }
 }
 
diff --git a/x2gokdriveremote.c b/x2gokdriveremote.c
index f9bd628..7726648 100644
--- a/x2gokdriveremote.c
+++ b/x2gokdriveremote.c
@@ -3284,6 +3284,7 @@ int
 remote_init(void)
 {
 
+    EPHYR_DBG("Setting initial arguments");
     char* displayVar = NULL;
 
     /*init it in OsInit*/
@@ -3296,6 +3297,11 @@ remote_init(void)
     remoteVars.jpegQuality=JPG_QUALITY;
     remoteVars.compression=DEFAULT_COMPRESSION;
     remoteVars.selstruct.selectionMode = CLIP_BOTH;
+    if(!strlen(remote_get_init_geometry()))
+    {
+        EPHYR_DBG("Setting initial geometry to \"800x600\"");
+        remote_set_init_geometry("800x600");
+    }
 
     pthread_mutex_init(&remoteVars.mainimg_mutex, NULL);
     pthread_mutex_init(&remoteVars.sendqueue_mutex,NULL);
@@ -4525,6 +4531,22 @@ uint32_t calculate_crc(uint32_t width, uint32_t height, int32_t dx, int32_t dy)
     return crc;
 }
 
+const char* remote_get_init_geometry()
+{
+    return remoteVars.initGeometry;
+}
+
+void remote_set_init_geometry(char* geometry)
+{
+    if(strlen(geometry)>128)
+    {
+        EPHYR_DBG("INIT Geometry %s is too long, we'll ignore it", geometry);
+        return;
+    }
+    strncpy(remoteVars.initGeometry,geometry,strlen(geometry));
+}
+
+
 void remote_set_display_name(const char* name)
 {
     int max_len=256;
diff --git a/x2gokdriveremote.h b/x2gokdriveremote.h
index dccea67..c10e86c 100644
--- a/x2gokdriveremote.h
+++ b/x2gokdriveremote.h
@@ -393,6 +393,7 @@ struct _remoteHostVars
     char acceptAddr[256];
     char cookie[33];
     char displayName[256];
+    char initGeometry[128];
     int listenPort;
     int jpegQuality;
     uint32_t framenum;
@@ -555,6 +556,8 @@ remote_paint_rect(KdScreenInfo *screen,
 void request_selection_from_client(enum SelectionType selection);
 void rebuild_caches(void);
 void remote_set_rootless(void);
+void remote_set_init_geometry(char* geometry);
+const char*  remote_get_init_geometry();
 void remote_check_windowstree(WindowPtr root);
 void remote_check_window(WindowPtr win);
 struct remoteWindow* remote_find_window(WindowPtr win);

--
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