comparison src/scrollbar-x.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents b8cc9ab3f761
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
25 25
26 #include <config.h> 26 #include <config.h>
27 #include "lisp.h" 27 #include "lisp.h"
28 28
29 #include "console-x.h" 29 #include "console-x.h"
30 #include "EmacsFrame.h"
31 #include "glyphs-x.h" 30 #include "glyphs-x.h"
32 #include "gui-x.h" 31 #include "gui-x.h"
33 #include "scrollbar-x.h" 32 #include "scrollbar-x.h"
34 33
35 #include "frame.h" 34 #include "frame.h"
213 wv = xmalloc_widget_value (); 212 wv = xmalloc_widget_value ();
214 /* #### maybe should add malloc_scrollbar_values to resource these? */ 213 /* #### maybe should add malloc_scrollbar_values to resource these? */
215 wv->scrollbar_data = xnew (scrollbar_values); 214 wv->scrollbar_data = xnew (scrollbar_values);
216 215
217 wv->name = SCROLLBAR_X_NAME (instance); 216 wv->name = SCROLLBAR_X_NAME (instance);
218 wv->name = xstrdup (wv->name);
219 wv->value = 0; 217 wv->value = 0;
220 wv->key = 0; 218 wv->key = 0;
221 wv->enabled = instance->scrollbar_is_active; 219 wv->enabled = instance->scrollbar_is_active;
222 wv->selected = 0; 220 wv->selected = 0;
223 wv->call_data = NULL; 221 wv->call_data = NULL;
277 } 275 }
278 } 276 }
279 } 277 }
280 278
281 if (!wv->scrollbar_data) abort (); 279 if (!wv->scrollbar_data) abort ();
282 free_widget_value_tree (wv); 280 xfree (wv->scrollbar_data);
281 wv->scrollbar_data = 0;
282 free_widget_value (wv);
283 } 283 }
284 else if (managed) 284 else if (managed)
285 { 285 {
286 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) 286 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID)
287 /* This isn't needed with Athena Scrollbars. It might not be needed */ 287 /* This isn't needed with Athena Scrollbars. It might not be needed */
404 404
405 if (!f) 405 if (!f)
406 return; 406 return;
407 407
408 mirror = find_scrollbar_window_mirror (f, id); 408 mirror = find_scrollbar_window_mirror (f, id);
409 if (!mirror)
410 return;
411
412 win = real_window (mirror, 1); 409 win = real_window (mirror, 1);
413 410
414 if (NILP (win)) 411 if (NILP (win))
415 return; 412 return;
416 instance = mirror->scrollbar_vertical_instance; 413 instance = mirror->scrollbar_vertical_instance;
610 607
611 if (!f) 608 if (!f)
612 return; 609 return;
613 610
614 mirror = find_scrollbar_window_mirror (f, id); 611 mirror = find_scrollbar_window_mirror (f, id);
615 if (!mirror)
616 return;
617
618 win = real_window (mirror, 1); 612 win = real_window (mirror, 1);
619 613
620 if (NILP (win)) 614 if (NILP (win))
621 return; 615 return;
622 frame = WINDOW_FRAME (XWINDOW (win)); 616 frame = WINDOW_FRAME (XWINDOW (win));
676 XSETWINDOW (window, w); 670 XSETWINDOW (window, w);
677 x_scrollbar_loop (X_SET_SCROLLBAR_POINTER, window, find_window_mirror (w), 671 x_scrollbar_loop (X_SET_SCROLLBAR_POINTER, window, find_window_mirror (w),
678 0, (Window) NULL); 672 0, (Window) NULL);
679 } 673 }
680 674
675 /* Called directly from x_any_window_to_frame in frame-x.c */
676 EMACS_INT
677 x_window_is_scrollbar (struct frame *f, Window win)
678 {
679 if (!FRAME_X_P (f))
680 return 0;
681
682 if (f->mirror_dirty)
683 update_frame_window_mirror (f);
684 return (EMACS_INT) x_scrollbar_loop (X_WINDOW_IS_SCROLLBAR, f->root_window,
685 f->root_mirror, 0, win);
686 }
687
681 /* Make sure that all scrollbars on frame are up-to-date. Called 688 /* Make sure that all scrollbars on frame are up-to-date. Called
682 directly from x_set_frame_properties in frame-x.c*/ 689 directly from x_set_frame_properties in frame-x.c*/
683 void 690 void
684 x_update_frame_scrollbars (struct frame *f) 691 x_update_frame_scrollbars (struct frame *f)
685 { 692 {
736 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage); 743 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage);
737 #endif /* MEMORY_USAGE_STATS */ 744 #endif /* MEMORY_USAGE_STATS */
738 } 745 }
739 746
740 void 747 void
741 reinit_vars_of_scrollbar_x (void)
742 {
743 stupid_vertical_scrollbar_drag_hack = 1;
744 }
745
746 void
747 vars_of_scrollbar_x (void) 748 vars_of_scrollbar_x (void)
748 { 749 {
749 reinit_vars_of_scrollbar_x ();
750
751 #if defined (LWLIB_SCROLLBARS_LUCID) 750 #if defined (LWLIB_SCROLLBARS_LUCID)
752 Fprovide (intern ("lucid-scrollbars")); 751 Fprovide (intern ("lucid-scrollbars"));
753 #elif defined (LWLIB_SCROLLBARS_MOTIF) 752 #elif defined (LWLIB_SCROLLBARS_MOTIF)
754 Fprovide (intern ("motif-scrollbars")); 753 Fprovide (intern ("motif-scrollbars"));
755 #elif defined (LWLIB_SCROLLBARS_ATHENA) 754 #elif defined (LWLIB_SCROLLBARS_ATHENA)
756 Fprovide (intern ("athena-scrollbars")); 755 Fprovide (intern ("athena-scrollbars"));
757 #endif 756 #endif
758 } 757 stupid_vertical_scrollbar_drag_hack = 1;
758 }