diff options
| author | Paul Eggert | 2014-06-03 12:59:55 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-06-03 12:59:55 -0700 |
| commit | 181f08a7d8378c5d3cb290b58c7618396413d28c (patch) | |
| tree | d36524ab6287a64f552897cfe3f1c8e2bce14213 | |
| parent | 5897da1d746561c63719b21c5984b49a194f8209 (diff) | |
| download | emacs-181f08a7d8378c5d3cb290b58c7618396413d28c.tar.gz emacs-181f08a7d8378c5d3cb290b58c7618396413d28c.zip | |
Do not require libXt-devel when building with gtk.
* lwlib/lwlib-widget.h: New file, with contents taken from lwlib.h.
(widget_value) [HAVE_NTGUI]: New member 'title'.
* lwlib/lwlib.h: Include lwlib-widget.h.
(change_type, enum button_type, widget_value):
Move to lwlib-widget.h.
* src/gtkutil.h, src/menu.h: Include lwlib-widget.h, not lwlib-h, to avoid
dependency on libXt-devel.
* src/menu.h [HAVE_NTGUI]: Include lwlib-widget.h in this case too.
(enum button_type, widget_value) [HAVE_NTGUI]: Remove, as
lwlib-widget.h now does this.
* src/nsmenu.m (ns_menu_show): "enabled" -> "enable" to fix typo.
| -rw-r--r-- | lwlib/ChangeLog | 9 | ||||
| -rw-r--r-- | lwlib/lwlib-widget.h | 100 | ||||
| -rw-r--r-- | lwlib/lwlib.h | 57 | ||||
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/gtkutil.h | 2 | ||||
| -rw-r--r-- | src/menu.h | 45 | ||||
| -rw-r--r-- | src/nsmenu.m | 2 |
7 files changed, 124 insertions, 101 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 5457b91d645..daf47ce4720 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-06-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Do not require libXt-devel when building with gtk. | ||
| 4 | * lwlib-widget.h: New file, with contents taken from lwlib.h. | ||
| 5 | (widget_value) [HAVE_NTGUI]: New member 'title'. | ||
| 6 | * lwlib.h: Include lwlib-widget.h. | ||
| 7 | (change_type, enum button_type, widget_value): | ||
| 8 | Move to lwlib-widget.h. | ||
| 9 | |||
| 1 | 2014-06-03 Dmitry Antipov <dmantipov@yandex.ru> | 10 | 2014-06-03 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 11 | ||
| 3 | * xlwmenu.c (openXftFont): Do not load regular X font here. | 12 | * xlwmenu.c (openXftFont): Do not load regular X font here. |
diff --git a/lwlib/lwlib-widget.h b/lwlib/lwlib-widget.h new file mode 100644 index 00000000000..b5abb1af9fa --- /dev/null +++ b/lwlib/lwlib-widget.h | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* | ||
| 2 | Copyright (C) 1992, 1993 Lucid, Inc. | ||
| 3 | Copyright (C) 1994, 1999-2014 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of the Lucid Widget Library. | ||
| 6 | |||
| 7 | The Lucid Widget Library is free software; you can redistribute it and/or | ||
| 8 | modify it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 1, or (at your option) | ||
| 10 | any later version. | ||
| 11 | |||
| 12 | The Lucid Widget Library is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 19 | |||
| 20 | /* This part is separate from lwlib.h because it does not need X, | ||
| 21 | and thus can be used by non-X code in Emacs proper. */ | ||
| 22 | |||
| 23 | #ifndef LWLIB_WIDGET_H | ||
| 24 | #define LWLIB_WIDGET_H | ||
| 25 | |||
| 26 | typedef enum | ||
| 27 | { | ||
| 28 | NO_CHANGE = 0, | ||
| 29 | INVISIBLE_CHANGE = 1, | ||
| 30 | VISIBLE_CHANGE = 2, | ||
| 31 | STRUCTURAL_CHANGE = 3 | ||
| 32 | } change_type; | ||
| 33 | |||
| 34 | enum button_type | ||
| 35 | { | ||
| 36 | BUTTON_TYPE_NONE, | ||
| 37 | BUTTON_TYPE_TOGGLE, | ||
| 38 | BUTTON_TYPE_RADIO | ||
| 39 | }; | ||
| 40 | |||
| 41 | typedef struct _widget_value | ||
| 42 | { | ||
| 43 | /* Name of widget. */ | ||
| 44 | Lisp_Object lname; | ||
| 45 | char *name; | ||
| 46 | |||
| 47 | /* Value (meaning depend on widget type). */ | ||
| 48 | char *value; | ||
| 49 | |||
| 50 | /* Keyboard equivalent. no implications for XtTranslations. */ | ||
| 51 | Lisp_Object lkey; | ||
| 52 | char *key; | ||
| 53 | |||
| 54 | /* Help string or nil if none. | ||
| 55 | GC finds this string through the frame's menu_bar_vector | ||
| 56 | or through menu_items. */ | ||
| 57 | Lisp_Object help; | ||
| 58 | |||
| 59 | /* True if enabled. */ | ||
| 60 | bool enabled; | ||
| 61 | |||
| 62 | /* True if selected. */ | ||
| 63 | bool selected; | ||
| 64 | |||
| 65 | /* True if was edited (maintained by get_value). */ | ||
| 66 | bool edited; | ||
| 67 | |||
| 68 | #ifdef HAVE_NTGUI | ||
| 69 | /* True if menu title. */ | ||
| 70 | bool title; | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /* The type of a button. */ | ||
| 74 | enum button_type button_type; | ||
| 75 | |||
| 76 | /* Type of change (maintained by lw library). */ | ||
| 77 | change_type change; | ||
| 78 | |||
| 79 | /* Type of this widget's change, but not counting the other widgets | ||
| 80 | found in the `next' field. */ | ||
| 81 | change_type this_one_change; | ||
| 82 | |||
| 83 | /* Contents of the sub-widgets, also selected slot for checkbox. */ | ||
| 84 | struct _widget_value *contents; | ||
| 85 | |||
| 86 | /* Data passed to callback. */ | ||
| 87 | void *call_data; | ||
| 88 | |||
| 89 | /* Next one in the list. */ | ||
| 90 | struct _widget_value *next; | ||
| 91 | |||
| 92 | /* Slot for the toolkit dependent part. Always initialize to NULL. */ | ||
| 93 | void *toolkit_data; | ||
| 94 | |||
| 95 | /* Whether we should free the toolkit data slot when freeing the | ||
| 96 | widget_value itself. */ | ||
| 97 | bool free_toolkit_data; | ||
| 98 | } widget_value; | ||
| 99 | |||
| 100 | #endif | ||
diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h index 563ade8b34d..46e2d7a4891 100644 --- a/lwlib/lwlib.h +++ b/lwlib/lwlib.h | |||
| @@ -42,22 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 42 | ** main: ("name") | 42 | ** main: ("name") |
| 43 | */ | 43 | */ |
| 44 | 44 | ||
| 45 | typedef unsigned long LWLIB_ID; | 45 | #include "lwlib-widget.h" |
| 46 | |||
| 47 | typedef enum _change_type | ||
| 48 | { | ||
| 49 | NO_CHANGE = 0, | ||
| 50 | INVISIBLE_CHANGE = 1, | ||
| 51 | VISIBLE_CHANGE = 2, | ||
| 52 | STRUCTURAL_CHANGE = 3 | ||
| 53 | } change_type; | ||
| 54 | 46 | ||
| 55 | enum button_type | 47 | typedef unsigned long LWLIB_ID; |
| 56 | { | ||
| 57 | BUTTON_TYPE_NONE, | ||
| 58 | BUTTON_TYPE_TOGGLE, | ||
| 59 | BUTTON_TYPE_RADIO | ||
| 60 | }; | ||
| 61 | 48 | ||
| 62 | /* Menu separator types. */ | 49 | /* Menu separator types. */ |
| 63 | 50 | ||
| @@ -81,46 +68,6 @@ enum menu_separator | |||
| 81 | SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH | 68 | SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH |
| 82 | }; | 69 | }; |
| 83 | 70 | ||
| 84 | typedef struct _widget_value | ||
| 85 | { | ||
| 86 | /* name of widget */ | ||
| 87 | Lisp_Object lname; | ||
| 88 | char* name; | ||
| 89 | /* value (meaning depend on widget type) */ | ||
| 90 | char* value; | ||
| 91 | /* keyboard equivalent. no implications for XtTranslations */ | ||
| 92 | Lisp_Object lkey; | ||
| 93 | char* key; | ||
| 94 | /* Help string or nil if none. | ||
| 95 | GC finds this string through the frame's menu_bar_vector | ||
| 96 | or through menu_items. */ | ||
| 97 | Lisp_Object help; | ||
| 98 | /* true if enabled */ | ||
| 99 | Boolean enabled; | ||
| 100 | /* true if selected */ | ||
| 101 | Boolean selected; | ||
| 102 | /* true if was edited (maintained by get_value) */ | ||
| 103 | Boolean edited; | ||
| 104 | /* The type of a button. */ | ||
| 105 | enum button_type button_type; | ||
| 106 | /* true if has changed (maintained by lw library) */ | ||
| 107 | change_type change; | ||
| 108 | /* true if this widget itself has changed, | ||
| 109 | but not counting the other widgets found in the `next' field. */ | ||
| 110 | change_type this_one_change; | ||
| 111 | /* Contents of the sub-widgets, also selected slot for checkbox */ | ||
| 112 | struct _widget_value* contents; | ||
| 113 | /* data passed to callback */ | ||
| 114 | XtPointer call_data; | ||
| 115 | /* next one in the list */ | ||
| 116 | struct _widget_value* next; | ||
| 117 | /* slot for the toolkit dependent part. Always initialize to NULL. */ | ||
| 118 | void* toolkit_data; | ||
| 119 | /* tell us if we should free the toolkit data slot when freeing the | ||
| 120 | widget_value itself. */ | ||
| 121 | Boolean free_toolkit_data; | ||
| 122 | } widget_value; | ||
| 123 | |||
| 124 | 71 | ||
| 125 | typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data); | 72 | typedef void (*lw_callback) (Widget w, LWLIB_ID id, void* data); |
| 126 | 73 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 39dde84f645..a6cbac808c2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-06-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Do not require libXt-devel when building with gtk. | ||
| 4 | * gtkutil.h, menu.h: Include lwlib-widget.h, not lwlib-h, to avoid | ||
| 5 | dependency on libXt-devel. | ||
| 6 | * menu.h [HAVE_NTGUI]: Include lwlib-widget.h in this case too. | ||
| 7 | (enum button_type, widget_value) [HAVE_NTGUI]: Remove, as | ||
| 8 | lwlib-widget.h now does this. | ||
| 9 | * nsmenu.m (ns_menu_show): "enabled" -> "enable" to fix typo. | ||
| 10 | |||
| 1 | 2014-06-03 Paul Eggert <eggert@penguin.cs.ucla.edu> | 11 | 2014-06-03 Paul Eggert <eggert@penguin.cs.ucla.edu> |
| 2 | 12 | ||
| 3 | If ENABLE_CHECKING, range-check args of FD_CLR, FD_ISSET, FD_SET. | 13 | If ENABLE_CHECKING, range-check args of FD_CLR, FD_ISSET, FD_SET. |
diff --git a/src/gtkutil.h b/src/gtkutil.h index 345b3283e6d..a69932cc25c 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -24,7 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 24 | #ifdef USE_GTK | 24 | #ifdef USE_GTK |
| 25 | 25 | ||
| 26 | #include <gtk/gtk.h> | 26 | #include <gtk/gtk.h> |
| 27 | #include "../lwlib/lwlib.h" | 27 | #include "../lwlib/lwlib-widget.h" |
| 28 | #include "frame.h" | 28 | #include "frame.h" |
| 29 | #include "xterm.h" | 29 | #include "xterm.h" |
| 30 | 30 | ||
diff --git a/src/menu.h b/src/menu.h index d71989ea1ef..266a471bc38 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -20,52 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #define MENU_H | 20 | #define MENU_H |
| 21 | 21 | ||
| 22 | #include "systime.h" /* for Time */ | 22 | #include "systime.h" /* for Time */ |
| 23 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) | 23 | #include "../lwlib/lwlib-widget.h" |
| 24 | #include "../lwlib/lwlib.h" /* for widget_value */ | ||
| 25 | #endif | ||
| 26 | 24 | ||
| 27 | #ifdef HAVE_NTGUI | 25 | #ifdef HAVE_NTGUI |
| 28 | /* This is based on the one in ../lwlib/lwlib.h, with unused portions | ||
| 29 | removed. HAVE_NTGUI cannot include lwlib.h, as that pulls in X11 | ||
| 30 | headers. */ | ||
| 31 | |||
| 32 | enum button_type | ||
| 33 | { | ||
| 34 | BUTTON_TYPE_NONE, | ||
| 35 | BUTTON_TYPE_TOGGLE, | ||
| 36 | BUTTON_TYPE_RADIO | ||
| 37 | }; | ||
| 38 | |||
| 39 | typedef struct _widget_value | ||
| 40 | { | ||
| 41 | /* name of widget */ | ||
| 42 | Lisp_Object lname; | ||
| 43 | const char* name; | ||
| 44 | /* value (meaning depend on widget type) */ | ||
| 45 | const char* value; | ||
| 46 | /* keyboard equivalent. no implications for XtTranslations */ | ||
| 47 | Lisp_Object lkey; | ||
| 48 | const char* key; | ||
| 49 | /* Help string or nil if none. | ||
| 50 | GC finds this string through the frame's menu_bar_vector | ||
| 51 | or through menu_items. */ | ||
| 52 | Lisp_Object help; | ||
| 53 | /* true if enabled */ | ||
| 54 | unsigned char enabled; | ||
| 55 | /* true if selected */ | ||
| 56 | unsigned char selected; | ||
| 57 | /* The type of a button. */ | ||
| 58 | enum button_type button_type; | ||
| 59 | /* true if menu title */ | ||
| 60 | unsigned char title; | ||
| 61 | /* Contents of the sub-widgets, also selected slot for checkbox */ | ||
| 62 | struct _widget_value* contents; | ||
| 63 | /* data passed to callback */ | ||
| 64 | void *call_data; | ||
| 65 | /* next one in the list */ | ||
| 66 | struct _widget_value* next; | ||
| 67 | } widget_value; | ||
| 68 | |||
| 69 | extern Lisp_Object Qunsupported__w32_dialog; | 26 | extern Lisp_Object Qunsupported__w32_dialog; |
| 70 | #endif | 27 | #endif |
| 71 | 28 | ||
diff --git a/src/nsmenu.m b/src/nsmenu.m index e5f0b7668bc..46b7400b2e4 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -943,7 +943,7 @@ ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 943 | } | 943 | } |
| 944 | #endif /* not HAVE_MULTILINGUAL_MENU */ | 944 | #endif /* not HAVE_MULTILINGUAL_MENU */ |
| 945 | 945 | ||
| 946 | wv = make_widget_value (SSDATA (item_name), NULL, !NILP (enabled), | 946 | wv = make_widget_value (SSDATA (item_name), NULL, !NILP (enable), |
| 947 | STRINGP (help) ? help : Qnil); | 947 | STRINGP (help) ? help : Qnil); |
| 948 | if (prev_wv) | 948 | if (prev_wv) |
| 949 | prev_wv->next = wv; | 949 | prev_wv->next = wv; |