(define-key map "\C-x70" 'tab-delete)
(define-key map "\C-x71" 'tab-delete-other)
(define-key map "\C-x72" 'tab-new)
- (define-key map "\C-x73" 'switch-to-buffer-tab)
+ (define-key map "\C-x73" 'switch-to-buffer-in-tab)
(define-key map "\C-x7b" 'switch-to-buffer-other-tab)
(define-key map "\C-x7f" 'find-file-new-tab)
(define-key map "\C-x7o" 'tab-next)
:keymap tab-mode-map
(modify-all-frames-parameters (list (cons 'disable-tabs (not tab-mode)))))
-(declare-function tab-new "xfns.c" ())
-(declare-function tab-delete "xfns.c" ())
-(declare-function tab-delete-other "xfns.c" ())
-(declare-function tab-next "xfns.c" ())
-(declare-function tab-previous "xfns.c" ())
-(declare-function tab-nr-of-tabs "xfns.c" ())
-(declare-function tab-configuration "xfns.c" ())
-(declare-function tab-current "xfns.c" ())
-(declare-function tab-show "xfns.c" ())
-(declare-function tab-enable "xfns.c" ())
+(declare-function tab-new "xfns.c" (&optional label frame))
+(declare-function tab-delete "xfns.c" (&optional label frame))
+(declare-function tab-delete-other "xfns.c" (&optional frame))
+(declare-function tab-next "xfns.c" (&optional frame))
+(declare-function tab-previous "xfns.c" (&optional frame))
+(declare-function tab-nr-of-tabs "xfns.c" (&optional frame))
+(declare-function tab-current "xfns.c" (&optional frame))
+(declare-function tab-show "xfns.c" (key &optional frame))
+(declare-function tab-enable "xfns.c" (enable &optional frame))
+
+(defun current-tab-window-config ()
+ (list (current-window-configuration) (point-marker)))
+
+(defun window-tab-config-frame (config)
+ (if (and (consp config) (window-configuration-p (car config)))
+ (window-configuration-frame (car config))
+ nil))
+
+(defun set-tab-window-config (config)
+ (and (consp config) (window-configuration-p (car config))
+ (set-window-configuration (car config))
+ (goto-char (cadr config))))
+
+(defun change-tab-window-config-frame (config frame)
+ (if (and (consp config) (window-configuration-p (car config)))
+ (list (change-window-configuration-frame (car config) frame)
+ (cadr config))
+ config))
(defun find-file-new-tab (filename &optional wildcards)
"Edit file FILENAME, in a new tab.
(interactive
(find-file-read-args "Find file in new tab: "
(confirm-nonexistent-file-or-buffer)))
- (let ((value (find-file-noselect filename nil nil wildcards)))
- (if (not (null (tab-new)))
- (progn
- (delete-other-windows)
- (if (listp value)
- (progn
- (setq value (nreverse value))
- (cons (switch-to-buffer (car value))
- (mapcar 'switch-to-buffer (cdr value))))
- (switch-to-buffer value))))))
+ (save-window-excursion
+ (let* ((value (find-file-noselect filename nil nil wildcards))
+ (newtab (tab-new)))
+ (if newtab
+ (progn
+ (delete-other-windows)
+ (if (listp value)
+ (progn
+ (setq value (nreverse value))
+ (cons (switch-to-buffer (car value))
+ (dolist 'switch-to-buffer (cdr value))))
+ (switch-to-buffer value))
+ (put newtab 'winconfig (current-tab-window-config)))))))
+
(defun switch-to-buffer-other-tab (buffer-or-name &optional norecord)
"Switch to buffer BUFFER-OR-NAME in another tab.
(delete-other-windows)))))
-(defun display-existing-buffer-in-tab (buffer-or-name &optional frame)
- "Switch to a tab that shows BUFFER-OR-NAME on FRAME.
+(defun find-tab-for-existing-buffer (buffer-or-name &optional frame)
+ "Find a tab that shows BUFFER-OR-NAME on FRAME.
FRAME nil means selected frame.
Returns the key for the tab switch to, or nil if no tab displays
(tab-key))
(while (and tabs (null tab-key))
(let* ((elt (car tabs))
- (winconf (cadr elt))
+ (winconf (get elt 'winconfig))
(buffers (buffers-in-window-configuration winconf)))
(if (memq buffer buffers)
- (setq tab-key (car elt))
+ (setq tab-key elt)
(setq tabs (cdr tabs)))))
- (if (and tab-key (not (equal tab-key (tab-current frame))))
- (progn
- (tab-show tab-key frame)
- tab-key)
- nil)))
+ tab-key))
-(defun switch-to-buffer-tab (buffer-or-name &optional frame)
+(defun switch-to-buffer-in-tab (buffer-or-name &optional frame)
(interactive "BSwitch to buffer:\nP")
- (if (not (display-existing-buffer-in-tab buffer-or-name frame))
- (switch-to-buffer buffer-or-name)))
+ (let ((tab (find-tab-for-existing-buffer buffer-or-name frame)))
+ (if tab
+ (tab-show tab frame)
+ (switch-to-buffer buffer-or-name))))
(defun handle-tab-event (event)
"Handle tab-event to change tabs on the frame in EVENT."
(frame (car n1))
(x (car (cdr n1)))
(y (cdr (cdr n1))))
- (if (eq type 2) ;; // A tab is dropped from another frame.
- (let ((top y)
- (left x)
- (width (frame-pixel-width frame))
- (height (frame-pixel-height frame))
- (dw (x-display-pixel-width frame))
- (dh (x-display-pixel-height frame)))
- (if (< dw (+ left width))
- (setq left (- dw width)))
- (if (< dh (+ top height))
- (setq top (- dh height)))
- (make-frame
- (list (cons 'width (frame-parameter frame 'width))
- (cons 'height(frame-parameter frame 'height))
- (cons 'top top)
- (cons 'left left)))))))
-
-(define-key special-event-map [tab-event] 'handle-tab-event)
+ (cond ((eq type 'tab-new-frame) ;; // A tab is dropped to the background.
+ (let ((tab (car (cdr n2)))
+ (top y)
+ (left x)
+ (width (frame-pixel-width frame))
+ (height (frame-pixel-height frame))
+ (dw (x-display-pixel-width frame))
+ (dh (x-display-pixel-height frame)))
+ (if (< dw (+ left width))
+ (setq left (- dw width)))
+ (if (< dh (+ top height))
+ (setq top (- dh height)))
+ (make-frame
+ (list (cons 'width (frame-parameter frame 'width))
+ (cons 'height(frame-parameter frame 'height))
+ (cons 'top top)
+ (cons 'left left)))))
+
+ ((eq type 'tab-changed)
+ (let* ((newtab (car (cdr n2)))
+ (newcfg (get newtab 'winconfig))
+ (oldtab (cdr (cdr n2))))
+ (if oldtab (put oldtab 'winconfig (current-tab-window-config)))
+ (if newcfg (set-tab-window-config
+ (if (eq (window-tab-config-frame newcfg) frame)
+ newcfg
+ (put newtab 'winconfig
+ (change-tab-window-config-frame newcfg frame))))
+ (delete-other-windows)))))))
+(define-key special-event-map [tab-event] 'handle-tab-event)
/* Avoid "differ in sign" warnings */
#define SSDATA(x) ((char *) SDATA (x))
+static Lisp_Object Qfile_sans_ext, Qx_gtk_map_stock;
+
\f
/***********************************************************************
Display handling functions
Tab functions
***********************************************************************/
#define XG_TAB_KEY "emacs-tab-key"
-#define XG_TAB_CONFIG_KEY "emacs-tab-config-key"
+
static int xg_tab_nr;
-static xg_list_node tabs_gc_list;
static GtkNotebook* notebook_on_hold;
+static Lisp_Object Qtab_new_frame, Qtab_changed, Qtab_added, Qtab_removed;
-/* If 1, show tabs even if there is only one tab. */
+/* If non-zero, show tabs even if there is only one tab. */
static int xg_always_show_tabs;
-typedef struct
-{
- xg_list_node ptrs;
- Lisp_Object object;
-} tabs_gc_data;
-
-
-/* Store the current window configuration for frame F in widget W. */
-
-static tabs_gc_data *
-xg_store_win_config (GtkWidget *w, FRAME_PTR f)
+static void
+store_tab_event (FRAME_PTR f,
+ Lisp_Object arg,
+ int x,
+ int y)
{
+ struct input_event event;
Lisp_Object frame;
- tabs_gc_data *conf = xmalloc (sizeof(*conf));
XSETFRAME (frame, f);
- g_object_set_data (G_OBJECT (w), XG_TAB_CONFIG_KEY, conf);
- xg_list_insert (&tabs_gc_list, &conf->ptrs);
- conf->object = Fcurrent_window_configuration (frame);
- return conf;
+ EVENT_INIT (event);
+ event.kind = TAB_EVENT;
+ event.frame_or_window = frame;
+ event.arg = arg;
+ event.x = make_number (x);
+ event.y = make_number (y);
+ kbd_buffer_store_event (&event);
}
static void
if ((shown && !should_show) || (!shown && should_show))
{
- GtkRequisition req;
int oldheight, row_add = 0;
+ if (should_show)
+ gtk_widget_show_all (GTK_WIDGET (wnote));
+ else
+ gtk_widget_hide (GTK_WIDGET (wnote));
gtk_notebook_set_show_tabs (wnote, should_show);
oldheight = FRAME_TABS_HEIGHT (f);
- gtk_widget_size_request (f->output_data.x->notebook_widget, &req);
- if (req.height > FRAME_PIXEL_HEIGHT (f))
- FRAME_TABS_HEIGHT (f) = req.height - FRAME_PIXEL_HEIGHT (f);
+ if (should_show)
+ {
+ GtkRequisition req;
+ gtk_widget_size_request (f->output_data.x->notebook_widget, &req);
+ FRAME_TABS_HEIGHT (f) = req.height;
+ }
else
FRAME_TABS_HEIGHT (f) = 0;
+
x_wm_set_size_hint (f, 0, 0);
/* Try to minimize resize, when adding/removing the tabs, add some text
}
}
-/* Callback called when a new tab has been added.
- Handle the case when a page has been dropped from another frame. */
+/* Callback called when a new tab has been added. */
static void
xg_page_added_cb (GtkNotebook *notebook,
gpointer user_data)
{
FRAME_PTR f = (FRAME_PTR) user_data;
- tabs_gc_data *conf = g_object_get_data (G_OBJECT (child), XG_TAB_CONFIG_KEY);
+ char *newkey = g_object_get_data (G_OBJECT (child), XG_TAB_KEY);
+ GtkWidget *old = f->output_data.x->current_tab;
- /* Dropped from another frame? */
- if (conf
- && Fwindow_configuration_p (conf->object) &&
- XFRAME (Fwindow_configuration_frame (conf->object)) != f)
+ store_tab_event (f, Fcons (Qtab_added,
+ Fcons (intern (newkey), Qnil)),
+ 0, 0);
+ if (old == NULL)
{
- Lisp_Object frame;
- XSETFRAME (frame, f);
- Fchange_window_configuration_frame (conf->object, frame);
+ old = child;
+ store_tab_event (f, Fcons (Qtab_changed, Fcons (intern (newkey), Qnil)),
+ 0, 0);
}
}
+/* Callback called when a new tab has been added. */
+
+static void
+xg_page_removed_cb (GtkNotebook *notebook,
+ GtkWidget *child,
+ guint page_num,
+ gpointer user_data)
+{
+ FRAME_PTR f = (FRAME_PTR) user_data;
+ char *key = g_object_get_data (G_OBJECT (child), XG_TAB_KEY);
+
+ store_tab_event (f, Fcons (Qtab_removed,
+ Fcons (intern (key), Qnil)),
+ 0, 0);
+
+}
+
/* Callback called when the current tab changes. */
static void
guint page_num,
gpointer user_data)
{
- BLOCK_INPUT;
GtkWidget *w = gtk_notebook_get_nth_page (wnote, page_num);
FRAME_PTR f = (FRAME_PTR) user_data;
+ GtkWidget *old = f->output_data.x->current_tab;
- if (FRAME_GTK_WIDGET (f) && w != FRAME_GTK_WIDGET (f))
+ BLOCK_INPUT;
+ if (w != old)
{
- GtkWidget *old = FRAME_GTK_WIDGET (f);
- GList *children = old ? GTK_FIXED (old)->children : NULL;
- GSList *todo = NULL, *iter;
char *key = g_object_get_data (G_OBJECT (w), XG_TAB_KEY);
- tabs_gc_data *conf = g_object_get_data (G_OBJECT (w), XG_TAB_CONFIG_KEY);
-
- if (!w->window) gtk_widget_realize (w);
- FRAME_GTK_WIDGET (f) = w;
- FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (w);
- for ( ; children; children = g_list_next (children))
- {
- GtkFixedChild *child = (GtkFixedChild*)children->data;
- if (GTK_IS_EVENT_BOX (child->widget))
- {
- GtkFixedChild *node = xmalloc (sizeof(*node));
- *node = *child;
- todo = g_slist_prepend (todo, node);
- }
- }
-
- for (iter = todo; iter; iter = g_slist_next (iter))
- {
- GtkFixedChild *child = (GtkFixedChild*)iter->data;
- GtkWidget *wevbox = child->widget;
- g_object_ref (G_OBJECT (wevbox));
- gtk_container_remove (GTK_CONTAINER (old), wevbox);
- gtk_fixed_put (GTK_FIXED (w), wevbox, child->x, child->y);
- g_object_unref (G_OBJECT (wevbox));
- xfree (child);
- iter->data = NULL;
- }
- if (todo) g_slist_free (todo);
-
- SET_FRAME_GARBAGED (f);
- cancel_mouse_face (f);
-
- if (old)
- {
- struct input_event event;
- Lisp_Object frame;
-
- char *oldkey = g_object_get_data (G_OBJECT (old), XG_TAB_KEY);
- tabs_gc_data *oconf = g_object_get_data (G_OBJECT (old),
- XG_TAB_CONFIG_KEY);
- if (!oconf)
- oconf = xg_store_win_config (old, f);
-
- XSETFRAME (frame, f);
-
- EVENT_INIT (event);
- event.kind = TAB_EVENT;
- event.frame_or_window = frame;
- event.arg = Fcons (make_number (1),
- Fcons (make_string (key, strlen (key)),
- make_string (oldkey, strlen (oldkey))));
- kbd_buffer_store_event (&event);
- }
-
- if (conf)
- Fset_window_configuration (conf->object);
- else
- Fdelete_other_windows (Qnil);
+ char *oldkey = old
+ ? g_object_get_data (G_OBJECT (old), XG_TAB_KEY)
+ : NULL;
+
+ store_tab_event (f,
+ Fcons (Qtab_changed,
+ Fcons (intern (key),
+ oldkey ? intern (oldkey) : Qnil)),
+ 0, 0);
}
+
+ f->output_data.x->current_tab = w;
xg_check_show_tabs (f, wnote);
UNBLOCK_INPUT;
}
gpointer client_data)
{
char *key = g_object_get_data (G_OBJECT (widget), XG_TAB_KEY);
- tabs_gc_data *conf = g_object_get_data (G_OBJECT (widget), XG_TAB_CONFIG_KEY);
- if (conf)
- {
- xg_list_remove (&tabs_gc_list, &conf->ptrs);
- xfree (conf);
- }
xfree (key);
}
GtkWidget *wfixed = gtk_fixed_new ();
GdkColor bg;
GtkRcStyle *style;
- char buf[64];
- char *key;
gtk_widget_set_name (wfixed, SSDATA (Vx_resource_name));
g_object_set_data (G_OBJECT (wfixed), XG_FRAME_DATA, (gpointer)f);
gtk_widget_modify_style (wfixed, style);
gtk_widget_show (wfixed);
- /* Not really needed on tab-less frames, but set it anyway so enabling
- of tabs later becomes easier. */
- sprintf (buf, "Page %d", xg_tab_nr++);
+ return wfixed;
+}
+
+static GtkWidget *
+xg_add_fixed_for_tab (FRAME_PTR f)
+{
+ char buf[64];
+ GtkWidget *wfixed = gtk_fixed_new ();
+ char *key;
+
+ gtk_widget_set_size_request (wfixed, 0, 0);
+ g_object_set_data (G_OBJECT (wfixed), XG_FRAME_DATA, (gpointer)f);
+ sprintf (buf, "Page_%d", xg_tab_nr++);
key = xstrdup (buf);
g_object_set_data (G_OBJECT (wfixed), XG_TAB_KEY, key);
g_signal_connect (G_OBJECT (wfixed),
"destroy",
G_CALLBACK (xg_fixed_destroy_cb), 0);
-
-
+ gtk_widget_show (wfixed);
return wfixed;
}
xg_add_tab (FRAME_PTR f,
const char *name)
{
- GtkNotebook *wnote = GTK_NOTEBOOK (f->output_data.x->notebook_widget);
- GtkWidget *wfixed = xg_add_fixed (f);
- char *key = g_object_get_data (G_OBJECT (wfixed), XG_TAB_KEY);
+ GtkNotebook *wnote;
+ GtkWidget *wfixed;
+ char *key;
int n;
- GtkWidget *wlbl = xg_tab_label_widget (f, name, wfixed);
+ GtkWidget *wlbl;
BLOCK_INPUT;
+ wnote = GTK_NOTEBOOK (f->output_data.x->notebook_widget);
+ wfixed = xg_add_fixed_for_tab (f);
+ key = g_object_get_data (G_OBJECT (wfixed), XG_TAB_KEY);
+
+ wlbl = xg_tab_label_widget (f, name, wfixed);
n = gtk_notebook_append_page (wnote, wfixed, wlbl);
gtk_notebook_set_tab_reorderable (wnote, wfixed, TRUE);
gtk_notebook_set_tab_detachable (wnote, wfixed, TRUE);
if (n > 0)
- {
- gtk_notebook_set_current_page (wnote, n);
- xg_switch_page_cb (wnote, NULL, n, f);
- }
+ gtk_notebook_set_current_page (wnote, n);
UNBLOCK_INPUT;
return key;
int new_page = page_to_remove + 1;
if (new_page == pages) new_page = page_to_remove - 1;
gtk_notebook_set_current_page (wnote, new_page);
- xg_switch_page_cb (wnote, NULL, new_page, f);
}
gtk_notebook_remove_page (wnote, page_to_remove);
}
gint y,
gpointer data)
{
- struct input_event event;
- Lisp_Object frame;
FRAME_PTR f = g_object_get_data (G_OBJECT (page), XG_FRAME_DATA);
- tabs_gc_data *oconf = g_object_get_data (G_OBJECT (page),
- XG_TAB_CONFIG_KEY);
- XSETFRAME (frame, f);
- if (!oconf) oconf = xg_store_win_config (page, f);
-
-
- EVENT_INIT (event);
- event.kind = TAB_EVENT;
- event.frame_or_window = frame;
- event.arg = Fcons (make_number (2), Qnil);
- event.x = make_number (x);
- event.y = make_number (y);
- kbd_buffer_store_event (&event);
-
- return notebook_on_hold = GTK_NOTEBOOK (gtk_notebook_new ());
+ GtkWidget *cur = f->output_data.x->current_tab;
+ char *key = g_object_get_data (G_OBJECT (cur), XG_TAB_KEY);
+
+ notebook_on_hold = GTK_NOTEBOOK (gtk_notebook_new ());
+ store_tab_event (f, Fcons (Qtab_new_frame,
+ Fcons (intern (key), Qnil)),
+ x, y);
+ return notebook_on_hold;
}
int
}
if (page >= 0 && page < pages && page != current_page)
- {
- gtk_notebook_set_current_page (wnote, page);
- xg_switch_page_cb (wnote, NULL, page, f);
- }
+ gtk_notebook_set_current_page (wnote, page);
}
return (const char *)g_object_get_data (G_OBJECT (w), XG_TAB_KEY);
}
-Lisp_Object
-xg_tab_get_win_config (FRAME_PTR f, int nr)
-{
- GtkNotebook *wnote = GTK_NOTEBOOK (f->output_data.x->notebook_widget);
- GtkWidget *w;
- tabs_gc_data *conf;
-
- if (!wnote || nr >= gtk_notebook_get_n_pages (wnote)
- || (w = gtk_notebook_get_nth_page (wnote, nr)) == NULL)
- return Qnil;
-
- conf = g_object_get_data (G_OBJECT (w), XG_TAB_CONFIG_KEY);
- if (!conf) conf = xg_store_win_config (w, f);
- else if (w == FRAME_GTK_WIDGET (f))
- {
- Lisp_Object frame;
- XSETFRAME (frame, f);
- conf->object = Fcurrent_window_configuration (frame);
- }
- return conf ? conf->object : Qnil;
-}
-
void
xg_tabs_always_show (FRAME_PTR f, int show)
{
{
GtkRcStyle *style;
- gtk_box_pack_end (GTK_BOX (wvbox), wnote, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (wvbox), wnote, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (wvbox), wnote, -2);
+
g_signal_connect (G_OBJECT (wnote), "switch-page",
G_CALLBACK (xg_switch_page_cb), f);
g_signal_connect (G_OBJECT (wnote), "page-added",
G_CALLBACK (xg_page_added_cb), f);
+ g_signal_connect (G_OBJECT (wnote), "page-removed",
+ G_CALLBACK (xg_page_removed_cb), f);
g_object_set (G_OBJECT (wnote), "tab-border", 0, NULL);
gtk_notebook_popup_disable (GTK_NOTEBOOK (wnote));
|| (wnote != NULL && enable))
return;
- g_object_ref (G_OBJECT (wfixed));
if (enable)
{
GtkWidget *wlbl;
- char *key = g_object_get_data (G_OBJECT (wfixed), XG_TAB_KEY);
+ char *key;
wnote = gtk_notebook_new ();
+ wfixed = xg_add_fixed_for_tab (f);
+ key = g_object_get_data (G_OBJECT (wfixed), XG_TAB_KEY);
f->output_data.x->notebook_widget = wnote;
- gtk_container_remove (GTK_CONTAINER (wvbox), wfixed);
xg_setup_notebook (f, wvbox, wnote);
wlbl = xg_tab_label_widget (f, key, wfixed);
gtk_notebook_append_page (GTK_NOTEBOOK (wnote), wfixed, wlbl);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (wnote), wfixed, TRUE);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (wnote), wfixed, TRUE);
- gtk_widget_show_all (wnote);
}
else
{
xg_delete_all_tabs (f);
-
- /* Somehow scroll bars get destroyed when the notebook widget is
- destroyed even if I take a ref to them. So remove them from
- wfixed and later put them back. */
- GList *children = GTK_FIXED (wfixed)->children;
- GSList *todo = NULL, *iter;
- for ( ; children; children = g_list_next (children))
- {
- GtkFixedChild *child = (GtkFixedChild*)children->data;
- if (GTK_IS_EVENT_BOX (child->widget))
- {
- GtkFixedChild *node = xmalloc (sizeof(*node));
- *node = *child;
- todo = g_slist_prepend (todo, node);
- }
- }
-
- for (iter = todo; iter; iter = g_slist_next (iter))
- {
- GtkFixedChild *child = (GtkFixedChild*)iter->data;
- GtkWidget *wevbox = child->widget;
- g_object_ref (G_OBJECT (wevbox));
- g_object_ref (G_OBJECT (gtk_bin_get_child (GTK_BIN (wevbox))));
- gtk_container_remove (GTK_CONTAINER (wfixed), wevbox);
- }
-
gtk_container_remove (GTK_CONTAINER (wvbox), wnote);
- gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
f->output_data.x->notebook_widget = NULL;
-
- for (iter = todo; iter; iter = g_slist_next (iter))
- {
- GtkFixedChild *child = (GtkFixedChild*)iter->data;
- GtkWidget *wevbox = child->widget;
- gtk_fixed_put (GTK_FIXED (wfixed), wevbox, child->x, child->y);
- g_object_unref (G_OBJECT (wevbox));
- g_object_unref (G_OBJECT (gtk_bin_get_child (GTK_BIN (wevbox))));
- free (iter->data);
- }
-
- if (todo) g_slist_free (todo);
+ f->output_data.x->current_tab = NULL;
}
-
- gtk_widget_realize (wfixed);
- gtk_widget_show_all (wfixed);
- FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed);
- FRAME_GTK_WIDGET (f) = wfixed;
- g_object_unref (G_OBJECT (wfixed));
- gtk_widget_queue_draw (FRAME_GTK_WIDGET (f));
}
GtkWidget *wnote = NULL;
char *title = 0;
GtkWidget *wfixed;
- tabs_gc_data *conf;
BLOCK_INPUT;
FRAME_GTK_OUTER_WIDGET (f) = wtop;
f->output_data.x->vbox_widget = wvbox;
f->output_data.x->notebook_widget = wnote;
+ f->output_data.x->current_tab = NULL;
gtk_container_add (GTK_CONTAINER (wtop), wvbox);
f->win_gravity
= gtk_window_get_gravity (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
+ wfixed = xg_add_fixed (f);
+ gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
+
if (wnote)
{
xg_setup_notebook (f, wvbox, wnote);
if (!notebook_on_hold)
- xg_add_tab (f, "Page 1");
-
- wfixed = gtk_notebook_get_nth_page (GTK_NOTEBOOK (wnote), 0);
- }
- else
- {
- wfixed = xg_add_fixed (f);
- gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
+ xg_add_tab (f, "Page_1");
+ else
+ xg_page_added_cb (GTK_NOTEBOOK (wnote),
+ gtk_notebook_get_nth_page (GTK_NOTEBOOK (wnote),
+ 0),
+ 0, f);
}
+
/* Must realize the windows so the X window gets created. It is used
FRAME_X_WINDOW (f) = GTK_WIDGET_TO_X_WIN (wfixed);
FRAME_GTK_WIDGET (f) = wfixed;
- conf = g_object_get_data (G_OBJECT (wfixed), XG_TAB_CONFIG_KEY);
- if (conf
- && Fwindow_configuration_p (conf->object) &&
- XFRAME (Fwindow_configuration_frame (conf->object)) != f)
- {
- Lisp_Object frame;
- XSETFRAME (frame, f);
- Fchange_window_configuration_frame (conf->object, frame);
- Fset_window_configuration (conf->object);
- }
-
notebook_on_hold = NULL;
-
+ gtk_widget_show (wfixed);
+ gtk_widget_show (wvbox);
+
UNBLOCK_INPUT;
return 1;
if (! NILP (cb_data->help))
mark_object (cb_data->help);
}
- for (iter = tabs_gc_list.next; iter; iter = iter->next)
- mark_object (((tabs_gc_data *) iter)->object);
}
Lisp_Object rtl_image = PROP (TOOL_BAR_ITEM_IMAGES);
if (!NILP (file = file_for_image (rtl_image)))
{
- file = call1 (intern ("file-name-sans-extension"),
- Ffile_name_nondirectory (file));
+ file = call1 (Qfile_sans_ext,
+ Ffile_name_nondirectory (file));
if (EQ (Fequal (file, rtl_name), Qt))
{
image = rtl_image;
id_to_widget.max_size = id_to_widget.used = 0;
id_to_widget.widgets = 0;
xg_tab_nr = 1;
- tabs_gc_list.prev = tabs_gc_list.next = 0;
xg_always_show_tabs = 0;
/* Remove F10 as a menu accelerator, it does not mix well with Emacs key
"widget \"*\" style \"noborder\"\n");
}
+void
+syms_of_gtkutil ()
+{
+ Qtab_new_frame = intern_c_string ("tab-new-frame");
+ staticpro (&Qtab_new_frame);
+ Qtab_changed = intern_c_string ("tab-changed");
+ staticpro (&Qtab_changed);
+ Qtab_added = intern_c_string ("tab-added");
+ staticpro (&Qtab_added);
+ Qtab_removed = intern_c_string ("tab-removed");
+ staticpro (&Qtab_removed);
+ Qfile_sans_ext = intern_c_string ("file-name-sans-extension");
+ staticpro (&Qfile_sans_ext);
+ Qx_gtk_map_stock = intern_c_string ("x-gtk-map-stock");
+ staticpro (&Qx_gtk_map_stock);
+}
+
+
#endif /* USE_GTK */
/* arch-tag: fe7104da-bc1e-4aba-9bd1-f349c528f7e3