comparison src/w32fns.c @ 43398:8782b8cfed62

*** empty log message ***
author Jason Rumney <jasonr@gnu.org>
date Mon, 18 Feb 2002 00:04:14 +0000
parents 3df71b933c36
children 7faac536665f
comparison
equal deleted inserted replaced
43397:212dbe6254e8 43398:8782b8cfed62
268 268
269 #ifdef UNICODE_CHARSET 269 #ifdef UNICODE_CHARSET
270 Lisp_Object Qw32_charset_unicode; 270 Lisp_Object Qw32_charset_unicode;
271 #endif 271 #endif
272 272
273 Lisp_Object Qfullscreen;
274 Lisp_Object Qfullwidth;
275 Lisp_Object Qfullheight;
276 Lisp_Object Qfullboth;
277
273 extern Lisp_Object Qtop; 278 extern Lisp_Object Qtop;
274 extern Lisp_Object Qdisplay; 279 extern Lisp_Object Qdisplay;
275 extern Lisp_Object Qtool_bar_lines; 280 extern Lisp_Object Qtool_bar_lines;
276 281
277 /* State variables for emulating a three button mouse. */ 282 /* State variables for emulating a three button mouse. */
679 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); 684 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
680 static void x_change_window_heights P_ ((Lisp_Object, int)); 685 static void x_change_window_heights P_ ((Lisp_Object, int));
681 /* TODO: Native Input Method support; see x_create_im. */ 686 /* TODO: Native Input Method support; see x_create_im. */
682 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 687 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
683 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); 688 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
689 static void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object));
684 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 690 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
685 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 691 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
686 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 692 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
687 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 693 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
688 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); 694 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
732 {"visibility", x_set_visibility}, 738 {"visibility", x_set_visibility},
733 {"tool-bar-lines", x_set_tool_bar_lines}, 739 {"tool-bar-lines", x_set_tool_bar_lines},
734 {"screen-gamma", x_set_screen_gamma}, 740 {"screen-gamma", x_set_screen_gamma},
735 {"line-spacing", x_set_line_spacing}, 741 {"line-spacing", x_set_line_spacing},
736 {"left-fringe", x_set_fringe_width}, 742 {"left-fringe", x_set_fringe_width},
737 {"right-fringe", x_set_fringe_width} 743 {"right-fringe", x_set_fringe_width},
744 {"fullscreen", x_set_fullscreen},
738 }; 745 };
739 746
740 /* Attach the `x-frame-parameter' properties to 747 /* Attach the `x-frame-parameter' properties to
741 the Lisp symbol names of parameters relevant to W32. */ 748 the Lisp symbol names of parameters relevant to W32. */
742 749
748 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) 755 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
749 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, 756 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
750 make_number (i)); 757 make_number (i));
751 } 758 }
752 759
760 /* Really try to move where we want to be in case of fullscreen. Some WMs
761 moves the window where we tell them. Some (mwm, twm) moves the outer
762 window manager window there instead.
763 Try to compensate for those WM here. */
764 static void
765 x_fullscreen_move (f, new_top, new_left)
766 struct frame *f;
767 int new_top;
768 int new_left;
769 {
770 if (new_top != f->output_data.w32->top_pos
771 || new_left != f->output_data.w32->left_pos)
772 {
773 int move_x = new_left;
774 int move_y = new_top;
775
776 f->output_data.w32->want_fullscreen |= FULLSCREEN_MOVE_WAIT;
777 x_set_offset (f, move_x, move_y, 1);
778 }
779 }
780
753 /* Change the parameters of frame F as specified by ALIST. 781 /* Change the parameters of frame F as specified by ALIST.
754 If a parameter is not specially recognized, do nothing; 782 If a parameter is not specially recognized, do nothing;
755 otherwise call the `x_set_...' function for that parameter. */ 783 otherwise call the `x_set_...' function for that parameter. */
756 784
757 void 785 void
776 Lisp_Object *parms; 804 Lisp_Object *parms;
777 Lisp_Object *values; 805 Lisp_Object *values;
778 int i, p; 806 int i, p;
779 int left_no_change = 0, top_no_change = 0; 807 int left_no_change = 0, top_no_change = 0;
780 int icon_left_no_change = 0, icon_top_no_change = 0; 808 int icon_left_no_change = 0, icon_top_no_change = 0;
809 int fullscreen_is_being_set = 0;
781 810
782 struct gcpro gcpro1, gcpro2; 811 struct gcpro gcpro1, gcpro2;
783 812
784 i = 0; 813 i = 0;
785 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) 814 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
833 862
834 prop = parms[p]; 863 prop = parms[p];
835 val = values[p]; 864 val = values[p];
836 if (EQ (prop, Qforeground_color) 865 if (EQ (prop, Qforeground_color)
837 || EQ (prop, Qbackground_color) 866 || EQ (prop, Qbackground_color)
838 || EQ (prop, Qfont)) 867 || EQ (prop, Qfont)
868 || EQ (prop, Qfullscreen))
839 { 869 {
840 register Lisp_Object param_index, old_value; 870 register Lisp_Object param_index, old_value;
841 871
842 old_value = get_frame_param (f, prop); 872 old_value = get_frame_param (f, prop);
873 fullscreen_is_being_set |= EQ (prop, Qfullscreen);
843 874
844 if (NILP (Fequal (val, old_value))) 875 if (NILP (Fequal (val, old_value)))
845 { 876 {
846 store_frame_param (f, prop, val); 877 store_frame_param (f, prop, val);
847 878
874 icon_top = val; 905 icon_top = val;
875 else if (EQ (prop, Qicon_left)) 906 else if (EQ (prop, Qicon_left))
876 icon_left = val; 907 icon_left = val;
877 else if (EQ (prop, Qforeground_color) 908 else if (EQ (prop, Qforeground_color)
878 || EQ (prop, Qbackground_color) 909 || EQ (prop, Qbackground_color)
879 || EQ (prop, Qfont)) 910 || EQ (prop, Qfont)
911 || EQ (prop, Qfullscreen))
880 /* Processed above. */ 912 /* Processed above. */
881 continue; 913 continue;
882 else 914 else
883 { 915 {
884 register Lisp_Object param_index, old_value; 916 register Lisp_Object param_index, old_value;
925 { 957 {
926 icon_top_no_change = 1; 958 icon_top_no_change = 1;
927 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); 959 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
928 if (NILP (icon_top)) 960 if (NILP (icon_top))
929 XSETINT (icon_top, 0); 961 XSETINT (icon_top, 0);
962 }
963
964 if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set)
965 {
966 /* If the frame is visible already and the fullscreen parameter is
967 being set, it is too late to set WM manager hints to specify
968 size and position.
969 Here we first get the width, height and position that applies to
970 fullscreen. We then move the frame to the appropriate
971 position. Resize of the frame is taken care of in the code after
972 this if-statement. */
973 int new_left, new_top;
974
975 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left);
976 x_fullscreen_move (f, new_top, new_left);
930 } 977 }
931 978
932 /* Don't set these parameters unless they've been explicitly 979 /* Don't set these parameters unless they've been explicitly
933 specified. The window might be mapped or resized while we're in 980 specified. The window might be mapped or resized while we're in
934 this function, and we don't want to override that unless the lisp 981 this function, and we don't want to override that unless the lisp
1030 x_real_positions (f, xptr, yptr) 1077 x_real_positions (f, xptr, yptr)
1031 FRAME_PTR f; 1078 FRAME_PTR f;
1032 int *xptr, *yptr; 1079 int *xptr, *yptr;
1033 { 1080 {
1034 POINT pt; 1081 POINT pt;
1035 1082 RECT rect;
1036 { 1083
1037 RECT rect; 1084 GetClientRect(FRAME_W32_WINDOW(f), &rect);
1038 1085 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f));
1039 GetClientRect(FRAME_W32_WINDOW(f), &rect); 1086
1040 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); 1087 pt.x = rect.left;
1041 1088 pt.y = rect.top;
1042 pt.x = rect.left;
1043 pt.y = rect.top;
1044 }
1045 1089
1046 ClientToScreen (FRAME_W32_WINDOW(f), &pt); 1090 ClientToScreen (FRAME_W32_WINDOW(f), &pt);
1091
1092 /* Remember x_pixels_diff and y_pixels_diff. */
1093 f->output_data.w32->x_pixels_diff = pt.x - rect.left;
1094 f->output_data.w32->y_pixels_diff = pt.y - rect.top;
1047 1095
1048 *xptr = pt.x; 1096 *xptr = pt.x;
1049 *yptr = pt.y; 1097 *yptr = pt.y;
1050 } 1098 }
1051 1099
1965 if (FRAME_VISIBLE_P (f)) 2013 if (FRAME_VISIBLE_P (f))
1966 redraw_frame (f); 2014 redraw_frame (f);
1967 } 2015 }
1968 2016
1969 2017
2018 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is
2019 the previous value of that parameter, NEW_VALUE is the new value. */
2020
2021 static void
2022 x_set_fullscreen (f, new_value, old_value)
2023 struct frame *f;
2024 Lisp_Object new_value, old_value;
2025 {
2026 if (NILP (new_value))
2027 f->output_data.w32->want_fullscreen = FULLSCREEN_NONE;
2028 else if (EQ (new_value, Qfullboth))
2029 f->output_data.w32->want_fullscreen = FULLSCREEN_BOTH;
2030 else if (EQ (new_value, Qfullwidth))
2031 f->output_data.w32->want_fullscreen = FULLSCREEN_WIDTH;
2032 else if (EQ (new_value, Qfullheight))
2033 f->output_data.w32->want_fullscreen = FULLSCREEN_HEIGHT;
2034 }
2035
2036
1970 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is 2037 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
1971 the previous value of that parameter, NEW_VALUE is the new value. */ 2038 the previous value of that parameter, NEW_VALUE is the new value. */
1972 2039
1973 static void 2040 static void
1974 x_set_screen_gamma (f, new_value, old_value) 2041 x_set_screen_gamma (f, new_value, old_value)
3283 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) 3350 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
3284 ? 0 3351 ? 0
3285 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 3352 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
3286 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) 3353 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
3287 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); 3354 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
3355
3288 x_compute_fringe_widths (f, 0); 3356 x_compute_fringe_widths (f, 0);
3357
3289 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); 3358 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
3290 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); 3359 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
3291 3360
3292 tem0 = w32_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER); 3361 tem0 = w32_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER);
3293 tem1 = w32_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER); 3362 tem1 = w32_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER);
3352 3421
3353 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) 3422 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
3354 window_prompting |= USPosition; 3423 window_prompting |= USPosition;
3355 else 3424 else
3356 window_prompting |= PPosition; 3425 window_prompting |= PPosition;
3426 }
3427
3428 if (f->output_data.w32->want_fullscreen != FULLSCREEN_NONE)
3429 {
3430 int left, top;
3431 int width, height;
3432
3433 /* It takes both for some WM:s to place it where we want */
3434 window_prompting = USPosition | PPosition;
3435 x_fullscreen_adjust (f, &width, &height, &top, &left);
3436 f->width = width;
3437 f->height = height;
3438 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
3439 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
3440 f->output_data.w32->left_pos = left;
3441 f->output_data.w32->top_pos = top;
3357 } 3442 }
3358 3443
3359 return window_prompting; 3444 return window_prompting;
3360 } 3445 }
3361 3446
5562 "toolBar", "ToolBar", RES_TYPE_NUMBER); 5647 "toolBar", "ToolBar", RES_TYPE_NUMBER);
5563 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, 5648 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
5564 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); 5649 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
5565 x_default_parameter (f, parms, Qtitle, Qnil, 5650 x_default_parameter (f, parms, Qtitle, Qnil,
5566 "title", "Title", RES_TYPE_STRING); 5651 "title", "Title", RES_TYPE_STRING);
5652 x_default_parameter (f, parms, Qfullscreen, Qnil,
5653 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
5567 5654
5568 f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW; 5655 f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW;
5569 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; 5656 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
5570 5657
5571 /* Add the tool-bar height to the initial frame height so that the 5658 /* Add the tool-bar height to the initial frame height so that the
5957 fontp->relative_compose = 0; 6044 fontp->relative_compose = 0;
5958 fontp->default_ascent = 0; 6045 fontp->default_ascent = 0;
5959 6046
5960 /* Set global flag fonts_changed_p to non-zero if the font loaded 6047 /* Set global flag fonts_changed_p to non-zero if the font loaded
5961 has a character with a smaller width than any other character 6048 has a character with a smaller width than any other character
5962 before, or if the font loaded has a smalle>r height than any 6049 before, or if the font loaded has a smaller height than any
5963 other font loaded before. If this happens, it will make a 6050 other font loaded before. If this happens, it will make a
5964 glyph matrix reallocation necessary. */ 6051 glyph matrix reallocation necessary. */
5965 fonts_changed_p = x_compute_min_glyph_bounds (f); 6052 fonts_changed_p |= x_compute_min_glyph_bounds (f);
5966 UNBLOCK_INPUT; 6053 UNBLOCK_INPUT;
5967 return fontp; 6054 return fontp;
5968 } 6055 }
5969 } 6056 }
5970 6057
14485 track_mouse_event_fn = GetProcAddress (user32_lib, "TrackMouseEvent"); 14572 track_mouse_event_fn = GetProcAddress (user32_lib, "TrackMouseEvent");
14486 track_mouse_window = NULL; 14573 track_mouse_window = NULL;
14487 14574
14488 w32_visible_system_caret_hwnd = NULL; 14575 w32_visible_system_caret_hwnd = NULL;
14489 14576
14490 /* The section below is built by the lisp expression at the top of the file,
14491 just above where these variables are declared. */
14492 /*&&& init symbols here &&&*/
14493 Qauto_raise = intern ("auto-raise"); 14577 Qauto_raise = intern ("auto-raise");
14494 staticpro (&Qauto_raise); 14578 staticpro (&Qauto_raise);
14495 Qauto_lower = intern ("auto-lower"); 14579 Qauto_lower = intern ("auto-lower");
14496 staticpro (&Qauto_lower); 14580 staticpro (&Qauto_lower);
14497 Qbar = intern ("bar"); 14581 Qbar = intern ("bar");
14554 staticpro (&Qline_spacing); 14638 staticpro (&Qline_spacing);
14555 Qcenter = intern ("center"); 14639 Qcenter = intern ("center");
14556 staticpro (&Qcenter); 14640 staticpro (&Qcenter);
14557 Qcancel_timer = intern ("cancel-timer"); 14641 Qcancel_timer = intern ("cancel-timer");
14558 staticpro (&Qcancel_timer); 14642 staticpro (&Qcancel_timer);
14559 /* This is the end of symbol initialization. */ 14643 Qfullscreen = intern ("fullscreen");
14644 staticpro (&Qfullscreen);
14645 Qfullwidth = intern ("fullwidth");
14646 staticpro (&Qfullwidth);
14647 Qfullheight = intern ("fullheight");
14648 staticpro (&Qfullheight);
14649 Qfullboth = intern ("fullboth");
14650 staticpro (&Qfullboth);
14560 14651
14561 Qhyper = intern ("hyper"); 14652 Qhyper = intern ("hyper");
14562 staticpro (&Qhyper); 14653 staticpro (&Qhyper);
14563 Qsuper = intern ("super"); 14654 Qsuper = intern ("super");
14564 staticpro (&Qsuper); 14655 staticpro (&Qsuper);
14570 staticpro (&Qctrl); 14661 staticpro (&Qctrl);
14571 Qcontrol = intern ("control"); 14662 Qcontrol = intern ("control");
14572 staticpro (&Qcontrol); 14663 staticpro (&Qcontrol);
14573 Qshift = intern ("shift"); 14664 Qshift = intern ("shift");
14574 staticpro (&Qshift); 14665 staticpro (&Qshift);
14666 /* This is the end of symbol initialization. */
14575 14667
14576 /* Text property `display' should be nonsticky by default. */ 14668 /* Text property `display' should be nonsticky by default. */
14577 Vtext_property_default_nonsticky 14669 Vtext_property_default_nonsticky
14578 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky); 14670 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky);
14579 14671