static void enact_pending_netevent(void);
static void flash_window(int mode);
static void sys_cursor_update(void);
+static int get_fullscreen_rect(RECT * ss);
static time_t last_movement = 0;
guess_height = extra_height + font_height * rows;
{
RECT r;
- HWND w = GetDesktopWindow();
- GetWindowRect(w, &r);
+ get_fullscreen_rect(&r);
if (guess_width > r.right - r.left)
guess_width = r.right - r.left;
if (guess_height > r.bottom - r.top)
timer_id = 0;
}
HideCaret(hwnd);
- if (GetCapture() != hwnd)
+ if (GetCapture() != hwnd ||
+ (send_raw_mouse && !(cfg.mouse_override && is_shift_pressed())))
term_out();
term_update();
ShowCaret(hwnd);
switch (first_time) {
case 1:
/* Get the size of the screen */
- if (GetClientRect(GetDesktopWindow(), &ss))
+ if (get_fullscreen_rect(&ss))
/* first_time = 0 */ ;
else {
first_time = 2;
static RECT ss;
int width, height;
+
+ get_fullscreen_rect(&ss);
- GetClientRect(GetDesktopWindow(), &ss);
width = (ss.right - ss.left - extra_width) / font_width;
height = (ss.bottom - ss.top - extra_height) / font_height;
return FALSE;
}
+static int is_shift_pressed(void)
+{
+ BYTE keystate[256];
+ int r = GetKeyboardState(keystate);
+ if (!r)
+ return FALSE;
+ if (keystate[VK_SHIFT] & 0x80)
+ return TRUE;
+ return FALSE;
+}
+
static int resizing;
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
case WM_TIMER:
if (pending_netevent)
enact_pending_netevent();
- if (GetCapture() != hwnd)
+ if (GetCapture() != hwnd ||
+ (send_raw_mouse && !(cfg.mouse_override && is_shift_pressed())))
term_out();
noise_regular();
HideCaret(hwnd);
if (wParam == SIZE_RESTORED)
clear_full_screen();
if (wParam == SIZE_MAXIMIZED && fullscr_on_max) {
- make_full_screen();
fullscr_on_max = FALSE;
+ make_full_screen();
}
if (cfg.resize_action == RESIZE_DISABLED) {
return TRUE;
}
+/* Get the rect/size of a full screen window using the nearest available
+ * monitor in multimon systems; default to something sensible if only
+ * one monitor is present. */
+static int get_fullscreen_rect(RECT * ss)
+{
+#ifdef MONITOR_DEFAULTTONEAREST
+ HMONITOR mon;
+ MONITORINFO mi;
+ mon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfo(mon, &mi);
+
+ /* structure copy */
+ *ss = mi.rcMonitor;
+ return TRUE;
+#else
+/* could also use code like this:
+ ss->left = ss->top = 0;
+ ss->right = GetSystemMetrics(SM_CXSCREEN);
+ ss->bottom = GetSystemMetrics(SM_CYSCREEN);
+*/
+ return GetClientRect(GetDesktopWindow(), ss);
+#endif
+}
+
+
/*
* Go full-screen. This should only be called when we are already
* maximised.
void make_full_screen()
{
DWORD style;
- int x, y, w, h;
+ RECT ss;
assert(IsZoomed(hwnd));
+ if (is_full_screen())
+ return;
+
/* Remove the window furniture. */
style = GetWindowLong(hwnd, GWL_STYLE);
style &= ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME);
SetWindowLong(hwnd, GWL_STYLE, style);
/* Resize ourselves to exactly cover the nearest monitor. */
-#ifdef MONITOR_DEFAULTTONEAREST
- {
- HMONITOR mon;
- MONITORINFO mi;
- mon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(mon, &mi);
- x = mi.rcMonitor.left;
- y = mi.rcMonitor.top;
- w = mi.rcMonitor.right;
- h = mi.rcMonitor.bottom;
- }
-#else
- x = y = 0;
- w = GetSystemMetrics(SM_CXSCREEN);
- h = GetSystemMetrics(SM_CYSCREEN);
-#endif
- SetWindowPos(hwnd, HWND_TOP, x, y, w, h, SWP_FRAMECHANGED);
+ get_fullscreen_rect(&ss);
+ SetWindowPos(hwnd, HWND_TOP, ss.left, ss.top,
+ ss.right - ss.left,
+ ss.bottom - ss.top,
+ SWP_FRAMECHANGED);
/* Tick the menu item in the System menu. */
CheckMenuItem(GetSystemMenu(hwnd, FALSE), IDM_FULLSCREEN,