X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/c1bb5ba7e161411850f704e5a2fcdc39d098948b..4d71d2471aaf341791fd728287bf8db62aebb3ba:/src/w32term.c diff --git a/src/w32term.c b/src/w32term.c index d415b13f71..f764e250aa 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -24,37 +24,27 @@ along with GNU Emacs. If not, see . */ #include "blockinput.h" #include "w32term.h" -#include "systty.h" -#include "systime.h" - #include #include #include +#ifdef CYGWIN +#include /* for O_RDWR */ +#endif #include -#include "charset.h" -#include "character.h" #include "coding.h" -#include "ccl.h" #include "frame.h" -#include "dispextern.h" #include "fontset.h" #include "termhooks.h" #include "termopts.h" #include "termchar.h" -#include "disptab.h" #include "buffer.h" #include "window.h" #include "keyboard.h" -#include "intervals.h" -#include "process.h" -#include "atimer.h" -#include "keymap.h" -#include "menu.h" +#include "menu.h" /* for w32_menu_show */ #ifdef WINDOWSNT #include "w32.h" /* for filename_from_utf16, filename_from_ansi */ -#include "w32heap.h" #endif #ifndef WINDOWSNT @@ -65,6 +55,10 @@ along with GNU Emacs. If not, see . */ #include "font.h" #include "w32font.h" + +#if 0 /* TODO: stipple */ +#include "bitmaps/gray.xbm" +#endif /* Fringe bitmaps. */ @@ -401,7 +395,13 @@ w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y, oldhb = SelectObject (hdc, hb); oldhp = SelectObject (hdc, hp); - Rectangle (hdc, x, y, x + width, y + height); + /* We enlarge WIDTH and HEIGHT by 1 to be bug-compatible to the + brain-dead design of XDrawRectangle, which draws a rectangle that + is 1 pixel wider and higher than its arguments WIDTH and HEIGHT. + This allows us to keep the code that calls this function similar + to the corresponding code in xterm.c. For the details, see + http://lists.gnu.org/archives/html/emacs-devel/2014-10/msg00546.html. */ + Rectangle (hdc, x, y, x + width + 1, y + height + 1); SelectObject (hdc, oldhb); SelectObject (hdc, oldhp); @@ -1212,7 +1212,12 @@ x_draw_glyph_string_background (struct glyph_string *s, bool force_p) } else #endif - if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width + if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width + /* When xdisp.c ignores FONT_HEIGHT, we cannot trust + font dimensions, since the actual glyphs might be + much smaller. So in that case we always clear the + rectangle with background color. */ + || FONT_TOO_HIGH (s->font) || s->font_not_found_p || s->extends_to_end_of_line_p || force_p) @@ -1410,7 +1415,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_ACRONYM) { - if (len > 1 + if (len > 0 && CHAR_TABLE_P (Vglyphless_char_display) && (CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (Vglyphless_char_display)) >= 1)) @@ -1585,7 +1590,9 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, unsigned long mask = GCForeground; COLORREF pixel; COLORREF background = di->relief_background; +#if 0 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); +#endif /* TODO: Free colors (if using palette)? */ @@ -4339,8 +4346,6 @@ w32_horizontal_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, if (dragging) { SCROLLINFO si; - int start = bar->start; - int end = bar->end; si.cbSize = sizeof (si); si.fMask = SIF_POS; @@ -4498,18 +4503,6 @@ x_scroll_bar_clear (struct frame *f) } } -static void -set_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) -{ - register Lisp_Object old_alist_elt; - - old_alist_elt = Fassq (prop, f->param_alist); - if (EQ (old_alist_elt, Qnil)) - fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist)); - else - Fsetcdr (old_alist_elt, val); -} - /* The main W32 event-reading loop - w32_read_socket. */ /* Record the last 100 characters stored @@ -5148,7 +5141,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, text_width, text_height; if (GetClientRect (msg.msg.hwnd, &rect) /* GetClientRect evidently returns (0, 0, 0, 0) if @@ -5821,7 +5814,7 @@ Lisp_Object x_new_font (struct frame *f, Lisp_Object font_object, int fontset) { struct font *font = XFONT_OBJECT (font_object); - int unit; + int unit, font_ascent, font_descent; if (fontset < 0) fontset = fontset_from_font (font_object); @@ -5834,7 +5827,8 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) FRAME_FONT (f) = font; FRAME_BASELINE_OFFSET (f) = font->baseline_offset; FRAME_COLUMN_WIDTH (f) = unit = font->average_width; - FRAME_LINE_HEIGHT (f) = font->height; + get_font_ascent_descent (font, &font_ascent, &font_descent); + FRAME_LINE_HEIGHT (f) = font_ascent + font_descent; /* Compute number of scrollbar columns. */ unit = FRAME_COLUMN_WIDTH (f); @@ -5919,16 +5913,49 @@ x_calc_absolute_position (struct frame *f) top_bottom_borders_height = 32; } + /* With multiple monitors, we can legitimately get negative + coordinates (for monitors above or to the left of the primary + monitor). Find the display origin to ensure negative positions + are computed correctly (Bug#21173). */ + int display_left = 0; + int display_top = 0; + if (flags & (XNegative | YNegative)) + { + Lisp_Object list; + + list = Fw32_display_monitor_attributes_list (Qnil); + while (CONSP (list)) + { + Lisp_Object attributes = CAR(list); + Lisp_Object geometry; + Lisp_Object monitor_left, monitor_top; + + list = CDR(list); + + geometry = Fassoc (Qgeometry, attributes); + if (!NILP (geometry)) + { + monitor_left = Fnth (make_number (1), geometry); + monitor_top = Fnth (make_number (2), geometry); + + display_left = min (display_left, XINT (monitor_left)); + display_top = min (display_top, XINT (monitor_top)); + } + } + } + /* Treat negative positions as relative to the rightmost bottommost position that fits on the screen. */ if (flags & XNegative) f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) + + display_left - FRAME_PIXEL_WIDTH (f) + f->left_pos - (left_right_borders_width - 1)); if (flags & YNegative) f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) + + display_top - FRAME_PIXEL_HEIGHT (f) + f->top_pos - (top_bottom_borders_height - 1)); @@ -6164,6 +6191,13 @@ x_set_window_size (struct frame *f, bool change_gravity, if (pixelwidth > 0 || pixelheight > 0) { + frame_size_history_add + (f, Qx_set_window_size_1, width, height, + list2 (Fcons (make_number (pixelwidth), + make_number (pixelheight)), + Fcons (make_number (rect.right - rect.left), + make_number (rect.bottom - rect.top)))); + my_set_window_pos (FRAME_W32_WINDOW (f), NULL, 0, 0, rect.right - rect.left, @@ -6190,8 +6224,6 @@ x_set_window_size (struct frame *f, bool change_gravity, } unblock_input (); - - do_pending_window_change (0); } /* Mouse warping. */ @@ -6578,7 +6610,10 @@ w32_hide_hourglass (struct frame *f) struct w32_output *w32 = FRAME_X_OUTPUT (f); w32->hourglass_p = 0; - SetCursor (w32->current_cursor); + if (f->pointer_invisible) + SetCursor (NULL); + else + SetCursor (w32->current_cursor); } /* FIXME: old code did that, but I don't know why. Anyway, @@ -6590,6 +6625,21 @@ w32_arrow_cursor (void) SetCursor (w32_load_cursor (IDC_ARROW)); } +static void +w32_toggle_invisible_pointer (struct frame *f, bool invisible) +{ + block_input (); + + if (f->pointer_invisible != invisible) + { + f->pointer_invisible = invisible; + w32_define_cursor (FRAME_W32_WINDOW (f), + f->output_data.w32->current_cursor); + } + + unblock_input (); +} + /*********************************************************************** Initialization ***********************************************************************/ @@ -6729,6 +6779,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) terminal->ins_del_lines_hook = x_ins_del_lines; terminal->delete_glyphs_hook = x_delete_glyphs; terminal->ring_bell_hook = w32_ring_bell; + terminal->toggle_invisible_pointer_hook = w32_toggle_invisible_pointer; terminal->update_begin_hook = x_update_begin; terminal->update_end_hook = x_update_end; terminal->read_socket_hook = w32_read_socket;