From 102b1de4b4e7939e9fe513ee929bc073eaa11741 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 24 Mar 1998 05:27:00 +0000 Subject: [PATCH] Use reversed arrow for menus ala Motif (and fix Options menus, which had X Tue Mar 24 00:17:42 1998 Owen Taylor * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for menus ala Motif (and fix Options menus, which had X cursor before), and show normal arrow when inside ComboBox. * gtk/gtkfilesel.c: Various memory leaks removed, as pointed out by Mattias.Gronlund" * docs/gtk_tut.sgml: Change compiling explaination to refer to gtk-config. (From: johannes@nada.kth.se (Johannes Keukelaar)) --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-0 | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-10 | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-2 | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-4 | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-6 | 38 ++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-8 | 38 ++++++++++++++++++++++++++++++++++++++ docs/gtk_tut.sgml | 22 +++++++++++----------- docs/tutorial/gtk_tut.sgml | 22 +++++++++++----------- gtk/gtkcombo.c | 24 +++++++++++++++++++++--- gtk/gtkfilesel.c | 24 ++++++++---------------- gtk/gtkmenu.c | 5 ++++- 12 files changed, 321 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f89fabbe56..a5de8a8b65 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,40 @@ +Tue Mar 24 00:17:42 1998 Owen Taylor + + * gtk/gtkcombo.c gtk/gtkmenu.c: Use reversed arrow for + menus ala Motif (and fix Options menus, which had X cursor + before), and show normal arrow when inside ComboBox. + + * gtk/gtkfilesel.c: Various memory leaks removed, as + pointed out by Mattias.Gronlund" + + * docs/gtk_tut.sgml: Change compiling explaination + to refer to gtk-config. + (From: johannes@nada.kth.se (Johannes Keukelaar)) + +Mon Mar 23 18:19:42 1998 Owen Taylor + + * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making + an X grab when the button is released, grab immediately. + This solves a problem where menus wouldn't pop down + if the caller didn't have the BUTTON_RELEASE mask on + their window, and and another where the X grab would + be released prematurely. + + * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on + button presses to make sure they occurred in a child item. + (From: "Damon Chaplin" ) + + * gtk/gtkmenushell.c: Do sanity checking on button + press/releases. Handle button events on window widget + descendents of menu items correctly. + + * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c + gtk/gtkeventbox.c: + + Make the window size allocated in _realize() match that + in _size_allocate(). Take into account the border width + in the draw() handler. + 1998-03-23 Federico Mena Quintero * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> @@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor in _size_allocate(). Take into account the border width in the draw() handler. +>>>>>>> 1.285 Mon Mar 23 15:26:25 1998 Tim Janik * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. diff --git a/docs/gtk_tut.sgml b/docs/gtk_tut.sgml index 331e05e11c..76f0d19ff4 100644 --- a/docs/gtk_tut.sgml +++ b/docs/gtk_tut.sgml @@ -258,20 +258,20 @@ int main (int argc, char *argv[]) To compile use: -gcc -Wall -g helloworld.c -o hello_world -L/usr/X11R6/lib \ - -lgtk -lgdk -lglib -lX11 -lXext -lm +gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \ + `gtk-config --libs`

-The libraries above must all be in your default search paths, if not, add --L<library directory> and gcc will look in these directories for -the needed -libraries. For instance, on my Debian Linux system, I have to add --L/usr/X11R6/lib for it to find the X11 libraries. + +This uses the program gtk-config, which comes with gtk. This +program 'knows' what compiler switches are needed to compile programs +that use gtk. gtk-config --cflags will output a list of include +directories for the compiler to look in, and gtk-config --libs +will output the list of libraries for the compiler to link with and +the directories to find them in. +

-The order of the libraries are significant. The linker has to know what -functions it needs from a library before it processes it. -

-The libraries we are linking in are: +The libraries that are usually linked in are: The GTK library (-lgtk), the widget library, based on top of GDK. The GDK library (-lgdk), the Xlib wrapper. diff --git a/docs/tutorial/gtk_tut.sgml b/docs/tutorial/gtk_tut.sgml index 331e05e11c..76f0d19ff4 100644 --- a/docs/tutorial/gtk_tut.sgml +++ b/docs/tutorial/gtk_tut.sgml @@ -258,20 +258,20 @@ int main (int argc, char *argv[]) To compile use: -gcc -Wall -g helloworld.c -o hello_world -L/usr/X11R6/lib \ - -lgtk -lgdk -lglib -lX11 -lXext -lm +gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \ + `gtk-config --libs`

-The libraries above must all be in your default search paths, if not, add --L<library directory> and gcc will look in these directories for -the needed -libraries. For instance, on my Debian Linux system, I have to add --L/usr/X11R6/lib for it to find the X11 libraries. + +This uses the program gtk-config, which comes with gtk. This +program 'knows' what compiler switches are needed to compile programs +that use gtk. gtk-config --cflags will output a list of include +directories for the compiler to look in, and gtk-config --libs +will output the list of libraries for the compiler to link with and +the directories to find them in. +

-The order of the libraries are significant. The linker has to know what -functions it needs from a library before it processes it. -

-The libraries we are linking in are: +The libraries that are usually linked in are: The GTK library (-lgtk), the widget library, based on top of GDK. The GDK library (-lgdk), the Xlib wrapper. diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index ebfd93e5c6..05e510293d 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -22,6 +22,7 @@ #include "gtklabel.h" #include "gtklist.h" #include "gtkentry.h" +#include "gtkeventbox.h" #include "gtkbutton.h" #include "gtklistitem.h" #include "gtkscrolledwindow.h" @@ -342,7 +343,10 @@ gtk_combo_popup_list (GtkButton * button, GtkCombo * combo) gtk_widget_grab_focus (combo->popwin); gtk_grab_add (combo->popwin); gdk_pointer_grab (combo->popwin->window, TRUE, - GDK_BUTTON_PRESS_MASK, NULL, NULL, GDK_CURRENT_TIME); + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | + GDK_POINTER_MOTION_MASK, + NULL, NULL, GDK_CURRENT_TIME); } #if 0 @@ -442,6 +446,8 @@ gtk_combo_init (GtkCombo * combo) { GtkWidget *arrow; GtkWidget *frame; + GtkWidget *event_box; + GdkCursor *cursor; combo->case_sensitive = 0; combo->value_in_list = 0; @@ -473,22 +479,34 @@ gtk_combo_init (GtkCombo * combo) combo->popwin = gtk_window_new (GTK_WINDOW_POPUP); gtk_widget_ref (combo->popwin); gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0); + + gtk_widget_set_events (combo->popwin, GDK_KEY_PRESS_MASK); + + event_box = gtk_event_box_new (); + gtk_container_add (GTK_CONTAINER (combo->popwin), event_box); + gtk_widget_show (event_box); + + gtk_widget_realize (event_box); + cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW); + gdk_window_set_cursor (event_box->window, cursor); + gdk_cursor_destroy (cursor); frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (combo->popwin), frame); + gtk_container_add (GTK_CONTAINER (event_box), frame); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); gtk_widget_show (frame); combo->popup = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + combo->list = gtk_list_new (); gtk_list_set_selection_mode(GTK_LIST(combo->list), GTK_SELECTION_BROWSE); gtk_container_add (GTK_CONTAINER (frame), combo->popup); gtk_container_add (GTK_CONTAINER (combo->popup), combo->list); gtk_widget_show (combo->list); gtk_widget_show (combo->popup); - gtk_widget_set_events (combo->popwin, gtk_widget_get_events (combo->popwin) | GDK_KEY_PRESS_MASK); + combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed", (GtkSignalFunc) gtk_combo_update_entry, combo); gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event", diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index 1328f7e980..a334c73f8c 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -641,6 +641,7 @@ gtk_file_selection_destroy (GtkObject *object) { callback_arg = list->data; g_free (callback_arg->directory); + g_free (callback_arg); list = list->next; } g_list_free (filesel->history_list); @@ -1072,7 +1073,6 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs, GtkWidget *menu_item; GList *list; gchar *current_dir; - gchar *directory; gint dir_len; gint i; @@ -1087,6 +1087,7 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs, while (list) { callback_arg = list->data; g_free (callback_arg->directory); + g_free (callback_arg); list = list->next; } g_list_free (fs->history_list); @@ -1111,7 +1112,6 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs, if (i != dir_len) current_dir[i + 1] = '\0'; menu_item = gtk_menu_item_new_with_label (current_dir); - directory = g_strdup (current_dir); callback_arg = g_new (HistoryCallbackArg, 1); callback_arg->menu_item = menu_item; @@ -1122,7 +1122,7 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs, if (dir_len == i) { callback_arg->directory = g_strdup (""); } else { - callback_arg->directory = directory; + callback_arg->directory = g_strdup (current_dir); } fs->history_list = g_list_append (fs->history_list, callback_arg); @@ -1572,6 +1572,8 @@ cmpl_free_state (CompletionState* cmpl_state) if (cmpl_state->user_dir_name_buffer) g_free (cmpl_state->user_dir_name_buffer); + if (cmpl_state->user_home_dir) + g_free (cmpl_state->user_home_dir); if (cmpl_state->user_directories) g_free (cmpl_state->user_directories); if (cmpl_state->the_completion.text) @@ -2485,7 +2487,7 @@ static gint get_pwdb(CompletionState* cmpl_state) { struct passwd *pwd_ptr; - gchar* buf_ptr, *home_dir = NULL; + gchar* buf_ptr; gint len = 0, i, count = 0; if(cmpl_state->user_dir_name_buffer) @@ -2511,10 +2513,8 @@ get_pwdb(CompletionState* cmpl_state) cmpl_errno = errno; goto error; } - home_dir = pwd_ptr->pw_dir; - - len += strlen(home_dir); - len += 1; + /* Allocate this separately, since it might be filled in elsewhere */ + cmpl_state->user_home_dir = g_strdup (pwd_ptr->pw_dir); } setpwent (); @@ -2525,14 +2525,6 @@ get_pwdb(CompletionState* cmpl_state) buf_ptr = cmpl_state->user_dir_name_buffer; - if (!cmpl_state->user_home_dir) - { - strcpy(buf_ptr, home_dir); - cmpl_state->user_home_dir = buf_ptr; - buf_ptr += strlen(buf_ptr); - buf_ptr += 1; - } - for(i = 0; i < count; i += 1) { pwd_ptr = getpwent(); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 12a804ec8b..cf83d262b7 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -323,11 +323,14 @@ gtk_menu_popup (GtkMenu *menu, if (xgrab_shell && (!GTK_MENU_SHELL (xgrab_shell)->have_xgrab)) { + GdkCursor *cursor = gdk_cursor_new (GDK_ARROW); + GTK_MENU_SHELL (xgrab_shell)->have_xgrab = (gdk_pointer_grab (xgrab_shell->window, TRUE, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK, - NULL, NULL, activate_time) == 0); + NULL, cursor, activate_time) == 0); + gdk_cursor_destroy (cursor); } gtk_grab_add (GTK_WIDGET (menu));