This commit is contained in:
恍兮惚兮 2024-08-02 18:17:49 +08:00
parent 9fce9e0060
commit 99d32ad415
4 changed files with 22 additions and 4 deletions

View File

@ -1069,7 +1069,7 @@ class MAINUI:
except: except:
return return
if widget == self.translation_ui: if widget == self.translation_ui:
winsharedutils.showintab(int(widget.winId()), globalconfig["showintab"]) winsharedutils.showintab_ex(int(widget.winId()), globalconfig["showintab"])
return return
window_flags = widget.windowFlags() window_flags = widget.windowFlags()
if ( if (
@ -1190,7 +1190,7 @@ class MAINUI:
self.parsedefaultfont() self.parsedefaultfont()
self.loadmetadatas() self.loadmetadatas()
self.translation_ui = QUnFrameWindow() self.translation_ui = QUnFrameWindow()
winsharedutils.showintab( winsharedutils.showintab_ex(
int(self.translation_ui.winId()), globalconfig["showintab"] int(self.translation_ui.winId()), globalconfig["showintab"]
) )
self.translation_ui.show() self.translation_ui.show()

View File

@ -621,8 +621,7 @@ class QUnFrameWindow(resizableframeless):
super(QUnFrameWindow, self).__init__( super(QUnFrameWindow, self).__init__(
None, None,
flags=Qt.WindowType.FramelessWindowHint flags=Qt.WindowType.FramelessWindowHint
| Qt.WindowType.WindowMinimizeButtonHint | Qt.WindowType.WindowMinimizeButtonHint,
| Qt.WindowType.Tool,
poslist=globalconfig["transuigeo"], poslist=globalconfig["transuigeo"],
) # 设置为顶级窗口,无边框 ) # 设置为顶级窗口,无边框
icon = getExeIcon(sys.argv[0]) #'./LunaTranslator.exe')# QIcon() icon = getExeIcon(sys.argv[0]) #'./LunaTranslator.exe')# QIcon()

View File

@ -252,6 +252,8 @@ def SetTheme(hwnd, dark, backdrop):
showintab = utilsdll.showintab showintab = utilsdll.showintab
showintab.argtypes = HWND, c_bool showintab.argtypes = HWND, c_bool
showintab_ex = utilsdll.showintab_ex
showintab_ex.argtypes = HWND, c_bool
class windowstatus(Structure): class windowstatus(Structure):

View File

@ -20,6 +20,23 @@ DECLARE void showintab(HWND hwnd, bool show)
SetWindowLong(hwnd, GWL_EXSTYLE, style_ex); SetWindowLong(hwnd, GWL_EXSTYLE, style_ex);
} }
DECLARE void showintab_ex(HWND hwnd, bool show)
{
LONG style = GetWindowLong(hwnd, GWL_STYLE);
auto style_ex = GetWindowLong(hwnd, GWL_EXSTYLE);
if (show)
{
style_ex |= WS_EX_APPWINDOW;
style_ex &= ~WS_EX_TOOLWINDOW;
}
else
{
style_ex &= ~WS_EX_APPWINDOW;
style_ex |= WS_EX_TOOLWINDOW;
}
SetWindowLong(hwnd, GWL_EXSTYLE, style_ex);
}
struct windowstatus struct windowstatus
{ {
WINDOWPLACEMENT wpc; WINDOWPLACEMENT wpc;