|
1 | 1 | import logging
|
2 | 2 | import argparse
|
3 | 3 | import asyncio
|
| 4 | +import os |
4 | 5 |
|
5 | 6 | from quamash import QEventLoop, QtWidgets, QtGui, QtCore
|
6 | 7 |
|
@@ -130,19 +131,26 @@ def ipc_close(self):
|
130 | 131 |
|
131 | 132 | def create_main_widget(self):
|
132 | 133 | self.main_widget = self.main_widget_class(self.args)
|
133 |
| - # Qt window embedding is ridiculously buggy, and empirical testing |
134 |
| - # has shown that the following procedure must be followed exactly: |
135 |
| - # 1. applet creates widget |
136 |
| - # 2. applet creates native window without showing it, and get its ID |
137 |
| - # 3. applet sends the ID to host, host embeds the widget |
138 |
| - # 4. applet shows the widget |
139 |
| - # 5. parent resizes the widget |
140 | 134 | if self.args.embed is not None:
|
141 | 135 | self.ipc.set_close_cb(self.main_widget.close)
|
142 |
| - win_id = int(self.main_widget.winId()) |
143 |
| - self.loop.run_until_complete(self.ipc.embed(win_id)) |
144 |
| - self.main_widget.show() |
145 |
| - self.ipc.fix_initial_size() |
| 136 | + if os.name == "nt": |
| 137 | + self.main_widget.show() |
| 138 | + win_id = int(self.main_widget.winId()) |
| 139 | + self.loop.run_until_complete(self.ipc.embed(win_id)) |
| 140 | + else: |
| 141 | + # Qt window embedding is ridiculously buggy, and empirical |
| 142 | + # testing has shown that the following procedure must be |
| 143 | + # followed exactly on Linux: |
| 144 | + # 1. applet creates widget |
| 145 | + # 2. applet creates native window without showing it, and |
| 146 | + # gets its ID |
| 147 | + # 3. applet sends the ID to host, host embeds the widget |
| 148 | + # 4. applet shows the widget |
| 149 | + # 5. parent resizes the widget |
| 150 | + win_id = int(self.main_widget.winId()) |
| 151 | + self.loop.run_until_complete(self.ipc.embed(win_id)) |
| 152 | + self.main_widget.show() |
| 153 | + self.ipc.fix_initial_size() |
146 | 154 | else:
|
147 | 155 | self.main_widget.show()
|
148 | 156 |
|
|
0 commit comments