Skip to content

Commit

Permalink
Let win32gui have GetWindowRgnBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Mar 19, 2024
1 parent 4b686b0 commit 347da4c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ disable_error_code = attr-defined, method-assign, name-defined
exclude = .*((build|adodbapi|Pythonwin/Scintilla|Pythonwin/pywin/idle|[Tt]est|[Dd]emos?)/.*|rasutil.py|setup.py)

; C-modules that will need type-stubs
[mypy-adsi.*,dde,exchange,exchdapi,perfmon,servicemanager,win32api,win32clipboard,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,wincerapi,_win32sysloader,_winxptheme]
[mypy-adsi.*,dde,exchange,exchdapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,wincerapi,_win32sysloader,_winxptheme]
ignore_missing_imports = True

; verstamp is installed from win32verstamp.py called in setup.py
Expand Down
6 changes: 6 additions & 0 deletions win32/src/win32gui.i
Original file line number Diff line number Diff line change
Expand Up @@ -5659,6 +5659,12 @@ BOOLAPI SetWindowRgn(
HRGN INPUT_NULLOK, // @pyparm <o PyGdiHANDLE>|hRgn||Handle to region to be set, can be None
BOOL Redraw); // @pyparm boolean|Redraw||Indicates if window should be completely redrawn

// @pyswig int, <o PyRECT>|GetWindowRgnBox|Returns the bounding box for a window's region
// @rdesc Returns type of region and rectangle coordinates in device units
int_regiontype GetWindowRgnBox(
HWND hWnd, // @pyparm <o PyHANDLE>|hWnd||Handle to a window that has a window region. (see <om win32gui.SetWindowRgn>)
RECT *OUTPUT);

// @pyswig |ValidateRgn|Removes a region from a window's update region
BOOLAPI ValidateRgn(
HWND hWnd, // @pyparm <o PyHANDLE>|hWnd||Handle to the window
Expand Down
11 changes: 4 additions & 7 deletions win32/winxpgui.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from __future__ import annotations

import warnings

from win32console import GetConsoleWindow as GetConsoleWindow
from win32gui import *

REGION_BOX = [0, (0, 0, 0, 0)]

warnings.warn(
"The `winxpgui` gui is deprecated and simply re-exports `win32gui.*`, `win32console.GetConsoleWindow`, "
+ f"and `GetWindowRgnBox` is now hardcoded to return `{REGION_BOX}`.",
"The `winxpgui` module is obsolete and has been completely replaced "
"by `win32gui` and `win32console.GetConsoleWindow`. Use those instead.",
category=DeprecationWarning,
)
def GetWindowRgnBox(__):
print(f"`GetWindowRgnBox` is no longer supported and will always return `{REGION_BOX}`.")
return REGION_BOX

0 comments on commit 347da4c

Please sign in to comment.