diff options
Diffstat (limited to 'src/w32term.c')
-rw-r--r-- | src/w32term.c | 184 |
1 files changed, 65 insertions, 119 deletions
diff --git a/src/w32term.c b/src/w32term.c index 0ee805a8526..ad4d1a32829 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -1916,7 +1916,7 @@ w32_draw_image_foreground (struct glyph_string *s) /* HALFTONE produces better results, especially when scaling to a larger size, but Windows 9X doesn't support HALFTONE. */ - if (os_subtype == OS_NT + if (os_subtype == OS_SUBTYPE_NT && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) SetBrushOrgEx (s->hdc, 0, 0, NULL); StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, @@ -1952,7 +1952,7 @@ w32_draw_image_foreground (struct glyph_string *s) { int pmode = 0; /* Windows 9X doesn't support HALFTONE. */ - if (os_subtype == OS_NT + if (os_subtype == OS_SUBTYPE_NT && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0) SetBrushOrgEx (s->hdc, 0, 0, NULL); StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height, @@ -2031,8 +2031,11 @@ w32_draw_image_relief (struct glyph_string *s) if (s->hl == DRAW_IMAGE_SUNKEN || s->hl == DRAW_IMAGE_RAISED) { - thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief - : DEFAULT_TOOL_BAR_BUTTON_RELIEF; + thick = (tab_bar_button_relief < 0 + ? DEFAULT_TAB_BAR_BUTTON_RELIEF + : (tool_bar_button_relief < 0 + ? DEFAULT_TOOL_BAR_BUTTON_RELIEF + : min (tool_bar_button_relief, 1000000))); raised_p = s->hl == DRAW_IMAGE_RAISED; } else @@ -2045,6 +2048,19 @@ w32_draw_image_relief (struct glyph_string *s) y1 = y + s->slice.height - 1; extra_x = extra_y = 0; + if (s->face->id == TAB_BAR_FACE_ID) + { + if (CONSP (Vtab_bar_button_margin) + && FIXNUMP (XCAR (Vtab_bar_button_margin)) + && FIXNUMP (XCDR (Vtab_bar_button_margin))) + { + extra_x = XFIXNUM (XCAR (Vtab_bar_button_margin)); + extra_y = XFIXNUM (XCDR (Vtab_bar_button_margin)); + } + else if (FIXNUMP (Vtab_bar_button_margin)) + extra_x = extra_y = XFIXNUM (Vtab_bar_button_margin); + } + if (s->face->id == TOOL_BAR_FACE_ID) { if (CONSP (Vtool_bar_button_margin) @@ -5336,7 +5352,7 @@ w32_read_socket (struct terminal *terminal, if (f) { RECT rect; - int /* rows, columns, */ width, height, text_width, text_height; + int /* rows, columns, */ width, height; if (GetClientRect (msg.msg.hwnd, &rect) /* GetClientRect evidently returns (0, 0, 0, 0) if @@ -5349,23 +5365,11 @@ w32_read_socket (struct terminal *terminal, { height = rect.bottom - rect.top; width = rect.right - rect.left; - text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, width); - text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, height); - /* rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); */ - /* columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); */ - - /* TODO: Clip size to the screen dimensions. */ - - /* Even if the number of character rows and columns - has not changed, the font size may have changed, - so we need to check the pixel dimensions as well. */ - if (width != FRAME_PIXEL_WIDTH (f) - || height != FRAME_PIXEL_HEIGHT (f) - || text_width != FRAME_TEXT_WIDTH (f) - || text_height != FRAME_TEXT_HEIGHT (f)) + || height != FRAME_PIXEL_HEIGHT (f)) { - change_frame_size (f, text_width, text_height, 0, 1, 0, 1); + change_frame_size + (f, width, height, false, true, false); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); f->win_gravity = NorthWestGravity; @@ -5549,7 +5553,7 @@ w32_read_socket (struct terminal *terminal, if (f && !FRAME_ICONIFIED_P (f) && msg.msg.wParam != SIZE_MINIMIZED) { RECT rect; - int /* rows, columns, */ width, height, text_width, text_height; + int /* rows, columns, */ width, height; if (GetClientRect (msg.msg.hwnd, &rect) /* GetClientRect evidently returns (0, 0, 0, 0) if @@ -5562,23 +5566,12 @@ w32_read_socket (struct terminal *terminal, { height = rect.bottom - rect.top; width = rect.right - rect.left; - text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, width); - text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, height); - /* rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); */ - /* columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); */ - - /* TODO: Clip size to the screen dimensions. */ - - /* Even if the number of character rows and columns - has not changed, the font size may have changed, - so we need to check the pixel dimensions as well. */ if (width != FRAME_PIXEL_WIDTH (f) - || height != FRAME_PIXEL_HEIGHT (f) - || text_width != FRAME_TEXT_WIDTH (f) - || text_height != FRAME_TEXT_HEIGHT (f)) + || height != FRAME_PIXEL_HEIGHT (f)) { - change_frame_size (f, text_width, text_height, 0, 1, 0, 1); + change_frame_size + (f, width, height, false, true, false); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); f->win_gravity = NorthWestGravity; @@ -6251,17 +6244,15 @@ w32_new_font (struct frame *f, Lisp_Object font_object, int fontset) FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit; } - /* Now make the frame display the given font. */ - if (FRAME_NATIVE_WINDOW (f) != 0) - { - /* Don't change the size of a tip frame; there's no point in - doing it because it's done in Fx_show_tip, and it leads to - problems because the tip frame has no widget. */ - if (!FRAME_TOOLTIP_P (f)) - adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), - FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, - false, Qfont); - } + FRAME_TAB_BAR_HEIGHT (f) = FRAME_TAB_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); + +/* Don't change the size of a tip frame; there's no point in + doing it because it's done in Fx_show_tip, and it leads to + problems because the tip frame has no widget. */ + if (FRAME_NATIVE_WINDOW (f) != 0 && !FRAME_TOOLTIP_P (f)) + adjust_frame_size + (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), + FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, false, Qfont); /* X version sets font of input methods here also. */ @@ -6474,7 +6465,8 @@ w32fullscreen_hook (struct frame *f) ShowWindow (hwnd, SW_SHOWNORMAL); else if (f->want_fullscreen == FULLSCREEN_MAXIMIZED) { - if (prev_fsmode == FULLSCREEN_BOTH || prev_fsmode == FULLSCREEN_WIDTH + if (prev_fsmode == FULLSCREEN_BOTH + || prev_fsmode == FULLSCREEN_WIDTH || prev_fsmode == FULLSCREEN_HEIGHT) /* Make window normal since otherwise the subsequent maximization might fail in some cases. */ @@ -6483,52 +6475,31 @@ w32fullscreen_hook (struct frame *f) } else if (f->want_fullscreen == FULLSCREEN_BOTH) { - int menu_bar_height = GetSystemMetrics (SM_CYMENU); - - w32_fullscreen_rect (hwnd, f->want_fullscreen, - FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); + w32_fullscreen_rect + (hwnd, f->want_fullscreen, + FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); if (!FRAME_UNDECORATED (f)) SetWindowLong (hwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOOWNERZORDER | SWP_FRAMECHANGED); change_frame_size - (f, FRAME_PIXEL_TO_TEXT_WIDTH (f, rect.right - rect.left), - FRAME_PIXEL_TO_TEXT_HEIGHT (f, (rect.bottom - rect.top - - menu_bar_height)), - 0, 1, 0, 1); + (f, rect.right - rect.left, rect.bottom - rect.top, + false, true, false); } else { ShowWindow (hwnd, SW_SHOWNORMAL); - w32_fullscreen_rect (hwnd, f->want_fullscreen, - FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); + w32_fullscreen_rect + (hwnd, f->want_fullscreen, + FRAME_NORMAL_PLACEMENT (f).rcNormalPosition, &rect); SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 0); - if (f->want_fullscreen == FULLSCREEN_WIDTH) - { - int border_width = GetSystemMetrics (SM_CXFRAME); - - change_frame_size - (f, (FRAME_PIXEL_TO_TEXT_WIDTH - (f, rect.right - rect.left - 2 * border_width)), - 0, 0, 1, 0, 1); - } - else - { - int border_height = GetSystemMetrics (SM_CYFRAME); - /* Won't work for wrapped menu bar. */ - int menu_bar_height = GetSystemMetrics (SM_CYMENU); - int title_height = GetSystemMetrics (SM_CYCAPTION); - - change_frame_size - (f, 0, (FRAME_PIXEL_TO_TEXT_HEIGHT - (f, rect.bottom - rect.top - 2 * border_height - - title_height - menu_bar_height)), - 0, 1, 0, 1); - } - } + change_frame_size + (f, rect.right - rect.left, rect.bottom - rect.top, + false, true, false); + } f->want_fullscreen = FULLSCREEN_NONE; unblock_input (); @@ -6543,16 +6514,14 @@ w32fullscreen_hook (struct frame *f) f->want_fullscreen |= FULLSCREEN_WAIT; } -/* Call this to change the size of frame F's native window. - If CHANGE_GRAVITY, change to top-left-corner window gravity - for this size change and subsequent size changes. - Otherwise we leave the window gravity unchanged. */ - +/* Change the size of frame F's Windows window to WIDTH and HEIGHT + pixels. If CHANGE_GRAVITY, change to top-left-corner window gravity + for this size change and subsequent size changes. Otherwise leave + the window gravity unchanged. */ static void w32_set_window_size (struct frame *f, bool change_gravity, - int width, int height, bool pixelwise) + int width, int height) { - int pixelwidth, pixelheight; Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); RECT rect; MENUBARINFO info; @@ -6568,17 +6537,6 @@ w32_set_window_size (struct frame *f, bool change_gravity, GetMenuBarInfo (FRAME_W32_WINDOW (f), 0xFFFFFFFD, 0, &info); menu_bar_height = info.rcBar.bottom - info.rcBar.top; - if (pixelwise) - { - pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); - pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); - } - else - { - pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); - pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); - } - if (w32_add_wrapped_menu_bar_lines) { /* When the menu bar wraps sending a SetWindowPos shrinks the @@ -6594,15 +6552,15 @@ w32_set_window_size (struct frame *f, bool change_gravity, if ((default_menu_bar_height > 0) && (menu_bar_height > default_menu_bar_height) && ((menu_bar_height % default_menu_bar_height) == 0)) - pixelheight = pixelheight + menu_bar_height - default_menu_bar_height; + height = height + menu_bar_height - default_menu_bar_height; } f->win_gravity = NorthWestGravity; w32_wm_set_size_hint (f, (long) 0, false); rect.left = rect.top = 0; - rect.right = pixelwidth; - rect.bottom = pixelheight; + rect.right = width; + rect.bottom = height; AdjustWindowRect (&rect, f->output_data.w32->dwStyle, menu_bar_height > 0); @@ -6620,7 +6578,7 @@ w32_set_window_size (struct frame *f, bool change_gravity, { rect.left = window_rect.left; rect.right = window_rect.right; - pixelwidth = 0; + width = -1; } if (EQ (fullscreen, Qmaximized) || EQ (fullscreen, Qfullboth) @@ -6628,19 +6586,12 @@ w32_set_window_size (struct frame *f, bool change_gravity, { rect.top = window_rect.top; rect.bottom = window_rect.bottom; - pixelheight = 0; + height = -1; } } - if (pixelwidth > 0 || pixelheight > 0) + if (width > 0 || height > 0) { - frame_size_history_add - (f, Qx_set_window_size_1, width, height, - list2 (Fcons (make_fixnum (pixelwidth), - make_fixnum (pixelheight)), - Fcons (make_fixnum (rect.right - rect.left), - make_fixnum (rect.bottom - rect.top)))); - if (!FRAME_PARENT_FRAME (f)) my_set_window_pos (FRAME_W32_WINDOW (f), NULL, 0, 0, @@ -6654,12 +6605,7 @@ w32_set_window_size (struct frame *f, bool change_gravity, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOACTIVATE); - change_frame_size (f, - ((pixelwidth == 0) - ? 0 : FRAME_PIXEL_TO_TEXT_WIDTH (f, pixelwidth)), - ((pixelheight == 0) - ? 0 : FRAME_PIXEL_TO_TEXT_HEIGHT (f, pixelheight)), - 0, 1, 0, 1); + change_frame_size (f, width, height, false, true, false); SET_FRAME_GARBAGED (f); /* If cursor was outside the new size, mark it as off. */ @@ -6698,7 +6644,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) /* When "mouse trails" are in effect, moving the mouse cursor sometimes leaves behind an annoying "ghost" of the pointer. Avoid that by momentarily switching off mouse trails. */ - if (os_subtype == OS_NT + if (os_subtype == OS_SUBTYPE_NT && w32_major_version + w32_minor_version >= 6) ret = SystemParametersInfo (SPI_GETMOUSETRAILS, 0, &trail_num, 0); SetCursorPos (pt.x, pt.y); @@ -7692,7 +7638,7 @@ specified by `file-name-coding-system'. This variable is set to non-nil by default when Emacs runs on Windows systems of the NT family, including W2K, XP, Vista, Windows 7 and Windows 8. It is set to nil on Windows 9X. */); - if (os_subtype == OS_9X) + if (os_subtype == OS_SUBTYPE_9X) w32_unicode_filenames = 0; else w32_unicode_filenames = 1; |