static void enact_pending_netevent(void);
static void flash_window(int mode);
static void sys_cursor_update(void);
-static int is_shift_pressed(void);
static int get_fullscreen_rect(RECT * ss);
static int caret_x = -1, caret_y = -1;
guess_height = extra_height + font_height * cfg.height;
{
RECT r;
- get_fullscreen_rect(&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)
AppendMenu(savedsess_menu, MF_ENABLED,
IDM_SAVED_MIN + (i-1)*MENU_SAVED_STEP,
sesslist.sessions[i]);
+ if (sesslist.nsessions <= 1)
+ AppendMenu(savedsess_menu, MF_GRAYED, IDM_SAVED_MIN, "(No sessions)");
}
/*
#ifdef FIXME_REMOVE_BEFORE_CHECKIN
debug(("general_textout: done, xn=%d\n", xn));
#endif
- assert(xn - x == lprc->right - lprc->left);
+ assert(xn - x >= lprc->right - lprc->left);
}
/*
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;
void notify_remote_exit(void *fe)
{
/* Disable full-screen if resizing forbidden */
- HMENU m = GetSystemMenu (hwnd, FALSE);
- EnableMenuItem(m, IDM_FULLSCREEN, MF_BYCOMMAND |
- (cfg.resize_action == RESIZE_DISABLED)
- ? MF_GRAYED : MF_ENABLED);
+ int i;
+ for (i = 0; i < lenof(popup_menus); i++)
+ EnableMenuItem(popup_menus[i].menu, IDM_FULLSCREEN,
+ MF_BYCOMMAND |
+ (cfg.resize_action == RESIZE_DISABLED)
+ ? MF_GRAYED : MF_ENABLED);
/* Gracefully unzoom if necessary */
if (IsZoomed(hwnd) &&
(cfg.resize_action == RESIZE_DISABLED)) {
switch (message) {
case WM_LBUTTONDOWN:
button = MBT_LEFT;
+ wParam |= MK_LBUTTON;
press = 1;
break;
case WM_MBUTTONDOWN:
button = MBT_MIDDLE;
+ wParam |= MK_MBUTTON;
press = 1;
break;
case WM_RBUTTONDOWN:
button = MBT_RIGHT;
+ wParam |= MK_RBUTTON;
press = 1;
break;
case WM_LBUTTONUP:
button = MBT_LEFT;
+ wParam &= ~MK_LBUTTON;
press = 0;
break;
case WM_MBUTTONUP:
button = MBT_MIDDLE;
+ wParam &= ~MK_MBUTTON;
press = 0;
break;
case WM_RBUTTONUP:
button = MBT_RIGHT;
+ wParam &= ~MK_RBUTTON;
press = 0;
break;
default:
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
- ReleaseCapture();
+ if (!(wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)))
+ ReleaseCapture();
}
}
return 0;
cleanup_exit(1);
}
-typedef BOOL (WINAPI *p_FlashWindowEx_t)(PFLASHWINFO);
-static p_FlashWindowEx_t p_FlashWindowEx = NULL;
+DECL_WINDOWS_FUNCTION(static, BOOL, FlashWindowEx, (PFLASHWINFO));
static void init_flashwindow(void)
{
HMODULE user32_module = LoadLibrary("USER32.DLL");
- if (user32_module) {
- p_FlashWindowEx = (p_FlashWindowEx_t)
- GetProcAddress(user32_module, "FlashWindowEx");
- }
+ GET_WINDOWS_FUNCTION(user32_module, FlashWindowEx);
}
static BOOL flash_window_ex(DWORD dwFlags, UINT uCount, DWORD dwTimeout)
reset_window(0);
- /* Tick the menu item in the System menu. */
- CheckMenuItem(GetSystemMenu(hwnd, FALSE), IDM_FULLSCREEN,
- MF_CHECKED);
+ /* Tick the menu item in the System and context menus. */
+ {
+ int i;
+ for (i = 0; i < lenof(popup_menus); i++)
+ CheckMenuItem(popup_menus[i].menu, IDM_FULLSCREEN, MF_CHECKED);
+ }
}
/*
SWP_FRAMECHANGED);
}
- /* Untick the menu item in the System menu. */
- CheckMenuItem(GetSystemMenu(hwnd, FALSE), IDM_FULLSCREEN,
- MF_UNCHECKED);
+ /* Untick the menu item in the System and context menus. */
+ {
+ int i;
+ for (i = 0; i < lenof(popup_menus); i++)
+ CheckMenuItem(popup_menus[i].menu, IDM_FULLSCREEN, MF_UNCHECKED);
+ }
}
/*