This commit is contained in:
恍兮惚兮 2024-09-16 15:21:30 +08:00
parent c9f964b1bd
commit 96e41bd3b5
5 changed files with 1 additions and 75 deletions

View File

@ -1,11 +0,0 @@
from scalemethod.base import scalebase
from winsharedutils import letfullscreen, recoverwindow
class Method(scalebase):
def changestatus(self, hwnd, full):
if full:
self.savewindowstatus = letfullscreen(hwnd)
else:
recoverwindow(hwnd, self.savewindowstatus)
return True

View File

@ -1,13 +0,0 @@
from scalemethod.base import scalebase
import windows
class Method(scalebase):
def changestatus(self, hwnd, full):
windows.SetForegroundWindow(hwnd)
windows.keybd_event(18, 0, 0, 0) # alt
windows.keybd_event(13, 0, 0, 0) # enter
windows.keybd_event(13, 0, windows.KEYEVENTF_KEYUP, 0)
windows.keybd_event(18, 0, windows.KEYEVENTF_KEYUP, 0)
return True

View File

@ -7,7 +7,6 @@ from ctypes import (
pointer,
CDLL,
c_int,
Structure,
c_void_p,
cast,
memmove,
@ -15,14 +14,12 @@ from ctypes import (
create_string_buffer,
c_size_t,
windll,
c_float,
c_double,
c_char,
CFUNCTYPE,
c_long,
)
from ctypes.wintypes import WORD, HANDLE, HWND, LONG, DWORD, RECT
from windows import WINDOWPLACEMENT
from ctypes.wintypes import WORD, HWND, DWORD, RECT
import gobject
utilsdll = CDLL(gobject.GetDllpath(("winsharedutils32.dll", "winsharedutils64.dll")))
@ -258,17 +255,6 @@ showintab = utilsdll.showintab
showintab.argtypes = HWND, c_bool, c_bool
class windowstatus(Structure):
_fields_ = [("wpc", WINDOWPLACEMENT), ("HWNDStyle", LONG), ("HWNDStyleEx", LONG)]
letfullscreen = utilsdll.letfullscreen
letfullscreen.argtypes = (HWND,)
letfullscreen.restype = windowstatus
recoverwindow = utilsdll.recoverwindow
recoverwindow.argtypes = HWND, windowstatus
pid_running = utilsdll.pid_running
pid_running.argtypes = (DWORD,)
pid_running.restype = c_bool

View File

@ -1957,14 +1957,10 @@
},
"scalemethods": [
"magpie_builtin",
"alt_enter",
"SW_SHOWMAXIMIZED",
"external_magpie"
],
"scalemethods_vis": [
"Magpie",
"ALT+ENTER",
"SW_SHOWMAXIMIZED",
"Magpie_External"
],
"transoptimi": [

View File

@ -22,38 +22,6 @@ DECLARE void showintab(HWND hwnd, bool show, bool tool)
SetWindowLong(hwnd, GWL_EXSTYLE, style_ex);
}
struct windowstatus
{
WINDOWPLACEMENT wpc;
LONG HWNDStyle, HWNDStyleEx;
};
DECLARE windowstatus letfullscreen(HWND hwnd)
{
WINDOWPLACEMENT wpc;
GetWindowPlacement(hwnd, &wpc);
auto HWNDStyle = GetWindowLong(hwnd, GWL_STYLE);
auto HWNDStyleEx = GetWindowLong(hwnd, GWL_EXSTYLE);
auto NewHWNDStyle = HWNDStyle;
NewHWNDStyle &= ~WS_BORDER;
NewHWNDStyle &= ~WS_DLGFRAME;
NewHWNDStyle &= ~WS_THICKFRAME;
auto NewHWNDStyleEx = HWNDStyleEx;
NewHWNDStyleEx &= ~WS_EX_WINDOWEDGE;
SetWindowLong(hwnd, GWL_STYLE, NewHWNDStyle | WS_POPUP);
SetWindowLong(
hwnd, GWL_EXSTYLE, NewHWNDStyleEx | WS_EX_TOPMOST);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
return {wpc, HWNDStyle, HWNDStyleEx};
}
DECLARE void recoverwindow(HWND hwnd, windowstatus status)
{
SetWindowLong(hwnd, GWL_STYLE, status.HWNDStyle);
SetWindowLong(hwnd, GWL_EXSTYLE, status.HWNDStyleEx);
ShowWindow(hwnd, SW_SHOWNORMAL);
SetWindowPlacement(hwnd, &status.wpc);
}
DECLARE bool pid_running(DWORD pid)
{
DWORD code;