applets: workaround 'garbage on sides of embedded windows' bug on Windows

This commit is contained in:
Sebastien Bourdeauducq 2016-02-21 21:32:21 +08:00
parent 129927490b
commit e3e42216a2

View File

@ -134,10 +134,15 @@ class SimpleApplet:
if self.args.embed is not None: if self.args.embed is not None:
self.ipc.set_close_cb(self.main_widget.close) self.ipc.set_close_cb(self.main_widget.close)
if os.name == "nt": if os.name == "nt":
# HACK: if the window has a frame, there will be garbage
# (usually white) displayed at its right and bottom borders
# after it is embedded.
self.main_widget.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.main_widget.show() self.main_widget.show()
win_id = int(self.main_widget.winId()) win_id = int(self.main_widget.winId())
self.loop.run_until_complete(self.ipc.embed(win_id)) self.loop.run_until_complete(self.ipc.embed(win_id))
else: else:
# HACK:
# Qt window embedding is ridiculously buggy, and empirical # Qt window embedding is ridiculously buggy, and empirical
# testing has shown that the following procedure must be # testing has shown that the following procedure must be
# followed exactly on Linux: # followed exactly on Linux: