Line
Link Here
|
|
* gtkutil.c: Remove no-longer-used code. |
|
* gtkutil.c: Remove no-longer-used code. |
1 |
* cus-start.el (x-gtk-whole-detached-tool-bar): Remove. |
1 |
* cus-start.el (x-gtk-whole-detached-tool-bar): Remove. |
2 |
* xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar. |
2 |
* xfns.c (syms_of_xfns): Remove x-gtk-whole-detached-tool-bar. |
3 |
Handle deprecated Gtk+ stuff for version <= 3.10 |
3 |
Handle deprecated Gtk+ stuff for version <= 3.10 |
4 |
-- emacs-24.5-orig/lisp/cus-start.el |
4 |
++ emacs-24.5/lisp/cus-start.el |
Lines 519-525
Link Here
|
519 |
(x-gtk-use-old-file-dialog menu boolean "22.1") |
519 |
(x-gtk-use-old-file-dialog menu boolean "22.1") |
520 |
(x-gtk-show-hidden-files menu boolean "22.1") |
520 |
(x-gtk-show-hidden-files menu boolean "22.1") |
521 |
(x-gtk-file-dialog-help-text menu boolean "22.1") |
521 |
(x-gtk-file-dialog-help-text menu boolean "22.1") |
522 |
(x-gtk-whole-detached-tool-bar x boolean "22.1") |
|
|
523 |
(x-gtk-use-system-tooltips tooltip boolean "23.3") |
522 |
(x-gtk-use-system-tooltips tooltip boolean "23.3") |
524 |
;; xterm.c |
523 |
;; xterm.c |
525 |
(x-use-underline-position-properties display boolean "22.1") |
524 |
(x-use-underline-position-properties display boolean "22.1") |
526 |
-- emacs-24.5-orig/lisp/term/x-win.el |
525 |
++ emacs-24.5/lisp/term/x-win.el |
Lines 1475-1521
Link Here
|
1475 |
(mapcar (lambda (arg) |
1475 |
(mapcar (lambda (arg) |
1476 |
(cons (purecopy (car arg)) (purecopy (cdr arg)))) |
1476 |
(cons (purecopy (car arg)) (purecopy (cdr arg)))) |
1477 |
'( |
1477 |
'( |
1478 |
("etc/images/new" . "gtk-new") |
1478 |
("etc/images/new" . ("document-new" "gtk-new")) |
1479 |
("etc/images/open" . "gtk-open") |
1479 |
("etc/images/open" . ("document-open" "gtk-open")) |
1480 |
("etc/images/diropen" . "n:system-file-manager") |
1480 |
("etc/images/diropen" . "n:system-file-manager") |
1481 |
("etc/images/close" . "gtk-close") |
1481 |
("etc/images/close" . ("window-close" "gtk-close")) |
1482 |
("etc/images/save" . "gtk-save") |
1482 |
("etc/images/save" . ("document-save" "gtk-save")) |
1483 |
("etc/images/saveas" . "gtk-save-as") |
1483 |
("etc/images/saveas" . ("document-save-as" "gtk-save-as")) |
1484 |
("etc/images/undo" . "gtk-undo") |
1484 |
("etc/images/undo" . ("edit-undo" "gtk-undo")) |
1485 |
("etc/images/cut" . "gtk-cut") |
1485 |
("etc/images/cut" . ("edit-cut" "gtk-cut")) |
1486 |
("etc/images/copy" . "gtk-copy") |
1486 |
("etc/images/copy" . ("edit-copy" "gtk-copy")) |
1487 |
("etc/images/paste" . "gtk-paste") |
1487 |
("etc/images/paste" . ("edit-paste" "gtk-paste")) |
1488 |
("etc/images/search" . "gtk-find") |
1488 |
("etc/images/search" . ("edit-find" "gtk-find")) |
1489 |
("etc/images/print" . "gtk-print") |
1489 |
("etc/images/print" . ("document-print" "gtk-print")) |
1490 |
("etc/images/preferences" . "gtk-preferences") |
1490 |
("etc/images/preferences" . ("preferences-system" "gtk-preferences")) |
1491 |
("etc/images/help" . "gtk-help") |
1491 |
("etc/images/help" . ("help-browser" "gtk-help")) |
1492 |
("etc/images/left-arrow" . "gtk-go-back") |
1492 |
("etc/images/left-arrow" . ("go-previous" "gtk-go-back")) |
1493 |
("etc/images/right-arrow" . "gtk-go-forward") |
1493 |
("etc/images/right-arrow" . ("go-next" "gtk-go-forward")) |
1494 |
("etc/images/home" . "gtk-home") |
1494 |
("etc/images/home" . ("go-home" "gtk-home")) |
1495 |
("etc/images/jump-to" . "gtk-jump-to") |
1495 |
("etc/images/jump-to" . ("go-jump" "gtk-jump-to")) |
1496 |
("etc/images/index" . "gtk-index") |
1496 |
("etc/images/index" . "gtk-index") |
1497 |
("etc/images/search" . "gtk-find") |
1497 |
("etc/images/exit" . ("application-exit" "gtk-quit")) |
1498 |
("etc/images/exit" . "gtk-quit") |
|
|
1499 |
("etc/images/cancel" . "gtk-cancel") |
1498 |
("etc/images/cancel" . "gtk-cancel") |
1500 |
("etc/images/info" . "gtk-info") |
1499 |
("etc/images/info" . ("dialog-information" "gtk-info")) |
1501 |
("etc/images/bookmark_add" . "n:bookmark_add") |
1500 |
("etc/images/bookmark_add" . "n:bookmark_add") |
1502 |
;; Used in Gnus and/or MH-E: |
1501 |
;; Used in Gnus and/or MH-E: |
1503 |
("etc/images/attach" . "gtk-attach") |
1502 |
("etc/images/attach" . "gtk-attach") |
1504 |
("etc/images/connect" . "gtk-connect") |
1503 |
("etc/images/connect" . "gtk-connect") |
1505 |
("etc/images/contact" . "gtk-contact") |
1504 |
("etc/images/contact" . "gtk-contact") |
1506 |
("etc/images/delete" . "gtk-delete") |
1505 |
("etc/images/delete" . ("edit-delete" "gtk-delete")) |
1507 |
("etc/images/describe" . "gtk-properties") |
1506 |
("etc/images/describe" . ("ocument-properties" "gtk-properties")) |
1508 |
("etc/images/disconnect" . "gtk-disconnect") |
1507 |
("etc/images/disconnect" . "gtk-disconnect") |
1509 |
;; ("etc/images/exit" . "gtk-exit") |
1508 |
;; ("etc/images/exit" . "gtk-exit") |
1510 |
("etc/images/lock-broken" . "gtk-lock_broken") |
1509 |
("etc/images/lock-broken" . "gtk-lock_broken") |
1511 |
("etc/images/lock-ok" . "gtk-lock_ok") |
1510 |
("etc/images/lock-ok" . "gtk-lock_ok") |
1512 |
("etc/images/lock" . "gtk-lock") |
1511 |
("etc/images/lock" . "gtk-lock") |
1513 |
("etc/images/next-page" . "gtk-next-page") |
1512 |
("etc/images/next-page" . "gtk-next-page") |
1514 |
("etc/images/refresh" . "gtk-refresh") |
1513 |
("etc/images/refresh" . ("view-refresh" "gtk-refresh")) |
1515 |
("etc/images/sort-ascending" . "gtk-sort-ascending") |
1514 |
("etc/images/sort-ascending" . ("view-sort-ascending" "gtk-sort-ascending")) |
1516 |
("etc/images/sort-column-ascending" . "gtk-sort-column-ascending") |
1515 |
("etc/images/sort-column-ascending" . "gtk-sort-column-ascending") |
1517 |
("etc/images/sort-criteria" . "gtk-sort-criteria") |
1516 |
("etc/images/sort-criteria" . "gtk-sort-criteria") |
1518 |
("etc/images/sort-descending" . "gtk-sort-descending") |
1517 |
("etc/images/sort-descending" . ("view-sort-descending" |
|
|
1518 |
"gtk-sort-descending")) |
1519 |
("etc/images/sort-row-ascending" . "gtk-sort-row-ascending") |
1519 |
("etc/images/sort-row-ascending" . "gtk-sort-row-ascending") |
1520 |
("images/gnus/toggle-subscription" . "gtk-task-recurring") |
1520 |
("images/gnus/toggle-subscription" . "gtk-task-recurring") |
1521 |
("images/mail/compose" . "gtk-mail-compose") |
1521 |
("images/mail/compose" . "gtk-mail-compose") |
Lines 1532-1539
Link Here
|
1532 |
("images/mail/spam" . "gtk-spam") |
1532 |
("images/mail/spam" . "gtk-spam") |
1533 |
;; Used for GDB Graphical Interface |
1533 |
;; Used for GDB Graphical Interface |
1534 |
("images/gud/break" . "gtk-no") |
1534 |
("images/gud/break" . "gtk-no") |
1535 |
("images/gud/recstart" . "gtk-media-record") |
1535 |
("images/gud/recstart" . ("media-record" "gtk-media-record")) |
1536 |
("images/gud/recstop" . "gtk-media-stop") |
1536 |
("images/gud/recstop" . ("media-playback-stop" "gtk-media-stop")) |
1537 |
;; No themed versions available: |
1537 |
;; No themed versions available: |
1538 |
;; mail/preview (combining stock_mail and stock_zoom) |
1538 |
;; mail/preview (combining stock_mail and stock_zoom) |
1539 |
;; mail/save (combining stock_mail, stock_save and stock_convert) |
1539 |
;; mail/save (combining stock_mail, stock_save and stock_convert) |
Lines 1542-1550
Link Here
|
1542 |
Emacs must be compiled with the Gtk+ toolkit for this to have any effect. |
1542 |
Emacs must be compiled with the Gtk+ toolkit for this to have any effect. |
1543 |
A value that begins with n: denotes a named icon instead of a stock icon." |
1543 |
A value that begins with n: denotes a named icon instead of a stock icon." |
1544 |
:version "22.2" |
1544 |
:version "22.2" |
1545 |
:type '(choice (repeat (choice symbol |
1545 |
:type '(choice (repeat |
1546 |
(cons (string :tag "Emacs icon") |
1546 |
(choice symbol |
1547 |
(string :tag "Stock/named"))))) |
1547 |
(cons (string :tag "Emacs icon") |
|
|
1548 |
(choice (group (string :tag "Named") |
1549 |
(string :tag "Stock")) |
1550 |
(string :tag "Stock/named")))))) |
1548 |
:group 'x) |
1551 |
:group 'x) |
1549 |
|
1552 |
|
1550 |
(defcustom icon-map-list '(x-gtk-stock-map) |
1553 |
(defcustom icon-map-list '(x-gtk-stock-map) |
1551 |
-- emacs-24.5-orig/src/gtkutil.c |
1554 |
++ emacs-24.5/src/gtkutil.c |
Lines 92-97
Link Here
|
92 |
#endif |
92 |
#endif |
93 |
#endif /* HAVE_FREETYPE */ |
93 |
#endif /* HAVE_FREETYPE */ |
94 |
|
94 |
|
|
|
95 |
#if GTK_CHECK_VERSION (3, 10, 0) |
96 |
#define XG_TEXT_CANCEL "Cancel" |
97 |
#define XG_TEXT_OK "OK" |
98 |
#define XG_TEXT_OPEN "Open" |
99 |
#else |
100 |
#define XG_TEXT_CANCEL GTK_STOCK_CANCEL |
101 |
#define XG_TEXT_OK GTK_STOCK_OK |
102 |
#define XG_TEXT_OPEN GTK_STOCK_OPEN |
103 |
#endif |
104 |
|
95 |
#ifndef HAVE_GTK3 |
105 |
#ifndef HAVE_GTK3 |
96 |
#ifdef USE_GTK_TOOLTIP |
106 |
#ifdef USE_GTK_TOOLTIP |
97 |
#define gdk_window_get_screen(w) gdk_drawable_get_screen (w) |
107 |
#define gdk_window_get_screen(w) gdk_drawable_get_screen (w) |
Lines 1826-1834
Link Here
|
1826 |
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; |
1836 |
action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; |
1827 |
|
1837 |
|
1828 |
filewin = gtk_file_chooser_dialog_new (prompt, gwin, action, |
1838 |
filewin = gtk_file_chooser_dialog_new (prompt, gwin, action, |
1829 |
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
1839 |
XG_TEXT_CANCEL, GTK_RESPONSE_CANCEL, |
1830 |
(mustmatch_p || only_dir_p ? |
1840 |
(mustmatch_p || only_dir_p ? |
1831 |
GTK_STOCK_OPEN : GTK_STOCK_OK), |
1841 |
XG_TEXT_OPEN : XG_TEXT_OK), |
1832 |
GTK_RESPONSE_OK, |
1842 |
GTK_RESPONSE_OK, |
1833 |
NULL); |
1843 |
NULL); |
1834 |
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE); |
1844 |
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE); |
Lines 2408-2464
Link Here
|
2408 |
return w; |
2418 |
return w; |
2409 |
} |
2419 |
} |
2410 |
|
2420 |
|
2411 |
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
|
|
2412 |
|
2413 |
static int xg_detached_menus; |
2414 |
|
2415 |
/* Return true if there are detached menus. */ |
2416 |
|
2417 |
bool |
2418 |
xg_have_tear_offs (struct frame *f) |
2419 |
{ |
2420 |
/* If the frame's menubar height is zero, the menu bar is probably |
2421 |
being redirected outside the window to some kind of global menu; |
2422 |
this situation is the moral equivalent of a tear-off. */ |
2423 |
return FRAME_MENUBAR_HEIGHT (f) == 0 || xg_detached_menus > 0; |
2424 |
} |
2425 |
|
2426 |
/* Callback invoked when a detached menu window is removed. Here we |
2427 |
decrease the xg_detached_menus count. |
2428 |
WIDGET is the top level window that is removed (the parent of the menu). |
2429 |
CLIENT_DATA is not used. */ |
2430 |
|
2431 |
static void |
2432 |
tearoff_remove (GtkWidget *widget, gpointer client_data) |
2433 |
{ |
2434 |
if (xg_detached_menus > 0) --xg_detached_menus; |
2435 |
} |
2436 |
|
2437 |
/* Callback invoked when a menu is detached. It increases the |
2438 |
xg_detached_menus count. |
2439 |
WIDGET is the GtkTearoffMenuItem. |
2440 |
CLIENT_DATA is not used. */ |
2441 |
|
2442 |
static void |
2443 |
tearoff_activate (GtkWidget *widget, gpointer client_data) |
2444 |
{ |
2445 |
GtkWidget *menu = gtk_widget_get_parent (widget); |
2446 |
if (gtk_menu_get_tearoff_state (GTK_MENU (menu))) |
2447 |
{ |
2448 |
++xg_detached_menus; |
2449 |
g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), |
2450 |
"destroy", |
2451 |
G_CALLBACK (tearoff_remove), 0); |
2452 |
} |
2453 |
} |
2454 |
#else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ |
2455 |
bool |
2456 |
xg_have_tear_offs (struct frame *f) |
2457 |
{ |
2458 |
return FRAME_MENUBAR_HEIGHT (f) == 0; |
2459 |
} |
2460 |
#endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ |
2461 |
|
2462 |
/* Create a menu item widget, and connect the callbacks. |
2421 |
/* Create a menu item widget, and connect the callbacks. |
2463 |
ITEM describes the menu item. |
2422 |
ITEM describes the menu item. |
2464 |
F is the frame the created menu belongs to. |
2423 |
F is the frame the created menu belongs to. |
Lines 2529-2536
Link Here
|
2529 |
HIGHLIGHT_CB is the callback to call when entering/leaving menu items. |
2488 |
HIGHLIGHT_CB is the callback to call when entering/leaving menu items. |
2530 |
If POP_UP_P, create a popup menu. |
2489 |
If POP_UP_P, create a popup menu. |
2531 |
If MENU_BAR_P, create a menu bar. |
2490 |
If MENU_BAR_P, create a menu bar. |
2532 |
If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P or |
|
|
2533 |
the Gtk+ version used does not have tearoffs. |
2534 |
TOPMENU is the topmost GtkWidget that others shall be placed under. |
2491 |
TOPMENU is the topmost GtkWidget that others shall be placed under. |
2535 |
It may be NULL, in that case we create the appropriate widget |
2492 |
It may be NULL, in that case we create the appropriate widget |
2536 |
(menu bar or menu item depending on POP_UP_P and MENU_BAR_P) |
2493 |
(menu bar or menu item depending on POP_UP_P and MENU_BAR_P) |
Lines 2552-2558
Link Here
|
2552 |
GCallback highlight_cb, |
2509 |
GCallback highlight_cb, |
2553 |
bool pop_up_p, |
2510 |
bool pop_up_p, |
2554 |
bool menu_bar_p, |
2511 |
bool menu_bar_p, |
2555 |
bool add_tearoff_p, |
|
|
2556 |
GtkWidget *topmenu, |
2512 |
GtkWidget *topmenu, |
2557 |
xg_menu_cb_data *cl_data, |
2513 |
xg_menu_cb_data *cl_data, |
2558 |
const char *name) |
2514 |
const char *name) |
Lines 2603-2619
Link Here
|
2603 |
"selection-done", deactivate_cb, 0); |
2559 |
"selection-done", deactivate_cb, 0); |
2604 |
} |
2560 |
} |
2605 |
|
2561 |
|
2606 |
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
|
|
2607 |
if (! menu_bar_p && add_tearoff_p) |
2608 |
{ |
2609 |
GtkWidget *tearoff = gtk_tearoff_menu_item_new (); |
2610 |
gtk_menu_shell_append (GTK_MENU_SHELL (wmenu), tearoff); |
2611 |
|
2612 |
g_signal_connect (G_OBJECT (tearoff), "activate", |
2613 |
G_CALLBACK (tearoff_activate), 0); |
2614 |
} |
2615 |
#endif |
2616 |
|
2617 |
for (item = data; item; item = item->next) |
2562 |
for (item = data; item; item = item->next) |
2618 |
{ |
2563 |
{ |
2619 |
GtkWidget *w; |
2564 |
GtkWidget *w; |
Lines 2627-2633
Link Here
|
2627 |
group = NULL; |
2572 |
group = NULL; |
2628 |
utf8_label = get_utf8_string (item->name); |
2573 |
utf8_label = get_utf8_string (item->name); |
2629 |
|
2574 |
|
2630 |
gtk_menu_set_title (GTK_MENU (wmenu), utf8_label); |
|
|
2631 |
w = gtk_menu_item_new_with_label (utf8_label); |
2575 |
w = gtk_menu_item_new_with_label (utf8_label); |
2632 |
gtk_widget_set_sensitive (w, FALSE); |
2576 |
gtk_widget_set_sensitive (w, FALSE); |
2633 |
if (utf8_label) g_free (utf8_label); |
2577 |
if (utf8_label) g_free (utf8_label); |
Lines 2658-2664
Link Here
|
2658 |
highlight_cb, |
2602 |
highlight_cb, |
2659 |
0, |
2603 |
0, |
2660 |
0, |
2604 |
0, |
2661 |
add_tearoff_p, |
|
|
2662 |
0, |
2605 |
0, |
2663 |
cl_data, |
2606 |
cl_data, |
2664 |
0); |
2607 |
0); |
Lines 2716-2722
Link Here
|
2716 |
highlight_cb, |
2659 |
highlight_cb, |
2717 |
pop_up_p, |
2660 |
pop_up_p, |
2718 |
menu_bar_p, |
2661 |
menu_bar_p, |
2719 |
menu_bar_p, |
|
|
2720 |
0, |
2662 |
0, |
2721 |
0, |
2663 |
0, |
2722 |
name); |
2664 |
name); |
Lines 2826-2832
Link Here
|
2826 |
{ |
2768 |
{ |
2827 |
/* Item(s) added. Add all new items in one call. */ |
2769 |
/* Item(s) added. Add all new items in one call. */ |
2828 |
create_menus (val, f, select_cb, deactivate_cb, highlight_cb, |
2770 |
create_menus (val, f, select_cb, deactivate_cb, highlight_cb, |
2829 |
0, 1, 0, menubar, cl_data, 0); |
2771 |
0, 1, menubar, cl_data, 0); |
2830 |
|
2772 |
|
2831 |
/* All updated. */ |
2773 |
/* All updated. */ |
2832 |
val = 0; |
2774 |
val = 0; |
Lines 2899-2905
Link Here
|
2899 |
is up to date when leaving the minibuffer. */ |
2841 |
is up to date when leaving the minibuffer. */ |
2900 |
GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem)); |
2842 |
GtkLabel *wlabel = GTK_LABEL (XG_BIN_CHILD (witem)); |
2901 |
char *utf8_label = get_utf8_string (val->name); |
2843 |
char *utf8_label = get_utf8_string (val->name); |
2902 |
GtkWidget *submenu = gtk_menu_item_get_submenu (witem); |
|
|
2903 |
|
2844 |
|
2904 |
/* GTK menu items don't notice when their labels have been |
2845 |
/* GTK menu items don't notice when their labels have been |
2905 |
changed from underneath them, so we have to explicitly |
2846 |
changed from underneath them, so we have to explicitly |
Lines 2909-2922
Link Here
|
2909 |
gtk_label_set_text (wlabel, utf8_label); |
2850 |
gtk_label_set_text (wlabel, utf8_label); |
2910 |
g_object_notify (G_OBJECT (witem), "label"); |
2851 |
g_object_notify (G_OBJECT (witem), "label"); |
2911 |
|
2852 |
|
2912 |
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
|
|
2913 |
/* If this item has a submenu that has been detached, change |
2914 |
the title in the WM decorations also. */ |
2915 |
if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) |
2916 |
/* Set the title of the detached window. */ |
2917 |
gtk_menu_set_title (GTK_MENU (submenu), utf8_label); |
2918 |
#endif |
2919 |
|
2920 |
if (utf8_label) g_free (utf8_label); |
2853 |
if (utf8_label) g_free (utf8_label); |
2921 |
iter = g_list_next (iter); |
2854 |
iter = g_list_next (iter); |
2922 |
val = val->next; |
2855 |
val = val->next; |
Lines 2943-2949
Link Here
|
2943 |
GtkWidget *submenu = create_menus (NULL, f, |
2876 |
GtkWidget *submenu = create_menus (NULL, f, |
2944 |
select_cb, deactivate_cb, |
2877 |
select_cb, deactivate_cb, |
2945 |
highlight_cb, |
2878 |
highlight_cb, |
2946 |
0, 0, 0, 0, cl_data, 0); |
2879 |
0, 0, 0, cl_data, 0); |
2947 |
|
2880 |
|
2948 |
gtk_widget_set_name (w, MENU_ITEM_NAME); |
2881 |
gtk_widget_set_name (w, MENU_ITEM_NAME); |
2949 |
gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos); |
2882 |
gtk_menu_shell_insert (GTK_MENU_SHELL (menubar), w, pos); |
Lines 3140-3146
Link Here
|
3140 |
GList *list = 0; |
3073 |
GList *list = 0; |
3141 |
GList *iter; |
3074 |
GList *iter; |
3142 |
widget_value *cur; |
3075 |
widget_value *cur; |
3143 |
bool has_tearoff_p = 0; |
|
|
3144 |
GList *first_radio = 0; |
3076 |
GList *first_radio = 0; |
3145 |
|
3077 |
|
3146 |
if (submenu) |
3078 |
if (submenu) |
Lines 3152-3168
Link Here
|
3152 |
{ |
3084 |
{ |
3153 |
GtkWidget *w = GTK_WIDGET (iter->data); |
3085 |
GtkWidget *w = GTK_WIDGET (iter->data); |
3154 |
|
3086 |
|
3155 |
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
|
|
3156 |
/* Skip tearoff items, they have no counterpart in val. */ |
3157 |
if (GTK_IS_TEAROFF_MENU_ITEM (w)) |
3158 |
{ |
3159 |
has_tearoff_p = 1; |
3160 |
iter = g_list_next (iter); |
3161 |
if (iter) w = GTK_WIDGET (iter->data); |
3162 |
else break; |
3163 |
} |
3164 |
#endif |
3165 |
|
3166 |
/* Remember first radio button in a group. If we get a mismatch in |
3087 |
/* Remember first radio button in a group. If we get a mismatch in |
3167 |
a radio group we must rebuild the whole group so that the connections |
3088 |
a radio group we must rebuild the whole group so that the connections |
3168 |
in GTK becomes correct. */ |
3089 |
in GTK becomes correct. */ |
Lines 3250-3256
Link Here
|
3250 |
highlight_cb, |
3171 |
highlight_cb, |
3251 |
0, |
3172 |
0, |
3252 |
0, |
3173 |
0, |
3253 |
! has_tearoff_p, |
|
|
3254 |
submenu, |
3174 |
submenu, |
3255 |
cl_data, |
3175 |
cl_data, |
3256 |
0); |
3176 |
0); |
Lines 3908-3916
Link Here
|
3908 |
get them. */ |
3828 |
get them. */ |
3909 |
#define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier" |
3829 |
#define XG_TOOL_BAR_LAST_MODIFIER "emacs-tool-bar-modifier" |
3910 |
|
3830 |
|
3911 |
/* The key for storing the button widget in its proxy menu item. */ |
|
|
3912 |
#define XG_TOOL_BAR_PROXY_BUTTON "emacs-tool-bar-proxy-button" |
3913 |
|
3914 |
/* The key for the data we put in the GtkImage widgets. The data is |
3831 |
/* The key for the data we put in the GtkImage widgets. The data is |
3915 |
the stock name used by Emacs. We use this to see if we need to update |
3832 |
the stock name used by Emacs. We use this to see if we need to update |
3916 |
the GtkImage with a new image. */ |
3833 |
the GtkImage with a new image. */ |
Lines 3983-4023
Link Here
|
3983 |
x_focus_frame (f); |
3900 |
x_focus_frame (f); |
3984 |
} |
3901 |
} |
3985 |
|
3902 |
|
3986 |
/* Callback function invoked when a tool bar item is pressed in a detached |
|
|
3987 |
tool bar or the overflow drop down menu. |
3988 |
We just call xg_tool_bar_callback. |
3989 |
W is the menu item widget that got pressed, |
3990 |
CLIENT_DATA is an integer that is the index of the button in the |
3991 |
tool bar. 0 is the first button. */ |
3992 |
|
3993 |
static void |
3994 |
xg_tool_bar_proxy_callback (GtkWidget *w, gpointer client_data) |
3995 |
{ |
3996 |
GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), |
3997 |
XG_TOOL_BAR_PROXY_BUTTON)); |
3998 |
xg_tool_bar_callback (wbutton, client_data); |
3999 |
} |
4000 |
|
4001 |
|
4002 |
static gboolean |
4003 |
xg_tool_bar_help_callback (GtkWidget *w, |
4004 |
GdkEventCrossing *event, |
4005 |
gpointer client_data); |
4006 |
|
4007 |
/* This callback is called when a help is to be shown for an item in |
4008 |
the detached tool bar when the detached tool bar it is not expanded. */ |
4009 |
|
4010 |
static gboolean |
4011 |
xg_tool_bar_proxy_help_callback (GtkWidget *w, |
4012 |
GdkEventCrossing *event, |
4013 |
gpointer client_data) |
4014 |
{ |
4015 |
GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w), |
4016 |
XG_TOOL_BAR_PROXY_BUTTON)); |
4017 |
|
4018 |
return xg_tool_bar_help_callback (wbutton, event, client_data); |
4019 |
} |
4020 |
|
4021 |
static GtkWidget * |
3903 |
static GtkWidget * |
4022 |
xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage) |
3904 |
xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage) |
4023 |
{ |
3905 |
{ |
Lines 4031-4217
Link Here
|
4031 |
} |
3913 |
} |
4032 |
|
3914 |
|
4033 |
|
3915 |
|
4034 |
/* This callback is called when a tool item should create a proxy item, |
|
|
4035 |
such as for the overflow menu. Also called when the tool bar is detached. |
4036 |
If we don't create a proxy menu item, the detached tool bar will be |
4037 |
blank. */ |
4038 |
|
4039 |
static gboolean |
4040 |
xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) |
4041 |
{ |
4042 |
GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem))); |
4043 |
GtkWidget *vb = XG_BIN_CHILD (wbutton); |
4044 |
GtkWidget *c1; |
4045 |
GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1)); |
4046 |
GtkImage *wimage = GTK_IMAGE (c1); |
4047 |
GtkWidget *wmenuitem = gtk_image_menu_item_new_with_label |
4048 |
(wlbl ? gtk_label_get_text (wlbl) : ""); |
4049 |
GtkWidget *wmenuimage; |
4050 |
|
4051 |
|
4052 |
if (gtk_button_get_use_stock (wbutton)) |
4053 |
wmenuimage = gtk_image_new_from_stock (gtk_button_get_label (wbutton), |
4054 |
GTK_ICON_SIZE_MENU); |
4055 |
else |
4056 |
{ |
4057 |
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (wbutton)); |
4058 |
GtkImageType store_type = gtk_image_get_storage_type (wimage); |
4059 |
|
4060 |
g_object_set (G_OBJECT (settings), "gtk-menu-images", TRUE, NULL); |
4061 |
|
4062 |
if (store_type == GTK_IMAGE_STOCK) |
4063 |
{ |
4064 |
gchar *stock_id; |
4065 |
gtk_image_get_stock (wimage, &stock_id, NULL); |
4066 |
wmenuimage = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU); |
4067 |
} |
4068 |
else if (store_type == GTK_IMAGE_ICON_SET) |
4069 |
{ |
4070 |
GtkIconSet *icon_set; |
4071 |
gtk_image_get_icon_set (wimage, &icon_set, NULL); |
4072 |
wmenuimage = gtk_image_new_from_icon_set (icon_set, |
4073 |
GTK_ICON_SIZE_MENU); |
4074 |
} |
4075 |
else if (store_type == GTK_IMAGE_PIXBUF) |
4076 |
{ |
4077 |
gint width, height; |
4078 |
|
4079 |
if (settings && |
4080 |
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, |
4081 |
&width, &height)) |
4082 |
{ |
4083 |
GdkPixbuf *src_pixbuf, *dest_pixbuf; |
4084 |
|
4085 |
src_pixbuf = gtk_image_get_pixbuf (wimage); |
4086 |
dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, width, height, |
4087 |
GDK_INTERP_BILINEAR); |
4088 |
|
4089 |
wmenuimage = gtk_image_new_from_pixbuf (dest_pixbuf); |
4090 |
} |
4091 |
else |
4092 |
{ |
4093 |
fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n"); |
4094 |
emacs_abort (); |
4095 |
} |
4096 |
} |
4097 |
else if (store_type == GTK_IMAGE_ICON_NAME) |
4098 |
{ |
4099 |
const gchar *icon_name; |
4100 |
GtkIconSize icon_size; |
4101 |
|
4102 |
gtk_image_get_icon_name (wimage, &icon_name, &icon_size); |
4103 |
wmenuimage = gtk_image_new_from_icon_name (icon_name, |
4104 |
GTK_ICON_SIZE_MENU); |
4105 |
} |
4106 |
else |
4107 |
{ |
4108 |
fprintf (stderr, "internal error: store_type is %d\n", store_type); |
4109 |
emacs_abort (); |
4110 |
} |
4111 |
} |
4112 |
if (wmenuimage) |
4113 |
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (wmenuitem), wmenuimage); |
4114 |
|
4115 |
g_signal_connect (G_OBJECT (wmenuitem), |
4116 |
"activate", |
4117 |
G_CALLBACK (xg_tool_bar_proxy_callback), |
4118 |
user_data); |
4119 |
|
4120 |
|
4121 |
g_object_set_data (G_OBJECT (wmenuitem), XG_TOOL_BAR_PROXY_BUTTON, |
4122 |
(gpointer) wbutton); |
4123 |
gtk_tool_item_set_proxy_menu_item (toolitem, "Emacs toolbar item", wmenuitem); |
4124 |
gtk_widget_set_sensitive (wmenuitem, |
4125 |
gtk_widget_get_sensitive (GTK_WIDGET (wbutton))); |
4126 |
|
4127 |
/* Use enter/leave notify to show help. We use the events |
4128 |
rather than the GtkButton specific signals "enter" and |
4129 |
"leave", so we can have only one callback. The event |
4130 |
will tell us what kind of event it is. */ |
4131 |
g_signal_connect (G_OBJECT (wmenuitem), |
4132 |
"enter-notify-event", |
4133 |
G_CALLBACK (xg_tool_bar_proxy_help_callback), |
4134 |
user_data); |
4135 |
g_signal_connect (G_OBJECT (wmenuitem), |
4136 |
"leave-notify-event", |
4137 |
G_CALLBACK (xg_tool_bar_proxy_help_callback), |
4138 |
user_data); |
4139 |
|
4140 |
return TRUE; |
4141 |
} |
4142 |
|
4143 |
/* This callback is called when a tool bar is detached. We must set |
4144 |
the height of the tool bar to zero when this happens so frame sizes |
4145 |
are correctly calculated. |
4146 |
WBOX is the handle box widget that enables detach/attach of the tool bar. |
4147 |
W is the tool bar widget. |
4148 |
CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ |
4149 |
|
4150 |
static void |
4151 |
xg_tool_bar_detach_callback (GtkHandleBox *wbox, |
4152 |
GtkWidget *w, |
4153 |
gpointer client_data) |
4154 |
{ |
4155 |
struct frame *f = client_data; |
4156 |
|
4157 |
g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, |
4158 |
NULL); |
4159 |
|
4160 |
if (f) |
4161 |
{ |
4162 |
GtkRequisition req, req2; |
4163 |
|
4164 |
gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); |
4165 |
gtk_widget_get_preferred_size (w, NULL, &req2); |
4166 |
req.width -= req2.width; |
4167 |
req.height -= req2.height; |
4168 |
if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) |
4169 |
FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; |
4170 |
else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) |
4171 |
FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; |
4172 |
else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) |
4173 |
FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; |
4174 |
else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) |
4175 |
FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; |
4176 |
xg_height_or_width_changed (f); |
4177 |
} |
4178 |
} |
4179 |
|
4180 |
/* This callback is called when a tool bar is reattached. We must set |
4181 |
the height of the tool bar when this happens so frame sizes |
4182 |
are correctly calculated. |
4183 |
WBOX is the handle box widget that enables detach/attach of the tool bar. |
4184 |
W is the tool bar widget. |
4185 |
CLIENT_DATA is a pointer to the frame the tool bar belongs to. */ |
4186 |
|
4187 |
static void |
4188 |
xg_tool_bar_attach_callback (GtkHandleBox *wbox, |
4189 |
GtkWidget *w, |
4190 |
gpointer client_data) |
4191 |
{ |
4192 |
struct frame *f = client_data; |
4193 |
g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); |
4194 |
|
4195 |
if (f) |
4196 |
{ |
4197 |
GtkRequisition req, req2; |
4198 |
|
4199 |
gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req); |
4200 |
gtk_widget_get_preferred_size (w, NULL, &req2); |
4201 |
req.width += req2.width; |
4202 |
req.height += req2.height; |
4203 |
if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) |
4204 |
FRAME_TOOLBAR_TOP_HEIGHT (f) = req.height; |
4205 |
else if (FRAME_TOOLBAR_BOTTOM_HEIGHT (f) != 0) |
4206 |
FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = req.height; |
4207 |
else if (FRAME_TOOLBAR_RIGHT_WIDTH (f) != 0) |
4208 |
FRAME_TOOLBAR_RIGHT_WIDTH (f) = req.width; |
4209 |
else if (FRAME_TOOLBAR_LEFT_WIDTH (f) != 0) |
4210 |
FRAME_TOOLBAR_LEFT_WIDTH (f) = req.width; |
4211 |
xg_height_or_width_changed (f); |
4212 |
} |
4213 |
} |
4214 |
|
4215 |
/* This callback is called when the mouse enters or leaves a tool bar item. |
3916 |
/* This callback is called when the mouse enters or leaves a tool bar item. |
4216 |
It is used for displaying and hiding the help text. |
3917 |
It is used for displaying and hiding the help text. |
4217 |
W is the tool bar item, a button. |
3918 |
W is the tool bar item, a button. |
Lines 4291-4302
Link Here
|
4291 |
gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) |
3992 |
gtk_toolbar_set_orientation (GTK_TOOLBAR (w), o) |
4292 |
#endif |
3993 |
#endif |
4293 |
|
3994 |
|
4294 |
#ifdef HAVE_GTK_HANDLE_BOX_NEW |
|
|
4295 |
#define TOOLBAR_TOP_WIDGET(x) ((x)->handlebox_widget) |
4296 |
#else |
4297 |
#define TOOLBAR_TOP_WIDGET(x) ((x)->toolbar_widget) |
4298 |
#endif |
4299 |
|
4300 |
/* Attach a tool bar to frame F. */ |
3995 |
/* Attach a tool bar to frame F. */ |
4301 |
|
3996 |
|
4302 |
static void |
3997 |
static void |
Lines 4304-4334
Link Here
|
4304 |
{ |
3999 |
{ |
4305 |
struct x_output *x = f->output_data.x; |
4000 |
struct x_output *x = f->output_data.x; |
4306 |
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); |
4001 |
bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); |
4307 |
GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); |
4002 |
GtkWidget *top_widget = x->toolbar_widget; |
4308 |
|
4003 |
|
4309 |
toolbar_set_orientation (x->toolbar_widget, |
4004 |
toolbar_set_orientation (x->toolbar_widget, |
4310 |
into_hbox |
4005 |
into_hbox |
4311 |
? GTK_ORIENTATION_VERTICAL |
4006 |
? GTK_ORIENTATION_VERTICAL |
4312 |
: GTK_ORIENTATION_HORIZONTAL); |
4007 |
: GTK_ORIENTATION_HORIZONTAL); |
4313 |
#ifdef HAVE_GTK_HANDLE_BOX_NEW |
|
|
4314 |
if (!x->handlebox_widget) |
4315 |
{ |
4316 |
top_widget = x->handlebox_widget = gtk_handle_box_new (); |
4317 |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-detached", |
4318 |
G_CALLBACK (xg_tool_bar_detach_callback), f); |
4319 |
g_signal_connect (G_OBJECT (x->handlebox_widget), "child-attached", |
4320 |
G_CALLBACK (xg_tool_bar_attach_callback), f); |
4321 |
gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
4322 |
x->toolbar_widget); |
4323 |
} |
4324 |
#endif |
4325 |
|
4008 |
|
4326 |
if (into_hbox) |
4009 |
if (into_hbox) |
4327 |
{ |
4010 |
{ |
4328 |
#ifdef HAVE_GTK_HANDLE_BOX_NEW |
|
|
4329 |
gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), |
4330 |
GTK_POS_TOP); |
4331 |
#endif |
4332 |
gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget, |
4011 |
gtk_box_pack_start (GTK_BOX (x->hbox_widget), top_widget, |
4333 |
FALSE, FALSE, 0); |
4012 |
FALSE, FALSE, 0); |
4334 |
|
4013 |
|
Lines 4341-4350
Link Here
|
4341 |
else |
4020 |
else |
4342 |
{ |
4021 |
{ |
4343 |
bool vbox_pos = x->menubar_widget != 0; |
4022 |
bool vbox_pos = x->menubar_widget != 0; |
4344 |
#ifdef HAVE_GTK_HANDLE_BOX_NEW |
|
|
4345 |
gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), |
4346 |
GTK_POS_LEFT); |
4347 |
#endif |
4348 |
gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget, |
4023 |
gtk_box_pack_start (GTK_BOX (x->vbox_widget), top_widget, |
4349 |
FALSE, FALSE, 0); |
4024 |
FALSE, FALSE, 0); |
4350 |
|
4025 |
|
Lines 4497-4506
Link Here
|
4497 |
intptr_t ii = i; |
4172 |
intptr_t ii = i; |
4498 |
gpointer gi = (gpointer) ii; |
4173 |
gpointer gi = (gpointer) ii; |
4499 |
|
4174 |
|
4500 |
g_signal_connect (G_OBJECT (ti), "create-menu-proxy", |
|
|
4501 |
G_CALLBACK (xg_tool_bar_menu_proxy), |
4502 |
gi); |
4503 |
|
4504 |
g_signal_connect (G_OBJECT (wb), "clicked", |
4175 |
g_signal_connect (G_OBJECT (wb), "clicked", |
4505 |
G_CALLBACK (xg_tool_bar_callback), |
4176 |
G_CALLBACK (xg_tool_bar_callback), |
4506 |
gi); |
4177 |
gi); |
Lines 4614-4620
Link Here
|
4614 |
struct x_output *x = f->output_data.x; |
4285 |
struct x_output *x = f->output_data.x; |
4615 |
GtkRequisition req; |
4286 |
GtkRequisition req; |
4616 |
int nl = 0, nr = 0, nt = 0, nb = 0; |
4287 |
int nl = 0, nr = 0, nt = 0, nb = 0; |
4617 |
GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); |
4288 |
GtkWidget *top_widget = x->toolbar_widget; |
4618 |
|
4289 |
|
4619 |
gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req); |
4290 |
gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req); |
4620 |
if (x->toolbar_in_hbox) |
4291 |
if (x->toolbar_in_hbox) |
Lines 4653-4658
Link Here
|
4653 |
return 0; |
4324 |
return 0; |
4654 |
} |
4325 |
} |
4655 |
|
4326 |
|
|
|
4327 |
static char * |
4328 |
find_icon_from_name (char *name, |
4329 |
GtkIconTheme *icon_theme, |
4330 |
char **icon_name) |
4331 |
{ |
4332 |
#if ! GTK_CHECK_VERSION (3, 10, 0) |
4333 |
GtkStockItem stock_item; |
4334 |
#endif |
4335 |
|
4336 |
if (name[0] == 'n' && name[1] == ':') |
4337 |
{ |
4338 |
*icon_name = name + 2; |
4339 |
name = NULL; |
4340 |
|
4341 |
if (! gtk_icon_theme_has_icon (icon_theme, *icon_name)) |
4342 |
*icon_name = NULL; |
4343 |
} |
4344 |
|
4345 |
#if ! GTK_CHECK_VERSION (3, 10, 0) |
4346 |
else if (gtk_stock_lookup (name, &stock_item)) |
4347 |
*icon_name = NULL; |
4348 |
#endif |
4349 |
else if (gtk_icon_theme_has_icon (icon_theme, name)) |
4350 |
{ |
4351 |
*icon_name = name; |
4352 |
name = NULL; |
4353 |
} |
4354 |
else |
4355 |
{ |
4356 |
name = NULL; |
4357 |
*icon_name = NULL; |
4358 |
} |
4359 |
|
4360 |
return name; |
4361 |
} |
4362 |
|
4656 |
|
4363 |
|
4657 |
/* Update the tool bar for frame F. Add new buttons and remove old. */ |
4364 |
/* Update the tool bar for frame F. Add new buttons and remove old. */ |
4658 |
|
4365 |
|
Lines 4668-4673
Link Here
|
4668 |
Lisp_Object style; |
4375 |
Lisp_Object style; |
4669 |
bool text_image, horiz; |
4376 |
bool text_image, horiz; |
4670 |
struct xg_frame_tb_info *tbinfo; |
4377 |
struct xg_frame_tb_info *tbinfo; |
|
|
4378 |
GdkScreen *screen; |
4379 |
GtkIconTheme *icon_theme; |
4380 |
|
4671 |
|
4381 |
|
4672 |
if (! FRAME_GTK_WIDGET (f)) |
4382 |
if (! FRAME_GTK_WIDGET (f)) |
4673 |
return; |
4383 |
return; |
Lines 4702-4707
Link Here
|
4702 |
dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); |
4412 |
dir = gtk_widget_get_direction (GTK_WIDGET (wtoolbar)); |
4703 |
|
4413 |
|
4704 |
style = Ftool_bar_get_system_style (); |
4414 |
style = Ftool_bar_get_system_style (); |
|
|
4415 |
screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar)); |
4416 |
icon_theme = gtk_icon_theme_get_for_screen (screen); |
4705 |
|
4417 |
|
4706 |
/* Are we up to date? */ |
4418 |
/* Are we up to date? */ |
4707 |
tbinfo = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), |
4419 |
tbinfo = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)), |
Lines 4738-4744
Link Here
|
4738 |
struct image *img = NULL; |
4450 |
struct image *img = NULL; |
4739 |
Lisp_Object image; |
4451 |
Lisp_Object image; |
4740 |
Lisp_Object stock = Qnil; |
4452 |
Lisp_Object stock = Qnil; |
4741 |
GtkStockItem stock_item; |
|
|
4742 |
char *stock_name = NULL; |
4453 |
char *stock_name = NULL; |
4743 |
char *icon_name = NULL; |
4454 |
char *icon_name = NULL; |
4744 |
Lisp_Object rtl; |
4455 |
Lisp_Object rtl; |
Lines 4792-4823
Link Here
|
4792 |
if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock))) |
4503 |
if (!NILP (specified_file) && !NILP (Ffboundp (Qx_gtk_map_stock))) |
4793 |
stock = call1 (Qx_gtk_map_stock, specified_file); |
4504 |
stock = call1 (Qx_gtk_map_stock, specified_file); |
4794 |
|
4505 |
|
4795 |
if (STRINGP (stock)) |
4506 |
if (CONSP (stock)) |
4796 |
{ |
4507 |
{ |
4797 |
stock_name = SSDATA (stock); |
4508 |
Lisp_Object tem; |
4798 |
if (stock_name[0] == 'n' && stock_name[1] == ':') |
4509 |
for (tem = stock; CONSP (tem); tem = XCDR (tem)) |
4799 |
{ |
4510 |
if (! NILP (tem) && STRINGP (XCAR (tem))) |
4800 |
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (wtoolbar)); |
4511 |
{ |
4801 |
GtkIconTheme *icon_theme = gtk_icon_theme_get_for_screen (screen); |
4512 |
stock_name = find_icon_from_name (SSDATA (XCAR (tem)), |
4802 |
|
4513 |
icon_theme, |
4803 |
icon_name = stock_name + 2; |
4514 |
&icon_name); |
4804 |
stock_name = NULL; |
4515 |
if (stock_name || icon_name) break; |
4805 |
stock = Qnil; |
4516 |
} |
4806 |
|
4517 |
} |
4807 |
if (! gtk_icon_theme_has_icon (icon_theme, icon_name)) |
4518 |
else if (STRINGP (stock)) |
4808 |
icon_name = NULL; |
4519 |
{ |
4809 |
else |
4520 |
stock_name = find_icon_from_name (SSDATA (stock), |
4810 |
icon_size = gtk_toolbar_get_icon_size (wtoolbar); |
4521 |
icon_theme, |
4811 |
} |
4522 |
&icon_name); |
4812 |
else if (gtk_stock_lookup (SSDATA (stock), &stock_item)) |
|
|
4813 |
icon_size = gtk_toolbar_get_icon_size (wtoolbar); |
4814 |
else |
4815 |
{ |
4816 |
stock = Qnil; |
4817 |
stock_name = NULL; |
4818 |
} |
4819 |
} |
4523 |
} |
4820 |
|
4524 |
|
|
|
4525 |
if (stock_name || icon_name) |
4526 |
icon_size = gtk_toolbar_get_icon_size (wtoolbar); |
4527 |
|
4821 |
if (stock_name == NULL && icon_name == NULL) |
4528 |
if (stock_name == NULL && icon_name == NULL) |
4822 |
{ |
4529 |
{ |
4823 |
/* No stock image, or stock item not known. Try regular |
4530 |
/* No stock image, or stock item not known. Try regular |
Lines 4878-4884
Link Here
|
4878 |
w = NULL; |
4585 |
w = NULL; |
4879 |
else if (stock_name) |
4586 |
else if (stock_name) |
4880 |
{ |
4587 |
{ |
|
|
4588 |
|
4589 |
#if GTK_CHECK_VERSION (3, 10, 0) |
4590 |
w = gtk_image_new_from_icon_name (stock_name, icon_size); |
4591 |
#else |
4881 |
w = gtk_image_new_from_stock (stock_name, icon_size); |
4592 |
w = gtk_image_new_from_stock (stock_name, icon_size); |
|
|
4593 |
#endif |
4882 |
g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME, |
4594 |
g_object_set_data_full (G_OBJECT (w), XG_TOOL_BAR_STOCK_NAME, |
4883 |
(gpointer) xstrdup (stock_name), |
4595 |
(gpointer) xstrdup (stock_name), |
4884 |
(GDestroyNotify) xfree); |
4596 |
(GDestroyNotify) xfree); |
Lines 4920-4926
Link Here
|
4920 |
{ |
4632 |
{ |
4921 |
if (! x->toolbar_is_packed) |
4633 |
if (! x->toolbar_is_packed) |
4922 |
xg_pack_tool_bar (f, f->tool_bar_position); |
4634 |
xg_pack_tool_bar (f, f->tool_bar_position); |
4923 |
gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x)); |
4635 |
gtk_widget_show_all (x->toolbar_widget); |
4924 |
if (xg_update_tool_bar_sizes (f)) |
4636 |
if (xg_update_tool_bar_sizes (f)) |
4925 |
xg_height_or_width_changed (f); |
4637 |
xg_height_or_width_changed (f); |
4926 |
} |
4638 |
} |
Lines 4939-4949
Link Here
|
4939 |
if (x->toolbar_widget) |
4651 |
if (x->toolbar_widget) |
4940 |
{ |
4652 |
{ |
4941 |
struct xg_frame_tb_info *tbinfo; |
4653 |
struct xg_frame_tb_info *tbinfo; |
4942 |
GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); |
4654 |
GtkWidget *top_widget = x->toolbar_widget; |
4943 |
|
4655 |
|
4944 |
block_input (); |
4656 |
block_input (); |
4945 |
/* We may have created the toolbar_widget in xg_create_tool_bar, but |
|
|
4946 |
not the x->handlebox_widget which is created in xg_pack_tool_bar. */ |
4947 |
if (x->toolbar_is_packed) |
4657 |
if (x->toolbar_is_packed) |
4948 |
{ |
4658 |
{ |
4949 |
if (x->toolbar_in_hbox) |
4659 |
if (x->toolbar_in_hbox) |
Lines 4957-4963
Link Here
|
4957 |
gtk_widget_destroy (x->toolbar_widget); |
4667 |
gtk_widget_destroy (x->toolbar_widget); |
4958 |
|
4668 |
|
4959 |
x->toolbar_widget = 0; |
4669 |
x->toolbar_widget = 0; |
4960 |
TOOLBAR_TOP_WIDGET (x) = 0; |
4670 |
x->toolbar_widget = 0; |
4961 |
x->toolbar_is_packed = false; |
4671 |
x->toolbar_is_packed = false; |
4962 |
FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; |
4672 |
FRAME_TOOLBAR_TOP_HEIGHT (f) = FRAME_TOOLBAR_BOTTOM_HEIGHT (f) = 0; |
4963 |
FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; |
4673 |
FRAME_TOOLBAR_LEFT_WIDTH (f) = FRAME_TOOLBAR_RIGHT_WIDTH (f) = 0; |
Lines 4982-4988
Link Here
|
4982 |
xg_change_toolbar_position (struct frame *f, Lisp_Object pos) |
4692 |
xg_change_toolbar_position (struct frame *f, Lisp_Object pos) |
4983 |
{ |
4693 |
{ |
4984 |
struct x_output *x = f->output_data.x; |
4694 |
struct x_output *x = f->output_data.x; |
4985 |
GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); |
4695 |
GtkWidget *top_widget = x->toolbar_widget; |
4986 |
|
4696 |
|
4987 |
if (! x->toolbar_widget || ! top_widget) |
4697 |
if (! x->toolbar_widget || ! top_widget) |
4988 |
return; |
4698 |
return; |
Lines 5026-5034
Link Here
|
5026 |
|
4736 |
|
5027 |
gdpy_def = NULL; |
4737 |
gdpy_def = NULL; |
5028 |
xg_ignore_gtk_scrollbar = 0; |
4738 |
xg_ignore_gtk_scrollbar = 0; |
5029 |
#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
|
|
5030 |
xg_detached_menus = 0; |
5031 |
#endif |
5032 |
xg_menu_cb_list.prev = xg_menu_cb_list.next = |
4739 |
xg_menu_cb_list.prev = xg_menu_cb_list.next = |
5033 |
xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; |
4740 |
xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; |
5034 |
|
4741 |
|
5035 |
-- emacs-24.5-orig/src/gtkutil.h |
4742 |
++ emacs-24.5/src/gtkutil.h |
Lines 107-114
Link Here
|
107 |
|
107 |
|
108 |
extern bool xg_event_is_for_menubar (struct frame *, const XEvent *); |
108 |
extern bool xg_event_is_for_menubar (struct frame *, const XEvent *); |
109 |
|
109 |
|
110 |
extern bool xg_have_tear_offs (struct frame *f); |
|
|
111 |
|
112 |
extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); |
110 |
extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); |
113 |
|
111 |
|
114 |
extern void xg_create_scroll_bar (struct frame *f, |
112 |
extern void xg_create_scroll_bar (struct frame *f, |
115 |
-- emacs-24.5-orig/src/xfns.c |
113 |
++ emacs-24.5/src/xfns.c |
Lines 6221-6232
Link Here
|
6221 |
to turn the additional text off. */); |
6221 |
to turn the additional text off. */); |
6222 |
x_gtk_file_dialog_help_text = 1; |
6222 |
x_gtk_file_dialog_help_text = 1; |
6223 |
|
6223 |
|
6224 |
DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar, |
|
|
6225 |
doc: /* If non-nil, a detached tool bar is shown in full. |
6226 |
The default is to just show an arrow and pressing on that arrow shows |
6227 |
the tool bar buttons. */); |
6228 |
x_gtk_whole_detached_tool_bar = 0; |
6229 |
|
6230 |
DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips, |
6224 |
DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips, |
6231 |
doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used. |
6225 |
doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used. |
6232 |
Otherwise use Emacs own tooltip implementation. |
6226 |
Otherwise use Emacs own tooltip implementation. |
6233 |
-- emacs-24.5-orig/src/xmenu.c |
6227 |
++ emacs-24.5/src/xmenu.c |
Lines 793-804
Link Here
|
793 |
f->output_data.x->saved_menu_event->type = 0; |
793 |
f->output_data.x->saved_menu_event->type = 0; |
794 |
} |
794 |
} |
795 |
|
795 |
|
796 |
#ifdef USE_GTK |
|
|
797 |
/* If we have detached menus, we must update deep so detached menus |
798 |
also gets updated. */ |
799 |
deep_p = deep_p || xg_have_tear_offs (f); |
800 |
#endif |
801 |
|
802 |
if (deep_p) |
796 |
if (deep_p) |
803 |
{ |
797 |
{ |
804 |
/* Make a widget-value tree representing the entire menu trees. */ |
798 |
/* Make a widget-value tree representing the entire menu trees. */ |
805 |
-- emacs-24.5-orig/src/xterm.h |
799 |
++ emacs-24.5/src/xterm.h |
Lines 491-500
Link Here
|
491 |
GtkWidget *menubar_widget; |
491 |
GtkWidget *menubar_widget; |
492 |
/* The tool bar in this frame */ |
492 |
/* The tool bar in this frame */ |
493 |
GtkWidget *toolbar_widget; |
493 |
GtkWidget *toolbar_widget; |
494 |
#ifdef HAVE_GTK_HANDLE_BOX_NEW |
|
|
495 |
/* The handle box that makes the tool bar detachable. */ |
496 |
GtkWidget *handlebox_widget; |
497 |
#endif |
498 |
/* True if tool bar is packed into the hbox widget (i.e. vertical). */ |
494 |
/* True if tool bar is packed into the hbox widget (i.e. vertical). */ |
499 |
bool_bf toolbar_in_hbox : 1; |
495 |
bool_bf toolbar_in_hbox : 1; |
500 |
bool_bf toolbar_is_packed : 1; |
496 |
bool_bf toolbar_is_packed : 1; |