comparison src/scrollbar-x.c @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children b8cc9ab3f761
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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"
30 #include "glyphs-x.h" 31 #include "glyphs-x.h"
31 #include "gui-x.h" 32 #include "gui-x.h"
32 #include "scrollbar-x.h" 33 #include "scrollbar-x.h"
33 34
34 #include "frame.h" 35 #include "frame.h"
212 wv = xmalloc_widget_value (); 213 wv = xmalloc_widget_value ();
213 /* #### maybe should add malloc_scrollbar_values to resource these? */ 214 /* #### maybe should add malloc_scrollbar_values to resource these? */
214 wv->scrollbar_data = xnew (scrollbar_values); 215 wv->scrollbar_data = xnew (scrollbar_values);
215 216
216 wv->name = SCROLLBAR_X_NAME (instance); 217 wv->name = SCROLLBAR_X_NAME (instance);
218 wv->name = xstrdup (wv->name);
217 wv->value = 0; 219 wv->value = 0;
218 wv->key = 0; 220 wv->key = 0;
219 wv->enabled = instance->scrollbar_is_active; 221 wv->enabled = instance->scrollbar_is_active;
220 wv->selected = 0; 222 wv->selected = 0;
221 wv->call_data = NULL; 223 wv->call_data = NULL;
275 } 277 }
276 } 278 }
277 } 279 }
278 280
279 if (!wv->scrollbar_data) abort (); 281 if (!wv->scrollbar_data) abort ();
280 xfree (wv->scrollbar_data); 282 free_widget_value_tree (wv);
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 */
670 XSETWINDOW (window, w); 670 XSETWINDOW (window, w);
671 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),
672 0, (Window) NULL); 672 0, (Window) NULL);
673 } 673 }
674 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
688 /* Make sure that all scrollbars on frame are up-to-date. Called 675 /* Make sure that all scrollbars on frame are up-to-date. Called
689 directly from x_set_frame_properties in frame-x.c*/ 676 directly from x_set_frame_properties in frame-x.c*/
690 void 677 void
691 x_update_frame_scrollbars (struct frame *f) 678 x_update_frame_scrollbars (struct frame *f)
692 { 679 {
743 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage); 730 CONSOLE_HAS_METHOD (x, compute_scrollbar_instance_usage);
744 #endif /* MEMORY_USAGE_STATS */ 731 #endif /* MEMORY_USAGE_STATS */
745 } 732 }
746 733
747 void 734 void
735 reinit_vars_of_scrollbar_x (void)
736 {
737 stupid_vertical_scrollbar_drag_hack = 1;
738 }
739
740 void
748 vars_of_scrollbar_x (void) 741 vars_of_scrollbar_x (void)
749 { 742 {
743 reinit_vars_of_scrollbar_x ();
744
750 #if defined (LWLIB_SCROLLBARS_LUCID) 745 #if defined (LWLIB_SCROLLBARS_LUCID)
751 Fprovide (intern ("lucid-scrollbars")); 746 Fprovide (intern ("lucid-scrollbars"));
752 #elif defined (LWLIB_SCROLLBARS_MOTIF) 747 #elif defined (LWLIB_SCROLLBARS_MOTIF)
753 Fprovide (intern ("motif-scrollbars")); 748 Fprovide (intern ("motif-scrollbars"));
754 #elif defined (LWLIB_SCROLLBARS_ATHENA) 749 #elif defined (LWLIB_SCROLLBARS_ATHENA)
755 Fprovide (intern ("athena-scrollbars")); 750 Fprovide (intern ("athena-scrollbars"));
756 #endif 751 #endif
757 stupid_vertical_scrollbar_drag_hack = 1; 752 }
758 }