summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-04-21 16:33:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-04-21 16:33:03 (GMT)
commit2488fdef685c9e8fbf79a3074ee4b0ff4b641311 (patch)
tree03919778bfee3f9ea146c905f6add344c234b949 /win
parentfa289415c7aaacc173ab97665af201a54eae611a (diff)
downloadtk-bug_c95d4691ff_mistake.zip
tk-bug_c95d4691ff_mistake.tar.gz
tk-bug_c95d4691ff_mistake.tar.bz2
Fixed [c95d4691ff] - winfo screenheight w/dual monitors returns the screen height of the primary displaybug_c95d4691ff_mistake
Diffstat (limited to 'win')
-rw-r--r--win/tkWinWm.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 4e7618d..4e8ff12 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -8680,6 +8680,100 @@ RemapWindows(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * GetMonitorRect
+ *
+ * Return the rectangle of the monitor on which the given window
+ * is displayed.
+ *
+ * Results:
+ * The display rectangle of the monitor, in virtual screen
+ * coordinates.
+ *
+ * Side effects:
+ * The passed window comes into existence if it was not already
+ * the case.
+ *
+ *----------------------------------------------------------------------
+ */
+
+RECT
+GetMonitorRect(
+ Tk_Window tkwin)
+{
+ HWND hWnd;
+ HMONITOR hMonitor;
+ MONITORINFO mi;
+
+ Tk_MakeWindowExist(tkwin);
+
+ /*
+ * Get monitor information for the monitor showing the window.
+ */
+
+ hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
+ hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY);
+
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfo(hMonitor, &mi);
+
+ return mi.rcMonitor;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpHeightOfScreen
+ *
+ * Return the height (in pixels) of the monitor on which the given
+ * window is displayed.
+ *
+ * Results:
+ * The pixel height of the monitor.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpHeightOfScreen(
+ Tk_Window tkwin)
+{
+ RECT rc = GetMonitorRect(tkwin);
+
+ return (rc.bottom - rc.top);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWidthOfScreen
+ *
+ * Return the width (in pixels) of the monitor on which the given
+ * window is displayed.
+ *
+ * Results:
+ * The pixel width of the monitor.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpWidthOfScreen(
+ Tk_Window tkwin)
+{
+ RECT rc = GetMonitorRect(tkwin);
+
+ return (rc.right - rc.left);
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4