[Avidemux-svn-commit] r3441 - in branches/avidemux_2.4_branch/avidemux: ADM_osSupport ADM_userInterfaces/ADM_GTK/ADM_toolkit_gtk
gruntster at mail.berlios.de
gruntster at mail.berlios.de
Tue Jul 24 02:42:55 CEST 2007
Author: gruntster
Date: 2007-07-24 02:42:36 +0200 (Tue, 24 Jul 2007)
New Revision: 3441
Modified:
branches/avidemux_2.4_branch/avidemux/ADM_osSupport/ADM_misc.h
branches/avidemux_2.4_branch/avidemux/ADM_osSupport/win32.cpp
branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_GTK/ADM_toolkit_gtk/toolkit.cpp
Log:
[Win32] resize GTK dialogs based on working area rather than screen resolution + multi-monitor support
Modified: branches/avidemux_2.4_branch/avidemux/ADM_osSupport/ADM_misc.h
===================================================================
--- branches/avidemux_2.4_branch/avidemux/ADM_osSupport/ADM_misc.h 2007-07-23 19:26:54 UTC (rev 3440)
+++ branches/avidemux_2.4_branch/avidemux/ADM_osSupport/ADM_misc.h 2007-07-24 00:42:36 UTC (rev 3441)
@@ -85,6 +85,7 @@
#define SHTDN_REASON_FLAG_PLANNED 0x80000000
int shutdown_win32(void);
+ void getWorkingArea(uint32_t *width, uint32_t *height);
#else
#include <sys/resource.h>
#endif
Modified: branches/avidemux_2.4_branch/avidemux/ADM_osSupport/win32.cpp
===================================================================
--- branches/avidemux_2.4_branch/avidemux/ADM_osSupport/win32.cpp 2007-07-23 19:26:54 UTC (rev 3440)
+++ branches/avidemux_2.4_branch/avidemux/ADM_osSupport/win32.cpp 2007-07-24 00:42:36 UTC (rev 3441)
@@ -1,18 +1,17 @@
#include "config.h"
+
+#ifdef ADM_WIN32
+#define WIN32_CLASH
#include <stdio.h>
#include <stdlib.h>
-#include <math.h>
+
#include "default.h"
#include "ADM_misc.h"
-
-
-#ifdef ADM_WIN32
#include "windows.h"
-#include "winbase.h"
#include "io.h"
#include "winsock2.h"
-#define WIN32_CLASH
#include "ADM_assert.h"
+
uint8_t win32_netInit(void);
void ADM_usleep(unsigned long us)
@@ -424,5 +423,39 @@
return true;
}
+#define MONITOR_DEFAULTTONEAREST 0x00000002
+
+void getWorkingArea(uint32_t *width, uint32_t *height)
+{
+ typedef void* (WINAPI *MonitorFromWindow)(HWND hwnd, uint32_t dwFlags);
+ typedef bool (WINAPI *GetMonitorInfo)(void *hMonitor, LPMONITORINFO lpmi);
+
+ static HMODULE user32 = GetModuleHandle("user32.dll");
+ static MonitorFromWindow pMonitorFromWindow = (MonitorFromWindow)GetProcAddress(user32, "MonitorFromWindow");
+ static GetMonitorInfo pGetMonitorInfo = (GetMonitorInfo)GetProcAddress(user32, "GetMonitorInfoA");
+
+ if (pMonitorFromWindow == NULL)
+ {
+ RECT rect;
+
+ // Required for NT4 - no multi-monitor support
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0);
+
+ *width = rect.right - rect.left;
+ *height = rect.bottom - rect.top;
+ }
+ else
+ {
+ void *hMonitor = pMonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTONEAREST);
+
+ MONITORINFO monitorInfo;
+
+ monitorInfo.cbSize = sizeof(MONITORINFO);
+ pGetMonitorInfo(hMonitor, &monitorInfo);
+
+ *width = monitorInfo.rcWork.right - monitorInfo.rcWork.left;
+ *height = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top;
+ }
+}
#endif
Modified: branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_GTK/ADM_toolkit_gtk/toolkit.cpp
===================================================================
--- branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_GTK/ADM_toolkit_gtk/toolkit.cpp 2007-07-23 19:26:54 UTC (rev 3440)
+++ branches/avidemux_2.4_branch/avidemux/ADM_userInterfaces/ADM_GTK/ADM_toolkit_gtk/toolkit.cpp 2007-07-24 00:42:36 UTC (rev 3441)
@@ -20,14 +20,11 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
-#include <time.h>
-#include <math.h>
+#include <gtk/gtk.h>
+
#ifndef ADM_WIN32
#include <unistd.h>
#endif
-#include <gtk/gtk.h>
-#include <ctype.h>
-#include <sys/time.h>
#include "avi_vars.h"
#include "ADM_misc.h"
@@ -195,6 +192,9 @@
*/
uint8_t UI_getPhysicalScreenSize(uint32_t *w, uint32_t *h)
{
+#ifdef ADM_WIN32
+ getWorkingArea(w, h);
+#else
static int inited = 0;
static int ww,hh;
@@ -208,7 +208,8 @@
*w=ww;
*h=hh;
+#endif
- return 1;
+ return 1;
}
//EOF
More information about the Avidemux-svn-commit
mailing list