diff options
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 339 |
1 files changed, 192 insertions, 147 deletions
diff --git a/src/xterm.c b/src/xterm.c index 7b8d32a4516..f32aea031f9 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -2474,7 +2474,7 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2474 | { | 2474 | { |
| 2475 | /* In R2L rows, draw the cursor on the right edge of the | 2475 | /* In R2L rows, draw the cursor on the right edge of the |
| 2476 | stretch glyph. */ | 2476 | stretch glyph. */ |
| 2477 | int right_x = window_box_right_offset (s->w, TEXT_AREA); | 2477 | int right_x = window_box_right (s->w, TEXT_AREA); |
| 2478 | 2478 | ||
| 2479 | if (x + background_width > right_x) | 2479 | if (x + background_width > right_x) |
| 2480 | background_width -= x - right_x; | 2480 | background_width -= x - right_x; |
| @@ -4157,7 +4157,7 @@ XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 4157 | dpyinfo->last_mouse_glyph_frame = f1; | 4157 | dpyinfo->last_mouse_glyph_frame = f1; |
| 4158 | 4158 | ||
| 4159 | *bar_window = Qnil; | 4159 | *bar_window = Qnil; |
| 4160 | *part = 0; | 4160 | *part = scroll_bar_above_handle; |
| 4161 | *fp = f1; | 4161 | *fp = f1; |
| 4162 | XSETINT (*x, win_x); | 4162 | XSETINT (*x, win_x); |
| 4163 | XSETINT (*y, win_y); | 4163 | XSETINT (*y, win_y); |
| @@ -4250,7 +4250,8 @@ x_window_to_menu_bar (Window window) | |||
| 4250 | 4250 | ||
| 4251 | #ifdef USE_TOOLKIT_SCROLL_BARS | 4251 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 4252 | 4252 | ||
| 4253 | static void x_send_scroll_bar_event (Lisp_Object, int, int, int, bool); | 4253 | static void x_send_scroll_bar_event (Lisp_Object, enum scroll_bar_part, |
| 4254 | int, int, bool); | ||
| 4254 | 4255 | ||
| 4255 | /* Lisp window being scrolled. Set when starting to interact with | 4256 | /* Lisp window being scrolled. Set when starting to interact with |
| 4256 | a toolkit scroll bar, reset to nil when ending the interaction. */ | 4257 | a toolkit scroll bar, reset to nil when ending the interaction. */ |
| @@ -4371,7 +4372,8 @@ xt_horizontal_action_hook (Widget widget, XtPointer client_data, String action_n | |||
| 4371 | amount to scroll of a whole of WHOLE. */ | 4372 | amount to scroll of a whole of WHOLE. */ |
| 4372 | 4373 | ||
| 4373 | static void | 4374 | static void |
| 4374 | x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole, bool horizontal) | 4375 | x_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part, |
| 4376 | int portion, int whole, bool horizontal) | ||
| 4375 | { | 4377 | { |
| 4376 | XEvent event; | 4378 | XEvent event; |
| 4377 | XClientMessageEvent *ev = &event.xclient; | 4379 | XClientMessageEvent *ev = &event.xclient; |
| @@ -4504,8 +4506,8 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4504 | { | 4506 | { |
| 4505 | struct scroll_bar *bar = client_data; | 4507 | struct scroll_bar *bar = client_data; |
| 4506 | XmScrollBarCallbackStruct *cs = call_data; | 4508 | XmScrollBarCallbackStruct *cs = call_data; |
| 4507 | int part = -1, whole = 0, portion = 0; | 4509 | enum scroll_bar_part part = scroll_bar_nowhere; |
| 4508 | int horizontal = bar->horizontal; | 4510 | int horizontal = bar->horizontal, whole = 0, portion = 0; |
| 4509 | 4511 | ||
| 4510 | switch (cs->reason) | 4512 | switch (cs->reason) |
| 4511 | { | 4513 | { |
| @@ -4549,12 +4551,9 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4549 | 4551 | ||
| 4550 | if (horizontal) | 4552 | if (horizontal) |
| 4551 | { | 4553 | { |
| 4552 | whole = bar->whole; | 4554 | portion = bar->whole * ((float)cs->value / XM_SB_MAX); |
| 4553 | portion = (((float) cs->value | 4555 | whole = bar->whole * ((float)(XM_SB_MAX - slider_size) / XM_SB_MAX); |
| 4554 | / (XM_SB_MAX - slider_size)) | 4556 | portion = min (portion, whole); |
| 4555 | * (whole | ||
| 4556 | - ((float) slider_size / XM_SB_MAX) * whole)); | ||
| 4557 | portion = max (0, portion); | ||
| 4558 | part = scroll_bar_horizontal_handle; | 4557 | part = scroll_bar_horizontal_handle; |
| 4559 | } | 4558 | } |
| 4560 | else | 4559 | else |
| @@ -4572,7 +4571,7 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4572 | break; | 4571 | break; |
| 4573 | }; | 4572 | }; |
| 4574 | 4573 | ||
| 4575 | if (part >= 0) | 4574 | if (part != scroll_bar_nowhere) |
| 4576 | { | 4575 | { |
| 4577 | window_being_scrolled = bar->window; | 4576 | window_being_scrolled = bar->window; |
| 4578 | x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); | 4577 | x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); |
| @@ -4590,8 +4589,9 @@ xg_scroll_callback (GtkRange *range, | |||
| 4590 | gdouble value, | 4589 | gdouble value, |
| 4591 | gpointer user_data) | 4590 | gpointer user_data) |
| 4592 | { | 4591 | { |
| 4592 | int whole = 0, portion = 0; | ||
| 4593 | struct scroll_bar *bar = user_data; | 4593 | struct scroll_bar *bar = user_data; |
| 4594 | int part = -1, whole = 0, portion = 0; | 4594 | enum scroll_bar_part part = scroll_bar_nowhere; |
| 4595 | GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range)); | 4595 | GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range)); |
| 4596 | struct frame *f = g_object_get_data (G_OBJECT (range), XG_FRAME_DATA); | 4596 | struct frame *f = g_object_get_data (G_OBJECT (range), XG_FRAME_DATA); |
| 4597 | 4597 | ||
| @@ -4644,7 +4644,7 @@ xg_scroll_callback (GtkRange *range, | |||
| 4644 | break; | 4644 | break; |
| 4645 | } | 4645 | } |
| 4646 | 4646 | ||
| 4647 | if (part >= 0) | 4647 | if (part != scroll_bar_nowhere) |
| 4648 | { | 4648 | { |
| 4649 | window_being_scrolled = bar->window; | 4649 | window_being_scrolled = bar->window; |
| 4650 | x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); | 4650 | x_send_scroll_bar_event (bar->window, part, portion, whole, bar->horizontal); |
| @@ -4687,24 +4687,51 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4687 | float *top_addr = call_data; | 4687 | float *top_addr = call_data; |
| 4688 | float top = *top_addr; | 4688 | float top = *top_addr; |
| 4689 | float shown; | 4689 | float shown; |
| 4690 | int whole, portion, height; | 4690 | int whole, portion, height, width; |
| 4691 | enum scroll_bar_part part; | 4691 | enum scroll_bar_part part; |
| 4692 | int horizontal = bar->horizontal; | 4692 | int horizontal = bar->horizontal; |
| 4693 | 4693 | ||
| 4694 | /* Get the size of the thumb, a value between 0 and 1. */ | ||
| 4695 | block_input (); | ||
| 4696 | XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); | ||
| 4697 | unblock_input (); | ||
| 4698 | 4694 | ||
| 4699 | if (horizontal) | 4695 | if (horizontal) |
| 4700 | { | 4696 | { |
| 4701 | whole = bar->whole; | 4697 | /* Get the size of the thumb, a value between 0 and 1. */ |
| 4702 | portion = (top * (whole - (shown * whole))) / (1 - shown); | 4698 | block_input (); |
| 4703 | portion = max (0, portion); | 4699 | XtVaGetValues (widget, XtNshown, &shown, XtNwidth, &width, NULL); |
| 4700 | unblock_input (); | ||
| 4701 | |||
| 4702 | if (shown < 1) | ||
| 4703 | { | ||
| 4704 | whole = bar->whole - (shown * bar->whole); | ||
| 4705 | portion = min (top * bar->whole, whole); | ||
| 4706 | } | ||
| 4707 | else | ||
| 4708 | { | ||
| 4709 | whole = bar->whole; | ||
| 4710 | portion = 0; | ||
| 4711 | } | ||
| 4712 | |||
| 4704 | part = scroll_bar_horizontal_handle; | 4713 | part = scroll_bar_horizontal_handle; |
| 4705 | } | 4714 | } |
| 4706 | else | 4715 | else |
| 4707 | part = scroll_bar_handle; | 4716 | { |
| 4717 | /* Get the size of the thumb, a value between 0 and 1. */ | ||
| 4718 | block_input (); | ||
| 4719 | XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); | ||
| 4720 | unblock_input (); | ||
| 4721 | |||
| 4722 | whole = 10000000; | ||
| 4723 | portion = shown < 1 ? top * whole : 0; | ||
| 4724 | |||
| 4725 | if (shown < 1 && (eabs (top + shown - 1) < 1.0f / height)) | ||
| 4726 | /* Some derivatives of Xaw refuse to shrink the thumb when you reach | ||
| 4727 | the bottom, so we force the scrolling whenever we see that we're | ||
| 4728 | too close to the bottom (in x_set_toolkit_scroll_bar_thumb | ||
| 4729 | we try to ensure that we always stay two pixels away from the | ||
| 4730 | bottom). */ | ||
| 4731 | part = scroll_bar_down_arrow; | ||
| 4732 | else | ||
| 4733 | part = scroll_bar_handle; | ||
| 4734 | } | ||
| 4708 | 4735 | ||
| 4709 | window_being_scrolled = bar->window; | 4736 | window_being_scrolled = bar->window; |
| 4710 | bar->dragging = portion; | 4737 | bar->dragging = portion; |
| @@ -4727,28 +4754,54 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data) | |||
| 4727 | struct scroll_bar *bar = client_data; | 4754 | struct scroll_bar *bar = client_data; |
| 4728 | /* The position really is stored cast to a pointer. */ | 4755 | /* The position really is stored cast to a pointer. */ |
| 4729 | int position = (intptr_t) call_data; | 4756 | int position = (intptr_t) call_data; |
| 4730 | Dimension height; | 4757 | Dimension height, width; |
| 4731 | enum scroll_bar_part part; | 4758 | enum scroll_bar_part part; |
| 4732 | 4759 | ||
| 4733 | /* Get the height of the scroll bar. */ | 4760 | if (bar->horizontal) |
| 4734 | block_input (); | 4761 | { |
| 4735 | XtVaGetValues (widget, XtNheight, &height, NULL); | 4762 | /* Get the width of the scroll bar. */ |
| 4736 | unblock_input (); | 4763 | block_input (); |
| 4764 | XtVaGetValues (widget, XtNwidth, &width, NULL); | ||
| 4765 | unblock_input (); | ||
| 4737 | 4766 | ||
| 4738 | if (eabs (position) >= height) | 4767 | if (eabs (position) >= width) |
| 4739 | part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; | 4768 | part = (position < 0) ? scroll_bar_before_handle : scroll_bar_after_handle; |
| 4769 | |||
| 4770 | /* If Xaw3d was compiled with ARROW_SCROLLBAR, | ||
| 4771 | it maps line-movement to call_data = max(5, height/20). */ | ||
| 4772 | else if (xaw3d_arrow_scroll && eabs (position) <= max (5, width / 20)) | ||
| 4773 | part = (position < 0) ? scroll_bar_left_arrow : scroll_bar_right_arrow; | ||
| 4774 | else | ||
| 4775 | part = scroll_bar_move_ratio; | ||
| 4740 | 4776 | ||
| 4741 | /* If Xaw3d was compiled with ARROW_SCROLLBAR, | 4777 | window_being_scrolled = bar->window; |
| 4742 | it maps line-movement to call_data = max(5, height/20). */ | 4778 | bar->dragging = -1; |
| 4743 | else if (xaw3d_arrow_scroll && eabs (position) <= max (5, height / 20)) | 4779 | bar->last_seen_part = part; |
| 4744 | part = (position < 0) ? scroll_bar_up_arrow : scroll_bar_down_arrow; | 4780 | x_send_scroll_bar_event (bar->window, part, position, width, bar->horizontal); |
| 4781 | } | ||
| 4745 | else | 4782 | else |
| 4746 | part = scroll_bar_move_ratio; | 4783 | { |
| 4747 | 4784 | ||
| 4748 | window_being_scrolled = bar->window; | 4785 | /* Get the height of the scroll bar. */ |
| 4749 | bar->dragging = -1; | 4786 | block_input (); |
| 4750 | bar->last_seen_part = part; | 4787 | XtVaGetValues (widget, XtNheight, &height, NULL); |
| 4751 | x_send_scroll_bar_event (bar->window, part, position, height, bar->horizontal); | 4788 | unblock_input (); |
| 4789 | |||
| 4790 | if (eabs (position) >= height) | ||
| 4791 | part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; | ||
| 4792 | |||
| 4793 | /* If Xaw3d was compiled with ARROW_SCROLLBAR, | ||
| 4794 | it maps line-movement to call_data = max(5, height/20). */ | ||
| 4795 | else if (xaw3d_arrow_scroll && eabs (position) <= max (5, height / 20)) | ||
| 4796 | part = (position < 0) ? scroll_bar_up_arrow : scroll_bar_down_arrow; | ||
| 4797 | else | ||
| 4798 | part = scroll_bar_move_ratio; | ||
| 4799 | |||
| 4800 | window_being_scrolled = bar->window; | ||
| 4801 | bar->dragging = -1; | ||
| 4802 | bar->last_seen_part = part; | ||
| 4803 | x_send_scroll_bar_event (bar->window, part, position, height, bar->horizontal); | ||
| 4804 | } | ||
| 4752 | } | 4805 | } |
| 4753 | 4806 | ||
| 4754 | #endif /* not USE_GTK and not USE_MOTIF */ | 4807 | #endif /* not USE_GTK and not USE_MOTIF */ |
| @@ -6134,7 +6187,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, | |||
| 6134 | /* If the user has released the handle, set it to its final position. */ | 6187 | /* If the user has released the handle, set it to its final position. */ |
| 6135 | if (event->type == ButtonRelease && bar->dragging != -1) | 6188 | if (event->type == ButtonRelease && bar->dragging != -1) |
| 6136 | { | 6189 | { |
| 6137 | int new_start = - bar->dragging; | 6190 | int new_start = - bar->dragging; |
| 6138 | int new_end = new_start + bar->end - bar->start; | 6191 | int new_end = new_start + bar->end - bar->start; |
| 6139 | 6192 | ||
| 6140 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); | 6193 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
| @@ -6749,7 +6802,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6749 | break; | 6802 | break; |
| 6750 | 6803 | ||
| 6751 | case SelectionNotify: | 6804 | case SelectionNotify: |
| 6752 | dpyinfo->last_user_time = event->xselection.time; | 6805 | x_display_set_last_user_time (dpyinfo, event->xselection.time); |
| 6753 | #ifdef USE_X_TOOLKIT | 6806 | #ifdef USE_X_TOOLKIT |
| 6754 | if (! x_window_to_frame (dpyinfo, event->xselection.requestor)) | 6807 | if (! x_window_to_frame (dpyinfo, event->xselection.requestor)) |
| 6755 | goto OTHER; | 6808 | goto OTHER; |
| @@ -6758,7 +6811,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6758 | break; | 6811 | break; |
| 6759 | 6812 | ||
| 6760 | case SelectionClear: /* Someone has grabbed ownership. */ | 6813 | case SelectionClear: /* Someone has grabbed ownership. */ |
| 6761 | dpyinfo->last_user_time = event->xselectionclear.time; | 6814 | x_display_set_last_user_time (dpyinfo, event->xselectionclear.time); |
| 6762 | #ifdef USE_X_TOOLKIT | 6815 | #ifdef USE_X_TOOLKIT |
| 6763 | if (! x_window_to_frame (dpyinfo, event->xselectionclear.window)) | 6816 | if (! x_window_to_frame (dpyinfo, event->xselectionclear.window)) |
| 6764 | goto OTHER; | 6817 | goto OTHER; |
| @@ -6774,7 +6827,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6774 | break; | 6827 | break; |
| 6775 | 6828 | ||
| 6776 | case SelectionRequest: /* Someone wants our selection. */ | 6829 | case SelectionRequest: /* Someone wants our selection. */ |
| 6777 | dpyinfo->last_user_time = event->xselectionrequest.time; | 6830 | x_display_set_last_user_time (dpyinfo, event->xselectionrequest.time); |
| 6778 | #ifdef USE_X_TOOLKIT | 6831 | #ifdef USE_X_TOOLKIT |
| 6779 | if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner)) | 6832 | if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner)) |
| 6780 | goto OTHER; | 6833 | goto OTHER; |
| @@ -6793,23 +6846,33 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6793 | break; | 6846 | break; |
| 6794 | 6847 | ||
| 6795 | case PropertyNotify: | 6848 | case PropertyNotify: |
| 6796 | dpyinfo->last_user_time = event->xproperty.time; | 6849 | x_display_set_last_user_time (dpyinfo, event->xproperty.time); |
| 6797 | f = x_top_window_to_frame (dpyinfo, event->xproperty.window); | 6850 | f = x_top_window_to_frame (dpyinfo, event->xproperty.window); |
| 6798 | if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state) | 6851 | if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state) |
| 6799 | if (x_handle_net_wm_state (f, &event->xproperty) | 6852 | { |
| 6800 | && FRAME_ICONIFIED_P (f) | 6853 | if (x_handle_net_wm_state (f, &event->xproperty) |
| 6801 | && f->output_data.x->net_wm_state_hidden_seen) | 6854 | && FRAME_ICONIFIED_P (f) |
| 6802 | { | 6855 | && f->output_data.x->net_wm_state_hidden_seen) |
| 6803 | /* Gnome shell does not iconify us when C-z is pressed. | 6856 | { |
| 6804 | It hides the frame. So if our state says we aren't | 6857 | /* Gnome shell does not iconify us when C-z is pressed. |
| 6805 | hidden anymore, treat it as deiconified. */ | 6858 | It hides the frame. So if our state says we aren't |
| 6806 | SET_FRAME_VISIBLE (f, 1); | 6859 | hidden anymore, treat it as deiconified. */ |
| 6807 | SET_FRAME_ICONIFIED (f, 0); | 6860 | SET_FRAME_VISIBLE (f, 1); |
| 6808 | f->output_data.x->has_been_visible = 1; | 6861 | SET_FRAME_ICONIFIED (f, 0); |
| 6809 | f->output_data.x->net_wm_state_hidden_seen = 0; | 6862 | f->output_data.x->has_been_visible = 1; |
| 6810 | inev.ie.kind = DEICONIFY_EVENT; | 6863 | f->output_data.x->net_wm_state_hidden_seen = 0; |
| 6811 | XSETFRAME (inev.ie.frame_or_window, f); | 6864 | inev.ie.kind = DEICONIFY_EVENT; |
| 6812 | } | 6865 | XSETFRAME (inev.ie.frame_or_window, f); |
| 6866 | } | ||
| 6867 | else if (! FRAME_ICONIFIED_P (f) | ||
| 6868 | && f->output_data.x->net_wm_state_hidden_seen) | ||
| 6869 | { | ||
| 6870 | SET_FRAME_VISIBLE (f, 0); | ||
| 6871 | SET_FRAME_ICONIFIED (f, 1); | ||
| 6872 | inev.ie.kind = ICONIFY_EVENT; | ||
| 6873 | XSETFRAME (inev.ie.frame_or_window, f); | ||
| 6874 | } | ||
| 6875 | } | ||
| 6813 | 6876 | ||
| 6814 | x_handle_property_notify (&event->xproperty); | 6877 | x_handle_property_notify (&event->xproperty); |
| 6815 | xft_settings_event (dpyinfo, event); | 6878 | xft_settings_event (dpyinfo, event); |
| @@ -6981,7 +7044,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 6981 | 7044 | ||
| 6982 | case KeyPress: | 7045 | case KeyPress: |
| 6983 | 7046 | ||
| 6984 | dpyinfo->last_user_time = event->xkey.time; | 7047 | x_display_set_last_user_time (dpyinfo, event->xkey.time); |
| 6985 | ignore_next_mouse_click_timeout = 0; | 7048 | ignore_next_mouse_click_timeout = 0; |
| 6986 | 7049 | ||
| 6987 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 7050 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| @@ -7315,7 +7378,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7315 | #endif | 7378 | #endif |
| 7316 | 7379 | ||
| 7317 | case KeyRelease: | 7380 | case KeyRelease: |
| 7318 | dpyinfo->last_user_time = event->xkey.time; | 7381 | x_display_set_last_user_time (dpyinfo, event->xkey.time); |
| 7319 | #ifdef HAVE_X_I18N | 7382 | #ifdef HAVE_X_I18N |
| 7320 | /* Don't dispatch this event since XtDispatchEvent calls | 7383 | /* Don't dispatch this event since XtDispatchEvent calls |
| 7321 | XFilterEvent, and two calls in a row may freeze the | 7384 | XFilterEvent, and two calls in a row may freeze the |
| @@ -7326,7 +7389,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7326 | #endif | 7389 | #endif |
| 7327 | 7390 | ||
| 7328 | case EnterNotify: | 7391 | case EnterNotify: |
| 7329 | dpyinfo->last_user_time = event->xcrossing.time; | 7392 | x_display_set_last_user_time (dpyinfo, event->xcrossing.time); |
| 7330 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | 7393 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 7331 | 7394 | ||
| 7332 | f = any; | 7395 | f = any; |
| @@ -7351,7 +7414,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7351 | goto OTHER; | 7414 | goto OTHER; |
| 7352 | 7415 | ||
| 7353 | case LeaveNotify: | 7416 | case LeaveNotify: |
| 7354 | dpyinfo->last_user_time = event->xcrossing.time; | 7417 | x_display_set_last_user_time (dpyinfo, event->xcrossing.time); |
| 7355 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); | 7418 | x_detect_focus_change (dpyinfo, any, event, &inev.ie); |
| 7356 | 7419 | ||
| 7357 | f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); | 7420 | f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); |
| @@ -7385,7 +7448,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7385 | 7448 | ||
| 7386 | case MotionNotify: | 7449 | case MotionNotify: |
| 7387 | { | 7450 | { |
| 7388 | dpyinfo->last_user_time = event->xmotion.time; | 7451 | x_display_set_last_user_time (dpyinfo, event->xmotion.time); |
| 7389 | previous_help_echo_string = help_echo_string; | 7452 | previous_help_echo_string = help_echo_string; |
| 7390 | help_echo_string = Qnil; | 7453 | help_echo_string = Qnil; |
| 7391 | 7454 | ||
| @@ -7497,9 +7560,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7497 | SET_FRAME_GARBAGED (f); | 7560 | SET_FRAME_GARBAGED (f); |
| 7498 | cancel_mouse_face (f); | 7561 | cancel_mouse_face (f); |
| 7499 | } | 7562 | } |
| 7500 | |||
| 7501 | /** FRAME_PIXEL_WIDTH (f) = event->xconfigure.width; **/ | ||
| 7502 | /** FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height; **/ | ||
| 7503 | #endif /* not USE_GTK */ | 7563 | #endif /* not USE_GTK */ |
| 7504 | #endif | 7564 | #endif |
| 7505 | 7565 | ||
| @@ -7528,7 +7588,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 7528 | 7588 | ||
| 7529 | memset (&compose_status, 0, sizeof (compose_status)); | 7589 | memset (&compose_status, 0, sizeof (compose_status)); |
| 7530 | dpyinfo->last_mouse_glyph_frame = NULL; | 7590 | dpyinfo->last_mouse_glyph_frame = NULL; |
| 7531 | dpyinfo->last_user_time = event->xbutton.time; | 7591 | x_display_set_last_user_time (dpyinfo, event->xbutton.time); |
| 7532 | 7592 | ||
| 7533 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame | 7593 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 7534 | : x_window_to_frame (dpyinfo, event->xbutton.window)); | 7594 | : x_window_to_frame (dpyinfo, event->xbutton.window)); |
| @@ -7917,6 +7977,15 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) | |||
| 7917 | GCForeground, &xgcv); | 7977 | GCForeground, &xgcv); |
| 7918 | gc = dpyinfo->scratch_cursor_gc; | 7978 | gc = dpyinfo->scratch_cursor_gc; |
| 7919 | 7979 | ||
| 7980 | /* When on R2L character, show cursor at the right edge of the | ||
| 7981 | glyph, unless the cursor box is as wide as the glyph or wider | ||
| 7982 | (the latter happens when x-stretch-cursor is non-nil). */ | ||
| 7983 | if ((cursor_glyph->resolved_level & 1) != 0 | ||
| 7984 | && cursor_glyph->pixel_width > w->phys_cursor_width) | ||
| 7985 | { | ||
| 7986 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 7987 | wd -= 1; | ||
| 7988 | } | ||
| 7920 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 7989 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 7921 | x_clip_to_row (w, row, TEXT_AREA, gc); | 7990 | x_clip_to_row (w, row, TEXT_AREA, gc); |
| 7922 | XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1); | 7991 | XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h - 1); |
| @@ -8002,9 +8071,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 8002 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 8071 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 8003 | width, row->height); | 8072 | width, row->height); |
| 8004 | } | 8073 | } |
| 8005 | else | 8074 | else /* HBAR_CURSOR */ |
| 8006 | { | 8075 | { |
| 8007 | int dummy_x, dummy_y, dummy_h; | 8076 | int dummy_x, dummy_y, dummy_h; |
| 8077 | int x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | ||
| 8008 | 8078 | ||
| 8009 | if (width < 0) | 8079 | if (width < 0) |
| 8010 | width = row->height; | 8080 | width = row->height; |
| @@ -8014,8 +8084,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 8014 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, | 8084 | get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x, |
| 8015 | &dummy_y, &dummy_h); | 8085 | &dummy_y, &dummy_h); |
| 8016 | 8086 | ||
| 8017 | XFillRectangle (dpy, window, gc, | 8087 | if ((cursor_glyph->resolved_level & 1) != 0 |
| 8018 | WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), | 8088 | && cursor_glyph->pixel_width > w->phys_cursor_width) |
| 8089 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | ||
| 8090 | XFillRectangle (dpy, window, gc, x, | ||
| 8019 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 8091 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 8020 | row->height - width), | 8092 | row->height - width), |
| 8021 | w->phys_cursor_width, width); | 8093 | w->phys_cursor_width, width); |
| @@ -8571,8 +8643,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 8571 | FRAME_COLUMN_WIDTH (f) = font->average_width; | 8643 | FRAME_COLUMN_WIDTH (f) = font->average_width; |
| 8572 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font); | 8644 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font); |
| 8573 | 8645 | ||
| 8574 | #ifndef USE_X_TOOLKIT \ | 8646 | #ifndef USE_X_TOOLKIT |
| 8575 | /** FRAME_TOOL_BAR_HEIGHT (f) = FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); **/ | ||
| 8576 | FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); | 8647 | FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); |
| 8577 | #endif | 8648 | #endif |
| 8578 | 8649 | ||
| @@ -9415,18 +9486,6 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height, | |||
| 9415 | { | 9486 | { |
| 9416 | int pixelwidth, pixelheight; | 9487 | int pixelwidth, pixelheight; |
| 9417 | 9488 | ||
| 9418 | /** if (pixelwise) **/ | ||
| 9419 | /** { **/ | ||
| 9420 | /** pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); **/ | ||
| 9421 | /** pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); **/ | ||
| 9422 | /** } **/ | ||
| 9423 | /** else **/ | ||
| 9424 | /** { **/ | ||
| 9425 | /** pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); **/ | ||
| 9426 | /** pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); **/ | ||
| 9427 | /** } **/ | ||
| 9428 | |||
| 9429 | /** FRAME_TOOL_BAR_HEIGHT (f) = FRAME_TOOLBAR_HEIGHT (f); **/ | ||
| 9430 | pixelwidth = (pixelwise | 9489 | pixelwidth = (pixelwise |
| 9431 | ? FRAME_TEXT_TO_PIXEL_WIDTH (f, width) | 9490 | ? FRAME_TEXT_TO_PIXEL_WIDTH (f, width) |
| 9432 | : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width)); | 9491 | : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width)); |
| @@ -9434,16 +9493,6 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int width, int height, | |||
| 9434 | ? FRAME_TEXT_TO_PIXEL_HEIGHT (f, height) | 9493 | ? FRAME_TEXT_TO_PIXEL_HEIGHT (f, height) |
| 9435 | : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height))); | 9494 | : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height))); |
| 9436 | 9495 | ||
| 9437 | /** pixelwidth = ((pixelwise ? width : (width * FRAME_COLUMN_WIDTH (f))) **/ | ||
| 9438 | /** + FRAME_SCROLL_BAR_AREA_WIDTH (f) **/ | ||
| 9439 | /** + FRAME_TOTAL_FRINGE_WIDTH (f) **/ | ||
| 9440 | /** + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); **/ | ||
| 9441 | |||
| 9442 | /** pixelheight = ((pixelwise ? height : (height * FRAME_LINE_HEIGHT (f))) **/ | ||
| 9443 | /** + FRAME_TOOLBAR_HEIGHT (f) **/ | ||
| 9444 | /** + FRAME_SCROLL_BAR_AREA_HEIGHT (f) **/ | ||
| 9445 | /** + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); **/ | ||
| 9446 | |||
| 9447 | if (change_gravity) f->win_gravity = NorthWestGravity; | 9496 | if (change_gravity) f->win_gravity = NorthWestGravity; |
| 9448 | x_wm_set_size_hint (f, 0, 0); | 9497 | x_wm_set_size_hint (f, 0, 0); |
| 9449 | XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), | 9498 | XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), |
| @@ -10617,7 +10666,6 @@ static unsigned x_display_id; | |||
| 10617 | struct x_display_info * | 10666 | struct x_display_info * |
| 10618 | x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | 10667 | x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) |
| 10619 | { | 10668 | { |
| 10620 | int connection; | ||
| 10621 | Display *dpy; | 10669 | Display *dpy; |
| 10622 | struct terminal *terminal; | 10670 | struct terminal *terminal; |
| 10623 | struct x_display_info *dpyinfo; | 10671 | struct x_display_info *dpyinfo; |
| @@ -10669,10 +10717,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10669 | 10717 | ||
| 10670 | XSetLocaleModifiers (""); | 10718 | XSetLocaleModifiers (""); |
| 10671 | 10719 | ||
| 10672 | /* Emacs can only handle core input events, so make sure | ||
| 10673 | Gtk doesn't use Xinput or Xinput2 extensions. */ | ||
| 10674 | xputenv ("GDK_CORE_DEVICE_EVENTS=1"); | ||
| 10675 | |||
| 10676 | /* Work around GLib bug that outputs a faulty warning. See | 10720 | /* Work around GLib bug that outputs a faulty warning. See |
| 10677 | https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ | 10721 | https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ |
| 10678 | id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | 10722 | id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL |
| @@ -10831,8 +10875,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10831 | dpyinfo->x_id = ++x_display_id; | 10875 | dpyinfo->x_id = ++x_display_id; |
| 10832 | dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) | 10876 | dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name) |
| 10833 | + SBYTES (Vsystem_name) + 2); | 10877 | + SBYTES (Vsystem_name) + 2); |
| 10834 | strcat (strcat (strcpy (dpyinfo->x_id_name, SSDATA (Vinvocation_name)), "@"), | 10878 | char *nametail = lispstpcpy (dpyinfo->x_id_name, Vinvocation_name); |
| 10835 | SSDATA (Vsystem_name)); | 10879 | *nametail++ = '@'; |
| 10880 | lispstpcpy (nametail, Vsystem_name); | ||
| 10836 | 10881 | ||
| 10837 | /* Figure out which modifier bits mean what. */ | 10882 | /* Figure out which modifier bits mean what. */ |
| 10838 | x_find_modifier_meanings (dpyinfo); | 10883 | x_find_modifier_meanings (dpyinfo); |
| @@ -10886,11 +10931,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 10886 | { | 10931 | { |
| 10887 | if (dpyinfo->visual->class == PseudoColor) | 10932 | if (dpyinfo->visual->class == PseudoColor) |
| 10888 | { | 10933 | { |
| 10889 | Lisp_Object value; | 10934 | AUTO_STRING (privateColormap, "privateColormap"); |
| 10890 | value = display_x_get_resource (dpyinfo, | 10935 | AUTO_STRING (PrivateColormap, "PrivateColormap"); |
| 10891 | build_string ("privateColormap"), | 10936 | Lisp_Object value |
| 10892 | build_string ("PrivateColormap"), | 10937 | = display_x_get_resource (dpyinfo, privateColormap, |
| 10893 | Qnil, Qnil); | 10938 | PrivateColormap, Qnil, Qnil); |
| 10894 | if (STRINGP (value) | 10939 | if (STRINGP (value) |
| 10895 | && (!strcmp (SSDATA (value), "true") | 10940 | && (!strcmp (SSDATA (value), "true") |
| 10896 | || !strcmp (SSDATA (value), "on"))) | 10941 | || !strcmp (SSDATA (value), "on"))) |
| @@ -11014,11 +11059,11 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11014 | }; | 11059 | }; |
| 11015 | 11060 | ||
| 11016 | int i; | 11061 | int i; |
| 11017 | const int atom_count = ARRAYELTS (atom_refs); | 11062 | enum { atom_count = ARRAYELTS (atom_refs) }; |
| 11018 | /* 1 for _XSETTINGS_SN */ | 11063 | /* 1 for _XSETTINGS_SN. */ |
| 11019 | const int total_atom_count = 1 + atom_count; | 11064 | enum { total_atom_count = 1 + atom_count }; |
| 11020 | Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return); | 11065 | Atom atoms_return[total_atom_count]; |
| 11021 | char **atom_names = xmalloc (total_atom_count * sizeof *atom_names); | 11066 | char *atom_names[total_atom_count]; |
| 11022 | static char const xsettings_fmt[] = "_XSETTINGS_S%d"; | 11067 | static char const xsettings_fmt[] = "_XSETTINGS_S%d"; |
| 11023 | char xsettings_atom_name[sizeof xsettings_fmt - 2 | 11068 | char xsettings_atom_name[sizeof xsettings_fmt - 2 |
| 11024 | + INT_STRLEN_BOUND (int)]; | 11069 | + INT_STRLEN_BOUND (int)]; |
| @@ -11026,7 +11071,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11026 | for (i = 0; i < atom_count; i++) | 11071 | for (i = 0; i < atom_count; i++) |
| 11027 | atom_names[i] = (char *) atom_refs[i].name; | 11072 | atom_names[i] = (char *) atom_refs[i].name; |
| 11028 | 11073 | ||
| 11029 | /* Build _XSETTINGS_SN atom name */ | 11074 | /* Build _XSETTINGS_SN atom name. */ |
| 11030 | sprintf (xsettings_atom_name, xsettings_fmt, | 11075 | sprintf (xsettings_atom_name, xsettings_fmt, |
| 11031 | XScreenNumberOfScreen (dpyinfo->screen)); | 11076 | XScreenNumberOfScreen (dpyinfo->screen)); |
| 11032 | atom_names[i] = xsettings_atom_name; | 11077 | atom_names[i] = xsettings_atom_name; |
| @@ -11037,11 +11082,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11037 | for (i = 0; i < atom_count; i++) | 11082 | for (i = 0; i < atom_count; i++) |
| 11038 | *(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i]; | 11083 | *(Atom *) ((char *) dpyinfo + atom_refs[i].offset) = atoms_return[i]; |
| 11039 | 11084 | ||
| 11040 | /* Manual copy of last atom */ | 11085 | /* Manually copy last atom. */ |
| 11041 | dpyinfo->Xatom_xsettings_sel = atoms_return[i]; | 11086 | dpyinfo->Xatom_xsettings_sel = atoms_return[i]; |
| 11042 | |||
| 11043 | xfree (atom_names); | ||
| 11044 | xfree (atoms_return); | ||
| 11045 | } | 11087 | } |
| 11046 | 11088 | ||
| 11047 | dpyinfo->x_dnd_atoms_size = 8; | 11089 | dpyinfo->x_dnd_atoms_size = 8; |
| @@ -11060,22 +11102,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11060 | 11102 | ||
| 11061 | xsettings_initialize (dpyinfo); | 11103 | xsettings_initialize (dpyinfo); |
| 11062 | 11104 | ||
| 11063 | connection = ConnectionNumber (dpyinfo->display); | ||
| 11064 | |||
| 11065 | /* This is only needed for distinguishing keyboard and process input. */ | 11105 | /* This is only needed for distinguishing keyboard and process input. */ |
| 11066 | if (connection != 0) | 11106 | if (dpyinfo->connection != 0) |
| 11067 | add_keyboard_wait_descriptor (connection); | 11107 | add_keyboard_wait_descriptor (dpyinfo->connection); |
| 11068 | 11108 | ||
| 11069 | #ifdef F_SETOWN | 11109 | #ifdef F_SETOWN |
| 11070 | fcntl (connection, F_SETOWN, getpid ()); | 11110 | fcntl (dpyinfo->connection, F_SETOWN, getpid ()); |
| 11071 | #endif /* ! defined (F_SETOWN) */ | 11111 | #endif /* ! defined (F_SETOWN) */ |
| 11072 | 11112 | ||
| 11073 | if (interrupt_input) | 11113 | if (interrupt_input) |
| 11074 | init_sigio (connection); | 11114 | init_sigio (dpyinfo->connection); |
| 11075 | 11115 | ||
| 11076 | #ifdef USE_LUCID | 11116 | #ifdef USE_LUCID |
| 11077 | { | 11117 | { |
| 11078 | XFontStruct *xfont = NULL; | ||
| 11079 | XrmValue d, fr, to; | 11118 | XrmValue d, fr, to; |
| 11080 | Font font; | 11119 | Font font; |
| 11081 | 11120 | ||
| @@ -11089,10 +11128,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11089 | x_catch_errors (dpy); | 11128 | x_catch_errors (dpy); |
| 11090 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) | 11129 | if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) |
| 11091 | emacs_abort (); | 11130 | emacs_abort (); |
| 11092 | if (x_had_errors_p (dpy) || !((xfont = XQueryFont (dpy, font)))) | 11131 | if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) |
| 11093 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); | 11132 | XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); |
| 11094 | if (xfont) | 11133 | /* Do not free XFontStruct returned by the above call to XQueryFont. |
| 11095 | XFreeFont (dpy, xfont); | 11134 | This leads to X protocol errors at XtCloseDisplay (Bug#18403). */ |
| 11096 | x_uncatch_errors (); | 11135 | x_uncatch_errors (); |
| 11097 | } | 11136 | } |
| 11098 | #endif | 11137 | #endif |
| @@ -11100,11 +11139,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11100 | /* See if we should run in synchronous mode. This is useful | 11139 | /* See if we should run in synchronous mode. This is useful |
| 11101 | for debugging X code. */ | 11140 | for debugging X code. */ |
| 11102 | { | 11141 | { |
| 11103 | Lisp_Object value; | 11142 | AUTO_STRING (synchronous, "synchronous"); |
| 11104 | value = display_x_get_resource (dpyinfo, | 11143 | AUTO_STRING (Synchronous, "Synchronous"); |
| 11105 | build_string ("synchronous"), | 11144 | Lisp_Object value = display_x_get_resource (dpyinfo, synchronous, |
| 11106 | build_string ("Synchronous"), | 11145 | Synchronous, Qnil, Qnil); |
| 11107 | Qnil, Qnil); | ||
| 11108 | if (STRINGP (value) | 11146 | if (STRINGP (value) |
| 11109 | && (!strcmp (SSDATA (value), "true") | 11147 | && (!strcmp (SSDATA (value), "true") |
| 11110 | || !strcmp (SSDATA (value), "on"))) | 11148 | || !strcmp (SSDATA (value), "on"))) |
| @@ -11112,11 +11150,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11112 | } | 11150 | } |
| 11113 | 11151 | ||
| 11114 | { | 11152 | { |
| 11115 | Lisp_Object value; | 11153 | AUTO_STRING (useXIM, "useXIM"); |
| 11116 | value = display_x_get_resource (dpyinfo, | 11154 | AUTO_STRING (UseXIM, "UseXIM"); |
| 11117 | build_string ("useXIM"), | 11155 | Lisp_Object value = display_x_get_resource (dpyinfo, useXIM, UseXIM, |
| 11118 | build_string ("UseXIM"), | 11156 | Qnil, Qnil); |
| 11119 | Qnil, Qnil); | ||
| 11120 | #ifdef USE_XIM | 11157 | #ifdef USE_XIM |
| 11121 | if (STRINGP (value) | 11158 | if (STRINGP (value) |
| 11122 | && (!strcmp (SSDATA (value), "false") | 11159 | && (!strcmp (SSDATA (value), "false") |
| @@ -11133,8 +11170,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 11133 | #ifdef HAVE_X_SM | 11170 | #ifdef HAVE_X_SM |
| 11134 | /* Only do this for the very first display in the Emacs session. | 11171 | /* Only do this for the very first display in the Emacs session. |
| 11135 | Ignore X session management when Emacs was first started on a | 11172 | Ignore X session management when Emacs was first started on a |
| 11136 | tty. */ | 11173 | tty or started as a daemon. */ |
| 11137 | if (terminal->id == 1) | 11174 | if (terminal->id == 1 && ! IS_DAEMON) |
| 11138 | x_session_initialize (dpyinfo); | 11175 | x_session_initialize (dpyinfo); |
| 11139 | #endif | 11176 | #endif |
| 11140 | 11177 | ||
| @@ -11325,18 +11362,17 @@ x_delete_terminal (struct terminal *terminal) | |||
| 11325 | XCloseDisplay (dpyinfo->display); | 11362 | XCloseDisplay (dpyinfo->display); |
| 11326 | #endif | 11363 | #endif |
| 11327 | #endif /* ! USE_GTK */ | 11364 | #endif /* ! USE_GTK */ |
| 11328 | } | ||
| 11329 | 11365 | ||
| 11330 | /* No more input on this descriptor. */ | 11366 | /* No more input on this descriptor. Do not close it because |
| 11331 | if (0 <= dpyinfo->connection) | 11367 | it's already closed by X(t)CloseDisplay (Bug#18403). */ |
| 11332 | { | 11368 | eassert (0 <= dpyinfo->connection); |
| 11333 | delete_keyboard_wait_descriptor (dpyinfo->connection); | 11369 | delete_keyboard_wait_descriptor (dpyinfo->connection); |
| 11334 | emacs_close (dpyinfo->connection); | 11370 | |
| 11371 | /* Mark as dead. */ | ||
| 11372 | dpyinfo->display = NULL; | ||
| 11373 | dpyinfo->connection = -1; | ||
| 11335 | } | 11374 | } |
| 11336 | 11375 | ||
| 11337 | /* Mark as dead. */ | ||
| 11338 | dpyinfo->display = NULL; | ||
| 11339 | dpyinfo->connection = -1; | ||
| 11340 | x_delete_display (dpyinfo); | 11376 | x_delete_display (dpyinfo); |
| 11341 | unblock_input (); | 11377 | unblock_input (); |
| 11342 | } | 11378 | } |
| @@ -11430,6 +11466,15 @@ x_initialize (void) | |||
| 11430 | XSetIOErrorHandler (x_io_error_quitter); | 11466 | XSetIOErrorHandler (x_io_error_quitter); |
| 11431 | } | 11467 | } |
| 11432 | 11468 | ||
| 11469 | #ifdef USE_GTK | ||
| 11470 | void | ||
| 11471 | init_xterm (void) | ||
| 11472 | { | ||
| 11473 | /* Emacs can handle only core input events, so make sure | ||
| 11474 | Gtk doesn't use Xinput or Xinput2 extensions. */ | ||
| 11475 | xputenv ("GDK_CORE_DEVICE_EVENTS=1"); | ||
| 11476 | } | ||
| 11477 | #endif | ||
| 11433 | 11478 | ||
| 11434 | void | 11479 | void |
| 11435 | syms_of_xterm (void) | 11480 | syms_of_xterm (void) |