Re: [hatari-users] hatariui

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-users Archives ]


Hi,

On 11/19/2017 08:08 PM, Vincent Rivière wrote:
On 18/11/2017 à 01:01, Eero Tamminen wrote:
Does that match any of the Hatari UI windows:

$ xwininfo
...
xwininfo: Window id: 0x2800003 "Hatari UI v1.3"
xwininfo: Window id: 0x2a00013 "Hatari v2.0.0"

$ xwininfo -name "Hatari UI v1.3" -tree

xwininfo: Window id: 0x2800003 "Hatari UI v1.3"

   Root window id: 0x260 (the root window) (has no name)
   Parent window id: 0x2000cd (has no name)
      2 children:
      0x2800042 (has no name): ()  832x588+0+23  +81+188
      0x2800004 (has no name): ()  1x1+-1+-1  +80+164

It doesn't seem to be the case.

But Hatari did have a PARENT_WIN_ID environment variable?

Was there any window that had a matching window ID:
	xwininfo -root -tree
?


If you like to investigate further, please install Artful
Aardvark in a virtual machine, as I did.

If there's no window matching the environment variable
value, it doesn't seem bug in SDL2 side (used by Hatari),
but in the Hatari UI Python/Gtk code.

Could you try attached patch, to see whether it changes
anything?

I.e. instead of digging the parent window ID out myself,
I now ask Gtk Socket widget for it:
https://developer.gnome.org/pygtk/stable/class-gtksocket.html#method-gtksocket--get-id


	- Eero
diff -r 6f5bb2fa5270 python-ui/hatari.py
--- a/python-ui/hatari.py	Sun Nov 19 00:02:27 2017 +0200
+++ b/python-ui/hatari.py	Mon Nov 20 00:16:13 2017 +0200
@@ -201,8 +201,8 @@
             return False
         return True
     
-    def run(self, extra_args = None, parent_win = None):
-        "run([parent window][,embedding args]), runs Hatari"
+    def run(self, extra_args = None, parent_id = None):
+        "run([embedding args][,parent window ID]), runs Hatari"
         # if parent_win given, embed Hatari to it
         pid = os.fork()
         if pid < 0:
@@ -218,8 +218,8 @@
         else:
             # child runs Hatari
             env = os.environ
-            if parent_win:
-                self._set_embed_env(env, parent_win)
+            if parent_id:
+                self._set_embed_env(env, parent_id)
             # callers need to take care of confirming quitting
             args = [self.hataribin, "--confirm-quit", "off"]
             if self.server:
@@ -229,11 +229,7 @@
             print("RUN:", args)
             os.execvpe(self.hataribin, args, env)
 
-    def _set_embed_env(self, env, parent_win):
-        if sys.platform == 'win32':
-            win_id = parent_win.handle
-        else:
-            win_id = parent_win.xid
+    def _set_embed_env(self, env, win_id):
         # tell SDL to use given widget's window
         #env["SDL_WINDOWID"] = str(win_id)
 
diff -r 6f5bb2fa5270 python-ui/hatariui.py
--- a/python-ui/hatariui.py	Sun Nov 19 00:02:27 2017 +0200
+++ b/python-ui/hatariui.py	Mon Nov 20 00:16:13 2017 +0200
@@ -191,7 +191,7 @@
             args += self.floppy
         if self.hatariwin:
             size = self.hatariwin.window.get_size()
-            self.hatari.run(args, self.hatariwin.window)
+            self.hatari.run(args, self.hatariwin.get_id())
             # get notifications of Hatari window size changes
             self.hatari.enable_embed_info()
             socket = self.hatari.get_control_socket().fileno()


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/