Mercurial > hg > xemacs-beta
comparison src/frame-gtk.c @ 2168:95fee4a1420e
[xemacs-hg @ 2004-07-07 12:00:58 by malcolmp]
Working GK tab_control widget. Other GTK widgets drawn with the correct
location and size.
author | malcolmp |
---|---|
date | Wed, 07 Jul 2004 12:01:07 +0000 |
parents | 91d4c8c65a0f |
children | 23d90a805259 |
comparison
equal
deleted
inserted
replaced
2167:54e1ecdc5778 | 2168:95fee4a1420e |
---|---|
1 /* Functions for the X window system. | 1 /* Functions for the GTK toolkit. |
2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. | 2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996, 2002, 2003 Ben Wing. | 3 Copyright (C) 1995, 1996, 2002, 2003 Ben Wing. |
4 | 4 |
5 This file is part of XEmacs. | 5 This file is part of XEmacs. |
6 | 6 |
37 | 37 |
38 #ifdef HAVE_DRAGNDROP | 38 #ifdef HAVE_DRAGNDROP |
39 #include "dragdrop.h" | 39 #include "dragdrop.h" |
40 #endif | 40 #endif |
41 | 41 |
42 #include "elhash.h" | |
42 #include "console-gtk-impl.h" | 43 #include "console-gtk-impl.h" |
43 #include "glyphs-gtk.h" | 44 #include "glyphs-gtk.h" |
44 #include "objects-gtk-impl.h" | 45 #include "objects-gtk-impl.h" |
45 #include "scrollbar-gtk.h" | 46 #include "scrollbar-gtk.h" |
46 #include "ui-gtk.h" | 47 #include "ui-gtk.h" |
53 | 54 |
54 #define BORDER_WIDTH 0 | 55 #define BORDER_WIDTH 0 |
55 #define INTERNAL_BORDER_WIDTH 0 | 56 #define INTERNAL_BORDER_WIDTH 0 |
56 | 57 |
57 #define TRANSIENT_DATA_IDENTIFIER "xemacs::transient_for" | 58 #define TRANSIENT_DATA_IDENTIFIER "xemacs::transient_for" |
58 #define FRAME_DATA_IDENTIFIER "xemacs::frame" | |
59 #define UNMAPPED_DATA_IDENTIFIER "xemacs::initially_unmapped" | 59 #define UNMAPPED_DATA_IDENTIFIER "xemacs::initially_unmapped" |
60 | 60 |
61 #define STUPID_X_SPECIFIC_GTK_STUFF | 61 #define STUPID_X_SPECIFIC_GTK_STUFF |
62 | 62 |
63 #ifdef STUPID_X_SPECIFIC_GTK_STUFF | 63 #ifdef STUPID_X_SPECIFIC_GTK_STUFF |
110 | 110 |
111 | 111 |
112 /************************************************************************/ | 112 /************************************************************************/ |
113 /* helper functions */ | 113 /* helper functions */ |
114 /************************************************************************/ | 114 /************************************************************************/ |
115 | |
116 /* Return the Emacs frame-object which contains the given widget. */ | |
117 struct frame * | |
118 gtk_widget_to_frame (GtkWidget *w) | |
119 { | |
120 struct frame *f = NULL; | |
121 | |
122 for (; w; w = w->parent) | |
123 { | |
124 if ((f = (struct frame *) gtk_object_get_data (GTK_OBJECT (w), | |
125 GTK_DATA_FRAME_IDENTIFIER))) | |
126 return (f); | |
127 } | |
128 | |
129 return (selected_frame()); | |
130 } | |
131 | |
115 | 132 |
116 /* Return the Emacs frame-object corresponding to an X window */ | 133 /* Return the Emacs frame-object corresponding to an X window */ |
117 struct frame * | 134 struct frame * |
118 gtk_window_to_frame (struct device *d, GdkWindow *wdesc) | 135 gtk_window_to_frame (struct device *d, GdkWindow *wdesc) |
119 { | 136 { |
822 gtk_window_set_transient_for (GTK_WINDOW (shell), GTK_WINDOW (parentwid)); | 839 gtk_window_set_transient_for (GTK_WINDOW (shell), GTK_WINDOW (parentwid)); |
823 } | 840 } |
824 | 841 |
825 gtk_container_set_border_width (GTK_CONTAINER (shell), 0); | 842 gtk_container_set_border_width (GTK_CONTAINER (shell), 0); |
826 | 843 |
827 gtk_object_set_data (GTK_OBJECT (shell), FRAME_DATA_IDENTIFIER, f); | 844 /* Add a mapping from widget to frame to help widget callbacks quickly find |
845 their corresponding frame. */ | |
846 gtk_object_set_data (GTK_OBJECT (shell), GTK_DATA_FRAME_IDENTIFIER, f); | |
828 | 847 |
829 FRAME_GTK_SHELL_WIDGET (f) = shell; | 848 FRAME_GTK_SHELL_WIDGET (f) = shell; |
830 | 849 |
831 text = GTK_WIDGET (gtk_xemacs_new (f)); | 850 text = GTK_WIDGET (gtk_xemacs_new (f)); |
832 | 851 |
951 FRAME_GTK_ICON_PIXMAP (f) = Qnil; | 970 FRAME_GTK_ICON_PIXMAP (f) = Qnil; |
952 FRAME_GTK_ICON_PIXMAP_MASK (f) = Qnil; | 971 FRAME_GTK_ICON_PIXMAP_MASK (f) = Qnil; |
953 FRAME_GTK_MENUBAR_DATA (f) = Qnil; | 972 FRAME_GTK_MENUBAR_DATA (f) = Qnil; |
954 for (i = 0; i < 3; i++) | 973 for (i = 0; i < 3; i++) |
955 FRAME_GTK_LISP_WIDGETS (f)[i] = Qnil; | 974 FRAME_GTK_LISP_WIDGETS (f)[i] = Qnil; |
975 | |
976 /* | |
977 Hashtables of callback data for glyphs on the frame. Make them EQ because | |
978 we only use ints as keys. Otherwise we run into stickiness in redisplay | |
979 because internal_equal() can QUIT. See enter_redisplay_critical_section(). | |
980 */ | |
981 FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE (f) = | |
982 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); | |
983 FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE (f) = | |
984 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); | |
985 FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE (f) = | |
986 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); | |
956 } | 987 } |
957 | 988 |
958 | 989 |
959 /************************************************************************/ | 990 /************************************************************************/ |
960 /* Lisp functions */ | 991 /* Lisp functions */ |
1038 mark_object (FRAME_GTK_ICON_PIXMAP_MASK (f)); | 1069 mark_object (FRAME_GTK_ICON_PIXMAP_MASK (f)); |
1039 mark_object (FRAME_GTK_MENUBAR_DATA (f)); | 1070 mark_object (FRAME_GTK_MENUBAR_DATA (f)); |
1040 mark_object (FRAME_GTK_LISP_WIDGETS (f)[0]); | 1071 mark_object (FRAME_GTK_LISP_WIDGETS (f)[0]); |
1041 mark_object (FRAME_GTK_LISP_WIDGETS (f)[1]); | 1072 mark_object (FRAME_GTK_LISP_WIDGETS (f)[1]); |
1042 mark_object (FRAME_GTK_LISP_WIDGETS (f)[2]); | 1073 mark_object (FRAME_GTK_LISP_WIDGETS (f)[2]); |
1074 mark_object (FRAME_GTK_WIDGET_INSTANCE_HASH_TABLE (f)); | |
1075 mark_object (FRAME_GTK_WIDGET_CALLBACK_HASH_TABLE (f)); | |
1076 mark_object (FRAME_GTK_WIDGET_CALLBACK_EX_HASH_TABLE (f)); | |
1043 } | 1077 } |
1044 | 1078 |
1045 static void | 1079 static void |
1046 gtk_set_frame_icon (struct frame *f) | 1080 gtk_set_frame_icon (struct frame *f) |
1047 { | 1081 { |