comparison src/xterm.c @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents a4d0ee33dcce
children 834df49192b0
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
8781 struct scroll_bar *bar = (struct scroll_bar *) data; 8781 struct scroll_bar *bar = (struct scroll_bar *) data;
8782 gdouble previous; 8782 gdouble previous;
8783 gdouble position; 8783 gdouble position;
8784 gdouble *p; 8784 gdouble *p;
8785 int diff; 8785 int diff;
8786 8786
8787 int part = -1, whole = 0, portion = 0; 8787 int part = -1, whole = 0, portion = 0;
8788 GtkAdjustment *adj = GTK_ADJUSTMENT (widget); 8788 GtkAdjustment *adj = GTK_ADJUSTMENT (widget);
8789 8789
8790 if (xg_ignore_gtk_scrollbar) return; 8790 if (xg_ignore_gtk_scrollbar) return;
8791 8791
8792 position = gtk_adjustment_get_value (adj); 8792 position = gtk_adjustment_get_value (adj);
8793 8793
8794 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); 8794 p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA);
8795 if (! p) 8795 if (! p)
8796 { 8796 {
8801 8801
8802 previous = *p; 8802 previous = *p;
8803 *p = position; 8803 *p = position;
8804 8804
8805 diff = (int) (position - previous); 8805 diff = (int) (position - previous);
8806 8806
8807 if (diff == (int) adj->step_increment) 8807 if (diff == (int) adj->step_increment)
8808 { 8808 {
8809 part = scroll_bar_down_arrow; 8809 part = scroll_bar_down_arrow;
8810 bar->dragging = Qnil; 8810 bar->dragging = Qnil;
8811 } 8811 }
8829 part = scroll_bar_handle; 8829 part = scroll_bar_handle;
8830 whole = adj->upper - adj->page_size; 8830 whole = adj->upper - adj->page_size;
8831 portion = min (position, whole); 8831 portion = min (position, whole);
8832 bar->dragging = make_number (portion); 8832 bar->dragging = make_number (portion);
8833 } 8833 }
8834 8834
8835 if (part >= 0) 8835 if (part >= 0)
8836 { 8836 {
8837 xg_ignore_next_thumb = 1; 8837 xg_ignore_next_thumb = 1;
8838 window_being_scrolled = bar->window; 8838 window_being_scrolled = bar->window;
8839 last_scroll_bar_part = part; 8839 last_scroll_bar_part = part;
10219 EVENT is the X event to filter. 10219 EVENT is the X event to filter.
10220 10220
10221 Returns non-zero if the event was filtered, caller shall not process 10221 Returns non-zero if the event was filtered, caller shall not process
10222 this event further. 10222 this event further.
10223 Returns zero if event is wasn't filtered. */ 10223 Returns zero if event is wasn't filtered. */
10224 10224
10225 #ifdef HAVE_X_I18N 10225 #ifdef HAVE_X_I18N
10226 static int 10226 static int
10227 x_filter_event (dpyinfo, event) 10227 x_filter_event (dpyinfo, event)
10228 struct x_display_info *dpyinfo; 10228 struct x_display_info *dpyinfo;
10229 XEvent *event; 10229 XEvent *event;
10284 } 10284 }
10285 #endif /* USE_GTK */ 10285 #endif /* USE_GTK */
10286 10286
10287 10287
10288 /* Handles the XEvent EVENT on display DPYINFO. 10288 /* Handles the XEvent EVENT on display DPYINFO.
10289 10289
10290 *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events. 10290 *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events.
10291 *FINISH is zero if caller should continue reading events. 10291 *FINISH is zero if caller should continue reading events.
10292 *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. 10292 *FINISH is X_EVENT_DROP if event should not be passed to the toolkit.
10293 10293
10294 Events representing keys are stored in buffer *BUFP_R, 10294 Events representing keys are stored in buffer *BUFP_R,
10295 which can hold up to *NUMCHARSP characters. 10295 which can hold up to *NUMCHARSP characters.
10296 We return the number of characters stored into the buffer. */ 10296 We return the number of characters stored into the buffer. */
10297 10297
10298 static int 10298 static int
10299 handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) 10299 handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
10300 struct x_display_info *dpyinfo; 10300 struct x_display_info *dpyinfo;
10301 XEvent *eventp; 10301 XEvent *eventp;
10302 /* register */ struct input_event **bufp_r; 10302 /* register */ struct input_event **bufp_r;
10310 struct input_event *bufp = *bufp_r; 10310 struct input_event *bufp = *bufp_r;
10311 int numchars = *numcharsp; 10311 int numchars = *numcharsp;
10312 XEvent event = *eventp; 10312 XEvent event = *eventp;
10313 10313
10314 *finish = X_EVENT_NORMAL; 10314 *finish = X_EVENT_NORMAL;
10315 10315
10316 switch (event.type) 10316 switch (event.type)
10317 { 10317 {
10318 case ClientMessage: 10318 case ClientMessage:
10319 { 10319 {
10320 if (event.xclient.message_type 10320 if (event.xclient.message_type
11539 #endif /* USE_X_TOOLKIT */ 11539 #endif /* USE_X_TOOLKIT */
11540 break; 11540 break;
11541 } 11541 }
11542 11542
11543 goto ret; 11543 goto ret;
11544 11544
11545 out: 11545 out:
11546 *finish = X_EVENT_GOTO_OUT; 11546 *finish = X_EVENT_GOTO_OUT;
11547 11547
11548 ret: 11548 ret:
11549 *bufp_r = bufp; 11549 *bufp_r = bufp;
11550 *numcharsp = numchars; 11550 *numcharsp = numchars;
11551 *eventp = event; 11551 *eventp = event;
11552 11552
11553 return count; 11553 return count;
11554 } 11554 }
11555 11555
11556 11556
11557 /* Handles the XEvent EVENT on display DISPLAY. 11557 /* Handles the XEvent EVENT on display DISPLAY.
11567 struct x_display_info *dpyinfo; 11567 struct x_display_info *dpyinfo;
11568 struct input_event bufp[10]; 11568 struct input_event bufp[10];
11569 struct input_event *bufpp = bufp; 11569 struct input_event *bufpp = bufp;
11570 int numchars = 10; 11570 int numchars = 10;
11571 int finish = X_EVENT_NORMAL; 11571 int finish = X_EVENT_NORMAL;
11572 11572
11573 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) 11573 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
11574 if (dpyinfo->display == display) 11574 if (dpyinfo->display == display)
11575 break; 11575 break;
11576 11576
11577 if (dpyinfo) 11577 if (dpyinfo)
11578 { 11578 {
11579 int i, events; 11579 int i, events;
11580 events = handle_one_xevent (dpyinfo, 11580 events = handle_one_xevent (dpyinfo,
11581 event, 11581 event,
11679 /* For GTK we must use the GTK event loop. But XEvents gets passed 11679 /* For GTK we must use the GTK event loop. But XEvents gets passed
11680 to our filter function above, and then to the big event switch. 11680 to our filter function above, and then to the big event switch.
11681 We use a bunch of globals to communicate with our filter function, 11681 We use a bunch of globals to communicate with our filter function,
11682 that is kind of ugly, but it works. */ 11682 that is kind of ugly, but it works. */
11683 current_dpyinfo = dpyinfo; 11683 current_dpyinfo = dpyinfo;
11684 11684
11685 while (gtk_events_pending ()) 11685 while (gtk_events_pending ())
11686 { 11686 {
11687 static int nr = 0; 11687 static int nr = 0;
11688 current_count = count; 11688 current_count = count;
11689 current_numcharsp = &numchars; 11689 current_numcharsp = &numchars;
11701 11701
11702 #else /* not USE_GTK */ 11702 #else /* not USE_GTK */
11703 while (XPending (dpyinfo->display)) 11703 while (XPending (dpyinfo->display))
11704 { 11704 {
11705 int finish; 11705 int finish;
11706 11706
11707 XNextEvent (dpyinfo->display, &event); 11707 XNextEvent (dpyinfo->display, &event);
11708 11708
11709 #ifdef HAVE_X_I18N 11709 #ifdef HAVE_X_I18N
11710 /* Filter events for the current X input method. */ 11710 /* Filter events for the current X input method. */
11711 if (x_filter_event (dpyinfo, &event)) 11711 if (x_filter_event (dpyinfo, &event))
14103 gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); 14103 gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
14104 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow below */ 14104 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow below */
14105 FRAME_GTK_OUTER_WIDGET (f) = 0; 14105 FRAME_GTK_OUTER_WIDGET (f) = 0;
14106 } 14106 }
14107 #endif /* USE_GTK */ 14107 #endif /* USE_GTK */
14108 14108
14109 if (FRAME_X_WINDOW (f)) 14109 if (FRAME_X_WINDOW (f))
14110 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 14110 XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
14111 #endif /* !USE_X_TOOLKIT */ 14111 #endif /* !USE_X_TOOLKIT */
14112 14112
14113 unload_color (f, f->output_data.x->foreground_pixel); 14113 unload_color (f, f->output_data.x->foreground_pixel);
14206 #ifdef USE_X_TOOLKIT 14206 #ifdef USE_X_TOOLKIT
14207 Arg al[2]; 14207 Arg al[2];
14208 int ac = 0; 14208 int ac = 0;
14209 Dimension widget_width, widget_height; 14209 Dimension widget_width, widget_height;
14210 #endif 14210 #endif
14211 14211
14212 Window window = FRAME_OUTER_WINDOW (f); 14212 Window window = FRAME_OUTER_WINDOW (f);
14213 14213
14214 /* Setting PMaxSize caused various problems. */ 14214 /* Setting PMaxSize caused various problems. */
14215 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; 14215 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;
14216 14216
15196 argv[argc++] = SDATA (display_name); 15196 argv[argc++] = SDATA (display_name);
15197 } 15197 }
15198 15198
15199 argv[argc++] = "--name"; 15199 argv[argc++] = "--name";
15200 argv[argc++] = resource_name; 15200 argv[argc++] = resource_name;
15201 15201
15202 #ifdef HAVE_X11R5 15202 #ifdef HAVE_X11R5
15203 XSetLocaleModifiers (""); 15203 XSetLocaleModifiers ("");
15204 #endif 15204 #endif
15205 15205
15206 gtk_init (&argc, &argv2); 15206 gtk_init (&argc, &argv2);
15208 /* gtk_init does set_locale. We must fix locale after calling it. */ 15208 /* gtk_init does set_locale. We must fix locale after calling it. */
15209 fixup_locale (); 15209 fixup_locale ();
15210 xg_initialize (); 15210 xg_initialize ();
15211 15211
15212 dpy = GDK_DISPLAY (); 15212 dpy = GDK_DISPLAY ();
15213 15213
15214 /* NULL window -> events for all windows go to our function */ 15214 /* NULL window -> events for all windows go to our function */
15215 gdk_window_add_filter (NULL, event_handler_gdk, NULL); 15215 gdk_window_add_filter (NULL, event_handler_gdk, NULL);
15216 15216
15217 /* Load our own gtkrc if it exists. */ 15217 /* Load our own gtkrc if it exists. */
15218 { 15218 {
15224 s = make_string (file, strlen (file)); 15224 s = make_string (file, strlen (file));
15225 abs_file = Fexpand_file_name(s, Qnil); 15225 abs_file = Fexpand_file_name(s, Qnil);
15226 15226
15227 if (! NILP (abs_file) && Ffile_readable_p (abs_file)) 15227 if (! NILP (abs_file) && Ffile_readable_p (abs_file))
15228 gtk_rc_parse (SDATA (abs_file)); 15228 gtk_rc_parse (SDATA (abs_file));
15229 15229
15230 UNGCPRO; 15230 UNGCPRO;
15231 } 15231 }
15232 15232
15233 XSetErrorHandler (x_error_handler); 15233 XSetErrorHandler (x_error_handler);
15234 XSetIOErrorHandler (x_io_error_quitter); 15234 XSetIOErrorHandler (x_io_error_quitter);
15235 } 15235 }
15236 #else /* not USE_GTK */ 15236 #else /* not USE_GTK */
15237 #ifdef USE_X_TOOLKIT 15237 #ifdef USE_X_TOOLKIT