emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/gtkutil.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/gtkutil.c
Date: Tue, 04 Feb 2003 09:03:27 -0500

Index: emacs/src/gtkutil.c
diff -c emacs/src/gtkutil.c:1.9 emacs/src/gtkutil.c:1.10
*** emacs/src/gtkutil.c:1.9     Sun Feb  2 13:54:32 2003
--- emacs/src/gtkutil.c Tue Feb  4 09:03:12 2003
***************
*** 180,186 ****
  xg_list_insert (xg_list_node *list, xg_list_node *node)
  {
    xg_list_node *list_start = list->next;
!   
    if (list_start) list_start->prev = node;
    node->next = list_start;
    node->prev = 0;
--- 180,186 ----
  xg_list_insert (xg_list_node *list, xg_list_node *node)
  {
    xg_list_node *list_start = list->next;
! 
    if (list_start) list_start->prev = node;
    node->next = list_start;
    node->prev = 0;
***************
*** 213,219 ****
       char *str;
  {
    char *utf8_str = str;
!   
    /* If not UTF-8, try current locale.  */
    if (str && !g_utf8_validate (str, -1, NULL))
      utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
--- 213,219 ----
       char *str;
  {
    char *utf8_str = str;
! 
    /* If not UTF-8, try current locale.  */
    if (str && !g_utf8_validate (str, -1, NULL))
      utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0);
***************
*** 242,248 ****
      int top = f->output_data.x->top_pos;
      int yneg = f->output_data.x->size_hint_flags & YNegative;
      char geom_str[32];
!     
      if (xneg)
        left = -left;
      if (yneg)
--- 242,248 ----
      int top = f->output_data.x->top_pos;
      int yneg = f->output_data.x->size_hint_flags & YNegative;
      char geom_str[32];
! 
      if (xneg)
        left = -left;
      if (yneg)
***************
*** 260,266 ****
    }
  }
  
!      
  /* Resize the outer window of frame F after chainging the height.
     This happend when the menu bar or the tool bar is added or removed.
     COLUMNS/ROWS is the size the edit area shall have after the resize.  */
--- 260,266 ----
    }
  }
  
! 
  /* Resize the outer window of frame F after chainging the height.
     This happend when the menu bar or the tool bar is added or removed.
     COLUMNS/ROWS is the size the edit area shall have after the resize.  */
***************
*** 299,305 ****
    int tbheight = FRAME_TOOLBAR_HEIGHT (f);
    int rows = PIXEL_TO_CHAR_HEIGHT (f, pixelheight - mbheight - tbheight);
    int columns = PIXEL_TO_CHAR_WIDTH (f, pixelwidth);
!   
    if (FRAME_GTK_WIDGET (f)
        && (columns != FRAME_WIDTH (f) || rows != FRAME_HEIGHT (f)
            || pixelwidth != PIXEL_WIDTH (f) || pixelheight != PIXEL_HEIGHT 
(f)))
--- 299,305 ----
    int tbheight = FRAME_TOOLBAR_HEIGHT (f);
    int rows = PIXEL_TO_CHAR_HEIGHT (f, pixelheight - mbheight - tbheight);
    int columns = PIXEL_TO_CHAR_WIDTH (f, pixelwidth);
! 
    if (FRAME_GTK_WIDGET (f)
        && (columns != FRAME_WIDTH (f) || rows != FRAME_HEIGHT (f)
            || pixelwidth != PIXEL_WIDTH (f) || pixelheight != PIXEL_HEIGHT 
(f)))
***************
*** 333,339 ****
    int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows)
      + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
    int pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
!   
    /* Take into account the size of the scroll bar.  Always use the
       number of columns occupied by the scroll bar here otherwise we
       might end up with a frame width that is not a multiple of the
--- 333,339 ----
    int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows)
      + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
    int pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
! 
    /* Take into account the size of the scroll bar.  Always use the
       number of columns occupied by the scroll bar here otherwise we
       might end up with a frame width that is not a multiple of the
***************
*** 374,380 ****
        event.any.window = gdkwin;
        gwdesc = gtk_get_event_widget (&event);
      }
!   
    UNBLOCK_INPUT;
    return gwdesc;
  }
--- 374,380 ----
        event.any.window = gdkwin;
        gwdesc = gtk_get_event_widget (&event);
      }
! 
    UNBLOCK_INPUT;
    return gwdesc;
  }
***************
*** 404,416 ****
    GtkRcStyle *style;
    int i;
    char *title = 0;
!   
    BLOCK_INPUT;
  
    wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    wvbox = gtk_vbox_new (FALSE, 0);
    wfixed = gtk_fixed_new ();  /* Must have this to place scroll bars  */
!   
    if (! wtop || ! wvbox || ! wfixed)
      {
        if (wtop) gtk_widget_destroy (wtop);
--- 404,416 ----
    GtkRcStyle *style;
    int i;
    char *title = 0;
! 
    BLOCK_INPUT;
  
    wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    wvbox = gtk_vbox_new (FALSE, 0);
    wfixed = gtk_fixed_new ();  /* Must have this to place scroll bars  */
! 
    if (! wtop || ! wvbox || ! wfixed)
      {
        if (wtop) gtk_widget_destroy (wtop);
***************
*** 430,436 ****
    else if (! NILP (f->name)) title = SDATA (f->name);
  
    if (title) gtk_window_set_title (GTK_WINDOW (wtop), title);
!     
    FRAME_GTK_OUTER_WIDGET (f) = wtop;
    FRAME_GTK_WIDGET (f) = wfixed;
    f->output_data.x->vbox_widget = wvbox;
--- 430,436 ----
    else if (! NILP (f->name)) title = SDATA (f->name);
  
    if (title) gtk_window_set_title (GTK_WINDOW (wtop), title);
! 
    FRAME_GTK_OUTER_WIDGET (f) = wtop;
    FRAME_GTK_WIDGET (f) = wfixed;
    f->output_data.x->vbox_widget = wvbox;
***************
*** 440,446 ****
    gtk_widget_set_size_request (wfixed,
                                 PIXEL_WIDTH (f),
                                 PIXEL_HEIGHT (f));
!   
    gtk_container_add (GTK_CONTAINER (wtop), wvbox);
    gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
  
--- 440,446 ----
    gtk_widget_set_size_request (wfixed,
                                 PIXEL_WIDTH (f),
                                 PIXEL_HEIGHT (f));
! 
    gtk_container_add (GTK_CONTAINER (wtop), wvbox);
    gtk_box_pack_end (GTK_BOX (wvbox), wfixed, TRUE, TRUE, 0);
  
***************
*** 456,466 ****
       later on when tool bar items are added.  */
    if (FRAME_EXTERNAL_TOOL_BAR (f) && FRAME_TOOLBAR_HEIGHT (f) == 0)
      FRAME_TOOLBAR_HEIGHT (f) = 34;
!   
    gtk_widget_set_double_buffered (wvbox, FALSE);
    gtk_widget_set_double_buffered (wfixed, FALSE);
    gtk_widget_set_double_buffered (wtop, FALSE);
!   
    /* GTK documents says use gtk_window_set_resizable.  But then a user
       can't shrink the window from its starting size.  */
    gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE);
--- 456,466 ----
       later on when tool bar items are added.  */
    if (FRAME_EXTERNAL_TOOL_BAR (f) && FRAME_TOOLBAR_HEIGHT (f) == 0)
      FRAME_TOOLBAR_HEIGHT (f) = 34;
! 
    gtk_widget_set_double_buffered (wvbox, FALSE);
    gtk_widget_set_double_buffered (wfixed, FALSE);
    gtk_widget_set_double_buffered (wtop, FALSE);
! 
    /* GTK documents says use gtk_window_set_resizable.  But then a user
       can't shrink the window from its starting size.  */
    gtk_window_set_policy (GTK_WINDOW (wtop), TRUE, TRUE, TRUE);
***************
*** 472,478 ****
       GTK is to destroy the widget.  We want Emacs to do that instead.  */
    g_signal_connect (G_OBJECT (wtop), "delete-event",
                      G_CALLBACK (gtk_true), 0);
!   
    /* Convert our geometry parameters into a geometry string
       and specify it.
       GTK will itself handle calculating the real position this way.  */
--- 472,478 ----
       GTK is to destroy the widget.  We want Emacs to do that instead.  */
    g_signal_connect (G_OBJECT (wtop), "delete-event",
                      G_CALLBACK (gtk_true), 0);
! 
    /* Convert our geometry parameters into a geometry string
       and specify it.
       GTK will itself handle calculating the real position this way.  */
***************
*** 508,514 ****
    /* Must use g_strdup because gtk_widget_modify_style does g_free.  */
    style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>");
    gtk_widget_modify_style (wfixed, style);
!   
    /* GTK does not set any border, and they look bad with GTK.  */
    f->output_data.x->border_width = 0;
    f->output_data.x->internal_border_width = 0;
--- 508,514 ----
    /* Must use g_strdup because gtk_widget_modify_style does g_free.  */
    style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>");
    gtk_widget_modify_style (wfixed, style);
! 
    /* GTK does not set any border, and they look bad with GTK.  */
    f->output_data.x->border_width = 0;
    f->output_data.x->internal_border_width = 0;
***************
*** 538,544 ****
      int base_width, base_height;
      int min_rows = 0, min_cols = 0;
      int win_gravity = f->output_data.x->win_gravity;
!     
      if (flags)
        {
          memset (&size_hints, 0, sizeof (size_hints));
--- 538,544 ----
      int base_width, base_height;
      int min_rows = 0, min_cols = 0;
      int win_gravity = f->output_data.x->win_gravity;
! 
      if (flags)
        {
          memset (&size_hints, 0, sizeof (size_hints));
***************
*** 547,553 ****
        }
       else
         flags = f->output_data.x->size_hint_flags;
!     
      size_hints = f->output_data.x->size_hints;
      hint_flags = f->output_data.x->hint_flags;
  
--- 547,553 ----
        }
       else
         flags = f->output_data.x->size_hint_flags;
! 
      size_hints = f->output_data.x->size_hints;
      hint_flags = f->output_data.x->hint_flags;
  
***************
*** 567,573 ****
      size_hints.min_width  = base_width + min_cols * size_hints.width_inc;
      size_hints.min_height = base_height + min_rows * size_hints.height_inc;
  
!     
      /* These currently have a one to one mapping with the X values, but I
         don't think we should rely on that.  */
      hint_flags |= GDK_HINT_WIN_GRAVITY;
--- 567,573 ----
      size_hints.min_width  = base_width + min_cols * size_hints.width_inc;
      size_hints.min_height = base_height + min_rows * size_hints.height_inc;
  
! 
      /* These currently have a one to one mapping with the X values, but I
         don't think we should rely on that.  */
      hint_flags |= GDK_HINT_WIN_GRAVITY;
***************
*** 648,654 ****
  get_dialog_title (char key)
  {
    char *title = "";
!   
    switch (key) {
    case 'E': case 'e':
      title = "Error";
--- 648,654 ----
  get_dialog_title (char key)
  {
    char *title = "";
! 
    switch (key) {
    case 'E': case 'e':
      title = "Error";
***************
*** 746,752 ****
  
    g_signal_connect (G_OBJECT (wdialog), "delete-event",
                      G_CALLBACK (dialog_delete_callback), 0);
!   
    if (deactivate_cb)
      {
        g_signal_connect (G_OBJECT (wdialog), "close", deactivate_cb, 0);
--- 746,752 ----
  
    g_signal_connect (G_OBJECT (wdialog), "delete-event",
                      G_CALLBACK (dialog_delete_callback), 0);
! 
    if (deactivate_cb)
      {
        g_signal_connect (G_OBJECT (wdialog), "close", deactivate_cb, 0);
***************
*** 876,882 ****
    GtkFileSelection *filesel;
    int filesel_done = XG_FILE_NOT_DONE;
    char *fn = 0;
!   
    filewin = gtk_file_selection_new (prompt);
    filesel = GTK_FILE_SELECTION (filewin);
  
--- 876,882 ----
    GtkFileSelection *filesel;
    int filesel_done = XG_FILE_NOT_DONE;
    char *fn = 0;
! 
    filewin = gtk_file_selection_new (prompt);
    filesel = GTK_FILE_SELECTION (filewin);
  
***************
*** 909,917 ****
        gtk_file_selection_hide_fileop_buttons (filesel);
      }
  
!   
    gtk_widget_show_all (filewin);
!   
    while (filesel_done == XG_FILE_NOT_DONE)
      gtk_main_iteration ();
  
--- 909,917 ----
        gtk_file_selection_hide_fileop_buttons (filesel);
      }
  
! 
    gtk_widget_show_all (filewin);
! 
    while (filesel_done == XG_FILE_NOT_DONE)
      gtk_main_iteration ();
  
***************
*** 950,956 ****
  
     The menu bar and all sub menus under the menu bar in a frame
     share the same structure, hence the reference count.
!    
     Returns CL_DATA if CL_DATA is not NULL,  or a pointer to a newly
     allocated xg_menu_cb_data if CL_DATA is NULL.  */
  static xg_menu_cb_data *
--- 950,956 ----
  
     The menu bar and all sub menus under the menu bar in a frame
     share the same structure, hence the reference count.
! 
     Returns CL_DATA if CL_DATA is not NULL,  or a pointer to a newly
     allocated xg_menu_cb_data if CL_DATA is NULL.  */
  static xg_menu_cb_data *
***************
*** 1069,1075 ****
      {
        xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data;
        gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data;
!       
        if (! NILP (data->help) && data->cl_data->highlight_cb)
          {
            GtkCallback func = (GtkCallback) data->cl_data->highlight_cb;
--- 1069,1075 ----
      {
        xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data;
        gpointer call_data = event->type == GDK_LEAVE_NOTIFY ? 0 : client_data;
! 
        if (! NILP (data->help) && data->cl_data->highlight_cb)
          {
            GtkCallback func = (GtkCallback) data->cl_data->highlight_cb;
***************
*** 1125,1138 ****
    GtkWidget *wlbl;
    GtkWidget *wkey;
    GtkWidget *wbox;
!   
    wbox = gtk_hbox_new (FALSE, 0);
    wlbl = gtk_label_new_with_mnemonic (utf8_label);
    wkey = gtk_label_new (utf8_key);
  
    gtk_misc_set_alignment (GTK_MISC (wlbl), 0.0, 0.5);
    gtk_misc_set_alignment (GTK_MISC (wkey), 0.0, 0.5);
!               
    gtk_box_pack_start (GTK_BOX (wbox), wlbl, TRUE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (wbox), wkey, FALSE, FALSE, 0);
  
--- 1125,1138 ----
    GtkWidget *wlbl;
    GtkWidget *wkey;
    GtkWidget *wbox;
! 
    wbox = gtk_hbox_new (FALSE, 0);
    wlbl = gtk_label_new_with_mnemonic (utf8_label);
    wkey = gtk_label_new (utf8_key);
  
    gtk_misc_set_alignment (GTK_MISC (wlbl), 0.0, 0.5);
    gtk_misc_set_alignment (GTK_MISC (wkey), 0.0, 0.5);
! 
    gtk_box_pack_start (GTK_BOX (wbox), wlbl, TRUE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (wbox), wkey, FALSE, FALSE, 0);
  
***************
*** 1146,1152 ****
     UTF8_LABEL is the text for the menu item (GTK uses UTF8 internally).
     UTF8_KEY is the text representing the key binding.
     ITEM is the widget_value describing the menu item.
!    
     GROUP is an in/out parameter.  If the menu item to be created is not
     part of any radio menu group, *GROUP contains NULL on entry and exit.
     If the menu item to be created is part of a radio menu group, on entry
--- 1146,1152 ----
     UTF8_LABEL is the text for the menu item (GTK uses UTF8 internally).
     UTF8_KEY is the text representing the key binding.
     ITEM is the widget_value describing the menu item.
! 
     GROUP is an in/out parameter.  If the menu item to be created is not
     part of any radio menu group, *GROUP contains NULL on entry and exit.
     If the menu item to be created is part of a radio menu group, on entry
***************
*** 1164,1173 ****
  {
    GtkWidget *w;
    GtkWidget *wtoadd = 0;
!   
    if (utf8_key)
      wtoadd = make_widget_for_menu_item (utf8_label, utf8_key);
!   
    if (item->button_type == BUTTON_TYPE_TOGGLE)
      {
        *group = NULL;
--- 1164,1173 ----
  {
    GtkWidget *w;
    GtkWidget *wtoadd = 0;
! 
    if (utf8_key)
      wtoadd = make_widget_for_menu_item (utf8_label, utf8_key);
! 
    if (item->button_type == BUTTON_TYPE_TOGGLE)
      {
        *group = NULL;
***************
*** 1189,1195 ****
        if (utf8_key) w = gtk_menu_item_new ();
        else w = gtk_menu_item_new_with_mnemonic (utf8_label);
      }
!   
    if (wtoadd) gtk_container_add (GTK_CONTAINER (w), wtoadd);
    if (! item->enabled) gtk_widget_set_sensitive (w, FALSE);
  
--- 1189,1195 ----
        if (utf8_key) w = gtk_menu_item_new ();
        else w = gtk_menu_item_new_with_mnemonic (utf8_label);
      }
! 
    if (wtoadd) gtk_container_add (GTK_CONTAINER (w), wtoadd);
    if (! item->enabled) gtk_widget_set_sensitive (w, FALSE);
  
***************
*** 1230,1236 ****
  /* Callback invoked when a menu is detached.  It sets the xg_did_tearoff
     variable.
     WIDGET is the GtkTearoffMenuItem.
!    CLIENT_DATA is not used.  */ 
  static void
  tearoff_activate (widget, client_data)
       GtkWidget *widget;
--- 1230,1236 ----
  /* Callback invoked when a menu is detached.  It sets the xg_did_tearoff
     variable.
     WIDGET is the GtkTearoffMenuItem.
!    CLIENT_DATA is not used.  */
  static void
  tearoff_activate (widget, client_data)
       GtkWidget *widget;
***************
*** 1257,1263 ****
  
    /* Find the top widget for the detached menu.  */
    p = gtk_widget_get_toplevel (submenu);
!     
    /* Delay destroying the menu until the detached menu is removed.  */
    g_signal_connect (G_OBJECT (p), "unmap_event",
                      G_CALLBACK (tearoff_remove), menu);
--- 1257,1263 ----
  
    /* Find the top widget for the detached menu.  */
    p = gtk_widget_get_toplevel (submenu);
! 
    /* Delay destroying the menu until the detached menu is removed.  */
    g_signal_connect (G_OBJECT (p), "unmap_event",
                      G_CALLBACK (tearoff_remove), menu);
***************
*** 1308,1314 ****
    cb_data->help = item->help;
    cb_data->cl_data = cl_data;
    cb_data->call_data = item->call_data;
!       
    g_signal_connect (G_OBJECT (w),
                      "destroy",
                      G_CALLBACK (menuitem_destroy_callback),
--- 1308,1314 ----
    cb_data->help = item->help;
    cb_data->cl_data = cl_data;
    cb_data->call_data = item->call_data;
! 
    g_signal_connect (G_OBJECT (w),
                      "destroy",
                      G_CALLBACK (menuitem_destroy_callback),
***************
*** 1395,1401 ****
        g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data);
        g_signal_connect (G_OBJECT (wmenu), "destroy",
                          G_CALLBACK (menu_destroy_callback), cl_data);
!       
        if (name)
          gtk_widget_set_name (wmenu, name);
  
--- 1395,1401 ----
        g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data);
        g_signal_connect (G_OBJECT (wmenu), "destroy",
                          G_CALLBACK (menu_destroy_callback), cl_data);
! 
        if (name)
          gtk_widget_set_name (wmenu, name);
  
***************
*** 1406,1412 ****
        g_signal_connect (G_OBJECT (wmenu),
                          "grab-notify", G_CALLBACK (menu_grab_callback), 0);
      }
!   
    if (! menu_bar_p && add_tearoff_p)
      {
        GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
--- 1406,1412 ----
        g_signal_connect (G_OBJECT (wmenu),
                          "grab-notify", G_CALLBACK (menu_grab_callback), 0);
      }
! 
    if (! menu_bar_p && add_tearoff_p)
      {
        GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
***************
*** 1419,1425 ****
    for (item = data; item; item = item->next)
      {
        GtkWidget *w;
!       
        if (pop_up_p && !item->contents && !item->call_data
            && !xg_separator_p (item->name))
          {
--- 1419,1425 ----
    for (item = data; item; item = item->next)
      {
        GtkWidget *w;
! 
        if (pop_up_p && !item->contents && !item->call_data
            && !xg_separator_p (item->name))
          {
***************
*** 1585,1591 ****
        /* Add a ref to w so we can explicitly destroy it later.  */
        gtk_widget_ref (w);
        gtk_container_remove (GTK_CONTAINER (wcont), w);
!   
        /* If there is a menu under this widget that has been detached,
           there is a reference to it, and just removing w from the
           container does not destroy the submenu.  By explicitly
--- 1585,1591 ----
        /* Add a ref to w so we can explicitly destroy it later.  */
        gtk_widget_ref (w);
        gtk_container_remove (GTK_CONTAINER (wcont), w);
! 
        /* If there is a menu under this widget that has been detached,
           there is a reference to it, and just removing w from the
           container does not destroy the submenu.  By explicitly
***************
*** 1679,1685 ****
                  Current:  A B C
                  New:      A C
                Remove B.  */
!           
            gtk_widget_ref (GTK_WIDGET (witem));
            gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem));
            gtk_widget_destroy (GTK_WIDGET (witem));
--- 1679,1685 ----
                  Current:  A B C
                  New:      A C
                Remove B.  */
! 
            gtk_widget_ref (GTK_WIDGET (witem));
            gtk_container_remove (GTK_CONTAINER (menubar), GTK_WIDGET (witem));
            gtk_widget_destroy (GTK_WIDGET (witem));
***************
*** 1707,1713 ****
                is up to date when leaving the minibuffer.  */
            GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem)));
            char *utf8_label = get_utf8_string (val->name);
!           
            gtk_label_set_text_with_mnemonic (wlabel, utf8_label);
  
            iter = g_list_next (iter);
--- 1707,1713 ----
                is up to date when leaving the minibuffer.  */
            GtkLabel *wlabel = GTK_LABEL (gtk_bin_get_child (GTK_BIN (witem)));
            char *utf8_label = get_utf8_string (val->name);
! 
            gtk_label_set_text_with_mnemonic (wlabel, utf8_label);
  
            iter = g_list_next (iter);
***************
*** 1787,1794 ****
    const char *old_label = 0;
    const char *old_key = 0;
    xg_menu_item_cb_data *cb_data;
!   
!   wchild = gtk_bin_get_child (GTK_BIN (w));  
    utf8_label = get_utf8_string (val->name);
    utf8_key = get_utf8_string (val->key);
  
--- 1787,1794 ----
    const char *old_label = 0;
    const char *old_key = 0;
    xg_menu_item_cb_data *cb_data;
! 
!   wchild = gtk_bin_get_child (GTK_BIN (w));
    utf8_label = get_utf8_string (val->name);
    utf8_key = get_utf8_string (val->key);
  
***************
*** 1830,1839 ****
          }
      }
  
!   
    if (wkey) old_key = gtk_label_get_label (wkey);
    if (wlbl) old_label = gtk_label_get_label (wlbl);
!   
    if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0))
      gtk_label_set_text (wkey, utf8_key);
  
--- 1830,1839 ----
          }
      }
  
! 
    if (wkey) old_key = gtk_label_get_label (wkey);
    if (wlbl) old_label = gtk_label_get_label (wlbl);
! 
    if (wkey && utf8_key && (! old_key || strcmp (utf8_key, old_key) != 0))
      gtk_label_set_text (wkey, utf8_key);
  
***************
*** 1842,1848 ****
  
    if (utf8_key && utf8_key != val->key) g_free (utf8_key);
    if (utf8_label && utf8_label != val->name) g_free (utf8_label);
!   
    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
      gtk_widget_set_sensitive (w, FALSE);
    else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w))
--- 1842,1848 ----
  
    if (utf8_key && utf8_key != val->key) g_free (utf8_key);
    if (utf8_label && utf8_label != val->name) g_free (utf8_label);
! 
    if (! val->enabled && GTK_WIDGET_SENSITIVE (w))
      gtk_widget_set_sensitive (w, FALSE);
    else if (val->enabled && ! GTK_WIDGET_SENSITIVE (w))
***************
*** 1855,1861 ****
        cb_data->call_data = val->call_data;
        cb_data->help = val->help;
        cb_data->cl_data = cl_data;
!       
        /* We assume the callback functions don't change.  */
        if (val->call_data && ! val->contents)
          {
--- 1855,1861 ----
        cb_data->call_data = val->call_data;
        cb_data->help = val->help;
        cb_data->cl_data = cl_data;
! 
        /* We assume the callback functions don't change.  */
        if (val->call_data && ! val->contents)
          {
***************
*** 1951,1960 ****
    widget_value *cur;
    int has_tearoff_p = 0;
    GList *first_radio = 0;
!   
    if (submenu)
      list = gtk_container_get_children (GTK_CONTAINER (submenu));
!   
    for (cur = val, iter = list;
         cur && iter;
         iter = g_list_next (iter), cur = cur->next)
--- 1951,1960 ----
    widget_value *cur;
    int has_tearoff_p = 0;
    GList *first_radio = 0;
! 
    if (submenu)
      list = gtk_container_get_children (GTK_CONTAINER (submenu));
! 
    for (cur = val, iter = list;
         cur && iter;
         iter = g_list_next (iter), cur = cur->next)
***************
*** 2046,2052 ****
        if (cur && first_radio) remove_from_container (submenu, first_radio);
        else remove_from_container (submenu, iter);
      }
!   
    if (cur)
      {
        /* More items added.  Create them.  */
--- 2046,2052 ----
        if (cur && first_radio) remove_from_container (submenu, first_radio);
        else remove_from_container (submenu, iter);
      }
! 
    if (cur)
      {
        /* More items added.  Create them.  */
***************
*** 2062,2068 ****
                               cl_data,
                               0);
      }
!     
    if (list) g_list_free (list);
  
    return newsub;
--- 2062,2068 ----
                               cl_data,
                               0);
      }
! 
    if (list) g_list_free (list);
  
    return newsub;
***************
*** 2091,2097 ****
    GList *list = gtk_container_get_children (GTK_CONTAINER (menubar));
  
    if (! list) return;
!   
    cl_data = (xg_menu_cb_data*) g_object_get_data (G_OBJECT (menubar),
                                                    XG_FRAME_DATA);
  
--- 2091,2097 ----
    GList *list = gtk_container_get_children (GTK_CONTAINER (menubar));
  
    if (! list) return;
! 
    cl_data = (xg_menu_cb_data*) g_object_get_data (G_OBJECT (menubar),
                                                    XG_FRAME_DATA);
  
***************
*** 2129,2135 ****
                    break;
                  }
              }
!           
            newsub = xg_update_submenu (sub,
                                        f,
                                        cur->contents,
--- 2129,2135 ----
                    break;
                  }
              }
! 
            newsub = xg_update_submenu (sub,
                                        f,
                                        cur->contents,
***************
*** 2159,2165 ****
  {
    struct x_output *x = f->output_data.x;
    GtkRequisition req;
!   
    if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget))
      return 0;
  
--- 2159,2165 ----
  {
    struct x_output *x = f->output_data.x;
    GtkRequisition req;
! 
    if (!x->menubar_widget || GTK_WIDGET_MAPPED (x->menubar_widget))
      return 0;
  
***************
*** 2177,2183 ****
    /* The height has changed, resize outer widget and set columns
       rows to what we had before adding the menu bar.  */
    xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f));
!   
    SET_FRAME_GARBAGED (f);
    UNBLOCK_INPUT;
  }
--- 2177,2183 ----
    /* The height has changed, resize outer widget and set columns
       rows to what we had before adding the menu bar.  */
    xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f));
! 
    SET_FRAME_GARBAGED (f);
    UNBLOCK_INPUT;
  }
***************
*** 2311,2317 ****
  {
    gpointer p;
    int id = (int)data;
!   
    p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA);
    if (p) xfree (p);
    xg_remove_widget_from_map (id);
--- 2311,2317 ----
  {
    gpointer p;
    int id = (int)data;
! 
    p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA);
    if (p) xfree (p);
    xg_remove_widget_from_map (id);
***************
*** 2355,2361 ****
    GtkWidget *wscroll;
    GtkObject *vadj;
    int scroll_id;
!   
    /* Page, step increment values are not so important here, they
       will be corrected in x_set_toolkit_scroll_bar_thumb. */
    vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX,
--- 2355,2361 ----
    GtkWidget *wscroll;
    GtkObject *vadj;
    int scroll_id;
! 
    /* Page, step increment values are not so important here, they
       will be corrected in x_set_toolkit_scroll_bar_thumb. */
    vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX,
***************
*** 2364,2372 ****
    wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
    gtk_widget_set_name (wscroll, scroll_bar_name);
    gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS);
!   
    scroll_id = xg_store_widget_in_map (wscroll);
!   
    g_signal_connect (G_OBJECT (vadj),
                      "value-changed",
                      scroll_callback,
--- 2364,2372 ----
    wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
    gtk_widget_set_name (wscroll, scroll_bar_name);
    gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS);
! 
    scroll_id = xg_store_widget_in_map (wscroll);
! 
    g_signal_connect (G_OBJECT (vadj),
                      "value-changed",
                      scroll_callback,
***************
*** 2386,2392 ****
                      "button-release-event",
                      G_CALLBACK (scroll_bar_button_cb),
                      0);
!   
    gtk_fixed_put (GTK_FIXED (f->output_data.x->edit_widget),
                   wscroll, 0, 0);
  
--- 2386,2392 ----
                      "button-release-event",
                      G_CALLBACK (scroll_bar_button_cb),
                      0);
! 
    gtk_fixed_put (GTK_FIXED (f->output_data.x->edit_widget),
                   wscroll, 0, 0);
  
***************
*** 2426,2432 ****
     TOP/LEFT are the new pixel positions where the bar shall appear.
     WIDTH, HEIGHT is the size in pixels the bar shall have.  */
  void
! xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)     
       FRAME_PTR f;
       int scrollbar_id;
       int top;
--- 2426,2432 ----
     TOP/LEFT are the new pixel positions where the bar shall appear.
     WIDTH, HEIGHT is the size in pixels the bar shall have.  */
  void
! xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height)
       FRAME_PTR f;
       int scrollbar_id;
       int top;
***************
*** 2483,2489 ****
        gdouble shown;
        gdouble top;
        int size, value;
!       
        adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
  
        if (whole <= 0)
--- 2483,2489 ----
        gdouble shown;
        gdouble top;
        int size, value;
! 
        adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
  
        if (whole <= 0)
***************
*** 2552,2558 ****
      return;
  
    idx *= TOOL_BAR_ITEM_NSLOTS;
!   
    key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY);
    XSETFRAME (frame, f);
    event.kind = TOOL_BAR_EVENT;
--- 2552,2558 ----
      return;
  
    idx *= TOOL_BAR_ITEM_NSLOTS;
! 
    key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY);
    XSETFRAME (frame, f);
    event.kind = TOOL_BAR_EVENT;
***************
*** 2678,2687 ****
    x->handlebox_widget = gtk_handle_box_new ();
    gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
                       x->toolbar_widget);
!       
    gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
                        FALSE, FALSE, 0);
!       
    gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget,
                           vbox_pos);
  
--- 2678,2687 ----
    x->handlebox_widget = gtk_handle_box_new ();
    gtk_container_add (GTK_CONTAINER (x->handlebox_widget),
                       x->toolbar_widget);
! 
    gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
                        FALSE, FALSE, 0);
! 
    gtk_box_reorder_child (GTK_BOX (x->vbox_widget), x->handlebox_widget,
                           vbox_pos);
  
***************
*** 2694,2704 ****
  
    gtk_widget_size_request (x->toolbar_widget, &req);
    FRAME_TOOLBAR_HEIGHT (f) = req.height;
!   
    /* The height has changed, resize outer widget and set columns
       rows to what we had before adding the tool bar.  */
    xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f));
!   
    SET_FRAME_GARBAGED (f);
  }
  
--- 2694,2704 ----
  
    gtk_widget_size_request (x->toolbar_widget, &req);
    FRAME_TOOLBAR_HEIGHT (f) = req.height;
! 
    /* The height has changed, resize outer widget and set columns
       rows to what we had before adding the tool bar.  */
    xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f));
! 
    SET_FRAME_GARBAGED (f);
  }
  
***************
*** 2716,2722 ****
      return;
  
    BLOCK_INPUT;
!       
    if (! x->toolbar_widget)
      xg_create_tool_bar (f);
  
--- 2716,2722 ----
      return;
  
    BLOCK_INPUT;
! 
    if (! x->toolbar_widget)
      xg_create_tool_bar (f);
  
***************
*** 2724,2730 ****
  
    icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget));
    iter = icon_list;
!   
    for (i = 0; i < f->n_tool_bar_items; ++i)
      {
  #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX))
--- 2724,2730 ----
  
    icon_list = gtk_container_get_children (GTK_CONTAINER (x->toolbar_widget));
    iter = icon_list;
! 
    for (i = 0; i < f->n_tool_bar_items; ++i)
      {
  #define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX))
***************
*** 2775,2781 ****
            if (wicon) gtk_widget_hide (wicon);
            continue;
          }
!           
        if (! wicon)
          {
            GdkPixmap *gpix = gdk_pixmap_foreign_new (img->pixmap);
--- 2775,2781 ----
            if (wicon) gtk_widget_hide (wicon);
            continue;
          }
! 
        if (! wicon)
          {
            GdkPixmap *gpix = gdk_pixmap_foreign_new (img->pixmap);
***************
*** 2788,2794 ****
                                     w,
                                     GTK_SIGNAL_FUNC (xg_tool_bar_callback),
                                     (gpointer)i);
!           
            /* Save the image so we can see if an update is needed when
               this function is called again.  */
            g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
--- 2788,2794 ----
                                     w,
                                     GTK_SIGNAL_FUNC (xg_tool_bar_callback),
                                     (gpointer)i);
! 
            /* Save the image so we can see if an update is needed when
               this function is called again.  */
            g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
***************
*** 2798,2804 ****
               of the GtkImage parent.  Go upwards until we find the button.  */
            while (! GTK_IS_BUTTON (w))
              w = gtk_widget_get_parent (w);
!           
            if (w)
              {
                /* Save the frame in the button so the xg_tool_bar_callback
--- 2798,2804 ----
               of the GtkImage parent.  Go upwards until we find the button.  */
            while (! GTK_IS_BUTTON (w))
              w = gtk_widget_get_parent (w);
! 
            if (w)
              {
                /* Save the frame in the button so the xg_tool_bar_callback
***************
*** 2848,2854 ****
            gtk_widget_set_sensitive (wicon, enabled_p);
            gtk_widget_show (wicon);
          }
!   
  #undef PROP
      }
  
--- 2848,2854 ----
            gtk_widget_set_sensitive (wicon, enabled_p);
            gtk_widget_show (wicon);
          }
! 
  #undef PROP
      }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]