Use reversed arrow for menus ala Motif (and fix Options menus, which had X

Tue Mar 24 00:17:42 1998  Owen Taylor  <owt1@cornell.edu>

	* 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" <Mattias.Gronlund@sa.erisoft.se>

	* docs/gtk_tut.sgml: Change compiling explaination
	to refer to gtk-config.
	(From: johannes@nada.kth.se (Johannes Keukelaar))
This commit is contained in:
Owen Taylor
1998-03-24 05:27:00 +00:00
committed by Owen Taylor
parent d362159181
commit 102b1de4b4
12 changed files with 321 additions and 42 deletions

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -1,3 +1,40 @@
Tue Mar 24 00:17:42 1998 Owen Taylor <owt1@cornell.edu>
* 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" <Mattias.Gronlund@sa.erisoft.se>
* 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 <owt1@cornell.edu>
* 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" <DAChaplin@email.msn.com>)
* 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 <federico@nuclecu.unam.mx> 1998-03-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness -> * gtk/gtkclist.c (gtk_clist_size_allocate): Fixed xthickness ->
@ -38,6 +75,7 @@ Mon Mar 23 18:19:42 1998 Owen Taylor <owt1@cornell.edu>
in _size_allocate(). Take into account the border width in _size_allocate(). Take into account the border width
in the draw() handler. in the draw() handler.
>>>>>>> 1.285
Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org> Mon Mar 23 15:26:25 1998 Tim Janik <timj@gtk.org>
* gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL. * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.

View File

@ -258,20 +258,20 @@ int main (int argc, char *argv[])
To compile use: To compile use:
<tscreen><verb> <tscreen><verb>
gcc -Wall -g helloworld.c -o hello_world -L/usr/X11R6/lib \ gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \
-lgtk -lgdk -lglib -lX11 -lXext -lm `gtk-config --libs`
</verb></tscreen> </verb></tscreen>
<p> <p>
The libraries above must all be in your default search paths, if not, add
-L&lt;library directory&gt; and gcc will look in these directories for This uses the program <tt>gtk-config</>, which comes with gtk. This
the needed program 'knows' what compiler switches are needed to compile programs
libraries. For instance, on my Debian Linux system, I have to add that use gtk. <tt>gtk-config --cflags</> will output a list of include
<tt>-L/usr/X11R6/lib</> for it to find the X11 libraries. directories for the compiler to look in, and <tt>gtk-config --libs</>
will output the list of libraries for the compiler to link with and
the directories to find them in.
<p> <p>
The order of the libraries are significant. The linker has to know what The libraries that are usually linked in are:
functions it needs from a library before it processes it.
<p>
The libraries we are linking in are:
<itemize> <itemize>
<item>The GTK library (-lgtk), the widget library, based on top of GDK. <item>The GTK library (-lgtk), the widget library, based on top of GDK.
<item>The GDK library (-lgdk), the Xlib wrapper. <item>The GDK library (-lgdk), the Xlib wrapper.

View File

@ -258,20 +258,20 @@ int main (int argc, char *argv[])
To compile use: To compile use:
<tscreen><verb> <tscreen><verb>
gcc -Wall -g helloworld.c -o hello_world -L/usr/X11R6/lib \ gcc -Wall -g helloworld.c -o hello_world `gtk-config --cflags` \
-lgtk -lgdk -lglib -lX11 -lXext -lm `gtk-config --libs`
</verb></tscreen> </verb></tscreen>
<p> <p>
The libraries above must all be in your default search paths, if not, add
-L&lt;library directory&gt; and gcc will look in these directories for This uses the program <tt>gtk-config</>, which comes with gtk. This
the needed program 'knows' what compiler switches are needed to compile programs
libraries. For instance, on my Debian Linux system, I have to add that use gtk. <tt>gtk-config --cflags</> will output a list of include
<tt>-L/usr/X11R6/lib</> for it to find the X11 libraries. directories for the compiler to look in, and <tt>gtk-config --libs</>
will output the list of libraries for the compiler to link with and
the directories to find them in.
<p> <p>
The order of the libraries are significant. The linker has to know what The libraries that are usually linked in are:
functions it needs from a library before it processes it.
<p>
The libraries we are linking in are:
<itemize> <itemize>
<item>The GTK library (-lgtk), the widget library, based on top of GDK. <item>The GTK library (-lgtk), the widget library, based on top of GDK.
<item>The GDK library (-lgdk), the Xlib wrapper. <item>The GDK library (-lgdk), the Xlib wrapper.

View File

@ -22,6 +22,7 @@
#include "gtklabel.h" #include "gtklabel.h"
#include "gtklist.h" #include "gtklist.h"
#include "gtkentry.h" #include "gtkentry.h"
#include "gtkeventbox.h"
#include "gtkbutton.h" #include "gtkbutton.h"
#include "gtklistitem.h" #include "gtklistitem.h"
#include "gtkscrolledwindow.h" #include "gtkscrolledwindow.h"
@ -342,7 +343,10 @@ gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
gtk_widget_grab_focus (combo->popwin); gtk_widget_grab_focus (combo->popwin);
gtk_grab_add (combo->popwin); gtk_grab_add (combo->popwin);
gdk_pointer_grab (combo->popwin->window, TRUE, 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 #if 0
@ -442,6 +446,8 @@ gtk_combo_init (GtkCombo * combo)
{ {
GtkWidget *arrow; GtkWidget *arrow;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *event_box;
GdkCursor *cursor;
combo->case_sensitive = 0; combo->case_sensitive = 0;
combo->value_in_list = 0; combo->value_in_list = 0;
@ -473,22 +479,34 @@ gtk_combo_init (GtkCombo * combo)
combo->popwin = gtk_window_new (GTK_WINDOW_POPUP); combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_ref (combo->popwin); gtk_widget_ref (combo->popwin);
gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0); 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); 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_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_widget_show (frame); gtk_widget_show (frame);
combo->popup = gtk_scrolled_window_new (NULL, NULL); combo->popup = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
combo->list = gtk_list_new (); combo->list = gtk_list_new ();
gtk_list_set_selection_mode(GTK_LIST(combo->list), GTK_SELECTION_BROWSE); 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 (frame), combo->popup);
gtk_container_add (GTK_CONTAINER (combo->popup), combo->list); gtk_container_add (GTK_CONTAINER (combo->popup), combo->list);
gtk_widget_show (combo->list); gtk_widget_show (combo->list);
gtk_widget_show (combo->popup); 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", combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed",
(GtkSignalFunc) gtk_combo_update_entry, combo); (GtkSignalFunc) gtk_combo_update_entry, combo);
gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event", gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event",

View File

@ -641,6 +641,7 @@ gtk_file_selection_destroy (GtkObject *object)
{ {
callback_arg = list->data; callback_arg = list->data;
g_free (callback_arg->directory); g_free (callback_arg->directory);
g_free (callback_arg);
list = list->next; list = list->next;
} }
g_list_free (filesel->history_list); g_list_free (filesel->history_list);
@ -1072,7 +1073,6 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
GtkWidget *menu_item; GtkWidget *menu_item;
GList *list; GList *list;
gchar *current_dir; gchar *current_dir;
gchar *directory;
gint dir_len; gint dir_len;
gint i; gint i;
@ -1087,6 +1087,7 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
while (list) { while (list) {
callback_arg = list->data; callback_arg = list->data;
g_free (callback_arg->directory); g_free (callback_arg->directory);
g_free (callback_arg);
list = list->next; list = list->next;
} }
g_list_free (fs->history_list); g_list_free (fs->history_list);
@ -1111,7 +1112,6 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
if (i != dir_len) if (i != dir_len)
current_dir[i + 1] = '\0'; current_dir[i + 1] = '\0';
menu_item = gtk_menu_item_new_with_label (current_dir); menu_item = gtk_menu_item_new_with_label (current_dir);
directory = g_strdup (current_dir);
callback_arg = g_new (HistoryCallbackArg, 1); callback_arg = g_new (HistoryCallbackArg, 1);
callback_arg->menu_item = menu_item; callback_arg->menu_item = menu_item;
@ -1122,7 +1122,7 @@ gtk_file_selection_update_history_menu (GtkFileSelection *fs,
if (dir_len == i) { if (dir_len == i) {
callback_arg->directory = g_strdup (""); callback_arg->directory = g_strdup ("");
} else { } else {
callback_arg->directory = directory; callback_arg->directory = g_strdup (current_dir);
} }
fs->history_list = g_list_append (fs->history_list, callback_arg); 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) if (cmpl_state->user_dir_name_buffer)
g_free (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) if (cmpl_state->user_directories)
g_free (cmpl_state->user_directories); g_free (cmpl_state->user_directories);
if (cmpl_state->the_completion.text) if (cmpl_state->the_completion.text)
@ -2485,7 +2487,7 @@ static gint
get_pwdb(CompletionState* cmpl_state) get_pwdb(CompletionState* cmpl_state)
{ {
struct passwd *pwd_ptr; struct passwd *pwd_ptr;
gchar* buf_ptr, *home_dir = NULL; gchar* buf_ptr;
gint len = 0, i, count = 0; gint len = 0, i, count = 0;
if(cmpl_state->user_dir_name_buffer) if(cmpl_state->user_dir_name_buffer)
@ -2511,10 +2513,8 @@ get_pwdb(CompletionState* cmpl_state)
cmpl_errno = errno; cmpl_errno = errno;
goto error; goto error;
} }
home_dir = pwd_ptr->pw_dir; /* Allocate this separately, since it might be filled in elsewhere */
cmpl_state->user_home_dir = g_strdup (pwd_ptr->pw_dir);
len += strlen(home_dir);
len += 1;
} }
setpwent (); setpwent ();
@ -2525,14 +2525,6 @@ get_pwdb(CompletionState* cmpl_state)
buf_ptr = cmpl_state->user_dir_name_buffer; 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) for(i = 0; i < count; i += 1)
{ {
pwd_ptr = getpwent(); pwd_ptr = getpwent();

View File

@ -323,11 +323,14 @@ gtk_menu_popup (GtkMenu *menu,
if (xgrab_shell && (!GTK_MENU_SHELL (xgrab_shell)->have_xgrab)) if (xgrab_shell && (!GTK_MENU_SHELL (xgrab_shell)->have_xgrab))
{ {
GdkCursor *cursor = gdk_cursor_new (GDK_ARROW);
GTK_MENU_SHELL (xgrab_shell)->have_xgrab = GTK_MENU_SHELL (xgrab_shell)->have_xgrab =
(gdk_pointer_grab (xgrab_shell->window, TRUE, (gdk_pointer_grab (xgrab_shell->window, TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_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)); gtk_grab_add (GTK_WIDGET (menu));