Re: Typecast error
[EMAIL PROTECTED] wrote: gtk_signal_connect( GTK_OBJECT( robot_name[1] ), "clicked", GTK_SIGNAL_FUNC( display_info ), 1 ); gui.h:873: cannot convert `int' to `void *' for argument `4' to `gtk_signal_connect (GtkObject *, const gchar *, void (*) (), void *)' Hi Ciaran, there are two handy glib macros for this: void *GINT_TO_POINTER(int) int GPOINTER_TO_INT(void*) They boil down to doing something like: void *a = (void *) 1; but look out for any odd alignment/ordering problems for you, and are much easier to read. There are some other similar macros, grep through glibconfig.h. HTH, John ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
gtk_file_selection
I use the gtk_file_selection_new() function to create a file selection. By selecting a file and pressing the OK button everything runs fine. However, by selecting a file with a double click, the filename is send to my function but causes trouble (deadlock, I must kill the whole program...) Has anybody an idea why this happens? Another question: Where can I find the list of valid signal_names (such as "clicked") Cheers Christian ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Gtk-WARNING **: Unable to locate loadable module in module_path: libpixmap.so
I know this has already been the subject of at least one thread, but that didn't answer all my questions: It seems that at some point libpixmap et al have moved from .../lib/gtk/themes/engines/ to .../lib/gtk/themes/engines/lib Can somebody tell me if this is correct? Is this last lib directory going to stay. Where is this defined (for the whole system not just each user)? is it at build-time or run-time? THX AMP -- pediddel: A car with only one working headlight. -- "Sniglets", Rich Hall Friends _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. For further information visit http://www.messagelabs.com/stats.asp ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Typecast error
On Tuesday 13 March 2001 06:26, [EMAIL PROTECTED] wrote: Hello All. I have a tiny problem, that doesn't really matter, but I would like it to be fixed. In my program I have the following command gtk_signal_connect( GTK_OBJECT( robot_name[1] ), "clicked", GTK_SIGNAL_FUNC( display_info ), 1 ); which calls the following function void display_info( GtkWidget *was_clicked, int i ) { couti; etc... etc... } This program compiles and creates an executable which works correctly, ie. ithe int is successfully passed to the function, however I get this warning, which I would like to fix gui.h:873: cannot convert `int' to `void *' for argument `4' to `gtk_signal_connect (GtkObject *, const gchar *, void (*) (), void *)' It wants a pointer to something, so, we give it one: gint dummy_int = 1; gtk_signal_connect( GTK_OBJECT( robot_name[1] ), "clicked", GTK_SIGNAL_FUNC( display_info ), dummy_int ); ... void display_info( GtkWidget *was_clicked, gint *i ) { cout *i; } You might need to fuss a bit with a cast but it should be less painful that what you've been through. --Dwight Tuinstra [EMAIL PROTECTED] ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
How to set widget colors?
Hi all, Can someone point me to an example that illustrates how to change basic widget colors? I mean things like boxes, range widget controls (different colors for actually slider or button) and so on. Similarly, how do I set the default background color for the gtk_canvas? Thanks, DT -- Technical Director - Virginia Center for Computer Music http://www.people.virginia.edu/~djt7p ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Typecast error
Dwight Tuinstra [EMAIL PROTECTED] writes: This program compiles and creates an executable which works correctly, ie. ithe int is successfully passed to the function, however I get this warning, which I would like to fix gui.h:873: cannot convert `int' to `void *' for argument `4' to `gtk_signal_connect (GtkObject *, const gchar *, void (*) (), void *)' The warning here is entirely justified; what you're doing is not correct, because sizeof(int) != sizeof(void*) on many platforms. So the lesson is, take warnings seriously, don't just insert casts. ;-) It wants a pointer to something, so, we give it one: gint dummy_int = 1; gtk_signal_connect( GTK_OBJECT( robot_name[1] ), "clicked", GTK_SIGNAL_FUNC( display_info ), dummy_int ); No! Once you're in the callback, dummy_int will no longer exist; you'll have a pointer to random memory. The correct, portable, no-warnings way to write this code is: void display_info (GtkWidget *widget, gpointer data) { gint i; i = GPOINTER_TO_INT (data); cout i endl; } ... gtk_signal_connect (GTK_OBJECT (robot_name[1]), "clicked", GTK_SIGNAL_FUNC (display_info ), GINT_TO_POINTER (42)); Havoc ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk+-1.2.10
"Owen" == Owen Taylor [EMAIL PROTECTED] writes: Owen Please just fix your application. In the quick look I took Owen GTK+ frontend is only 7000 lines or so, with a strong Owen separation between that and the core. Splitting that apart Owen into a separate process is simply not that hard. Well, it's not that hard for a new application, but it's really hard for something historical like Gnomehack, (based on Nethack) which needs the ability to open files at any point during the game (if you die, it may randomly decide to save your file as a "bones" file for other players to come across) in the save directory. If it can't be run sgid, it can't do this; re-architecturing this would most likely entail removing this feature entirely, or like you said, forking off a process and introducing a nightmare of new problems to debug. But I understand completely why GTK+ is not secure, that point I'm not arguing. I'm just saying it's not trivial to fix these kinds of engineering decisions made 15-20 years ago (literally!) Ben -- Brought to you by the letters R and F and the number 3. "Well, I think Perl should run faster than C. :-)" Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/ ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
gtk_signal_handler_block: core dump
I'm trying to learn gtk. So, I'm trying to modify helloworld2 so that it has three buttons. The first will gprint "TEST", the second will turn the first button off, and the third will turn the first back on. Just an exercise:) I've got this far, but although this code compiles, it core dumps when I push the second button. I searched the archives, but no clue. Could please someone explain what is happening here? Doc Alb #include gtk/gtk.h void test( GtkWidget *widget, gpointer data ) { g_print( "%s\n", ( char * ) data ) ; } struct kill_data { GtkWidget *b ; gint id ; } ; void kill( struct kill_data *kd ) { gtk_signal_handler_block( GTK_OBJECT( kd-b ), (guint) kd-id ) ; } void live( GtkWidget *widget, gpointer data ) { g_print( "%s\n", ( char * ) data ) ; } gint delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit( ) ; return( FALSE ) ; } int main( int argc, char *argv[] ) { GtkWidget *window ; GtkWidget *box ; GtkWidget *button1 ; GtkWidget *button2 ; GtkWidget *button3 ; gint hid ; struct kill_data *s ; s = ( struct kill_data* ) malloc( sizeof( struct kill_data ) ) ; gtk_init( argc, argv ) ; window = gtk_window_new( GTK_WINDOW_TOPLEVEL ) ; gtk_container_set_border_width( GTK_CONTAINER( window ), 25 ) ; gtk_window_set_title( GTK_WINDOW( window ), "Button Stuff" ) ; box = gtk_hbox_new( FALSE, 0 ) ; button1 = gtk_button_new_with_label( " TEST " ) ; button2 = gtk_button_new_with_label( " KILL " ) ; button3 = gtk_button_new_with_label( " LIVE " ) ; gtk_signal_connect( GTK_OBJECT( window ), "delete_event", GTK_SIGNAL_FUNC( delete_event ), NULL ) ; hid = gtk_signal_connect( GTK_OBJECT( button1 ), "clicked", GTK_SIGNAL_FUNC( test ), ( gpointer ) "TEST" ) ; s-b = button1 ; s-id = hid ; gtk_signal_connect( GTK_OBJECT( button2 ), "clicked", GTK_SIGNAL_FUNC( kill ), s ) ; gtk_signal_connect( GTK_OBJECT( button3 ), "clicked", GTK_SIGNAL_FUNC( live ), ( gpointer ) "LIVE" ) ; gtk_container_add( GTK_CONTAINER( window ), box ) ; gtk_box_pack_start( GTK_BOX( box ), button1, TRUE, TRUE, 0 ) ; gtk_box_pack_start( GTK_BOX( box ), button2, TRUE, TRUE, 0 ) ; gtk_box_pack_start( GTK_BOX( box ), button3, TRUE, TRUE, 0 ) ; gtk_widget_show( box ) ; gtk_widget_show( button1 ) ; gtk_widget_show( button2 ) ; gtk_widget_show( button3 ) ; gtk_widget_show( window ) ; gtk_main( ) ; return( 0 ) ; } ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
html viewer
Hi, I am interested in viewing html files (is there any other widget except the xmhtml?) _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk+-1.2.10
On Wed, 14 Mar 2001, Owen Taylor wrote: "J. Ali Harlow" [EMAIL PROTECTED] writes: Good to know. Have the GTK+ team come to a view on a mechanism to override the setguid check? If not, is there any chance you could so before 1.2.10 is released. I'll happily log a bug if that would be appropriate. Please repeat after me: By making the GTK+ application run setgid, you would make the files, and all other files and directories owned by that user world writeable for all practical purposes. By making the GTK+ application run setgid, you would make the files, and all other files and directories owned by that GROUP world writeable for all practical purposes. Do you still need a mechanism other than simply making the files world writeable knowing that? Well, yes. With the setgid operation you had with GTK+-1.2.8, any user can change any of their saved games, any of the score files, and any of any any other user's saved games. Sure, it would be possible. It does however create a reasonable hurdle for would-be cheats to climb. With a change to the permissions, and no setgid operation, you would at least remove the ability change other user's saved games. Granted. Please just fix your application. In the quick look I took GTK+ frontend is only 7000 lines or so, with a strong separation between that and the core. Splitting that apart into a separate process is simply not that hard. We're working on it. It's isn't quite as simple as it looks however. There's a strong abstraction in the windowing interface API (so that calls from the game core to the windowing interface are few, and go through a central mechanism). There is, however, no abstraction on the callbacks (ie., windowing interfaces currently have access to the game core's data structures and utility functions. Many, including the gtk and gnome interfaces, take good advantage of this). We'll get there, but it _will_ take time. I'm currently estimating that the current Slash'EM development cycle will be six months, by the end of which I hope to have plugable interfaces in place. In the meantime, we will be forced to ship stable versions that subvert your check if you refuse to provide a workaround. The code is already written and in place. The user will see nothing. I would be delighted to delete it if 1.2.9 was the only version that needed it. As Ben Gertzfield points out in a seperate message this problem also affects NetHack. I can't speak for their dev-team, but I will note that we have been talking about this; that they have a copy of my code to subvert; and that it's been quite a while since their last release, with a number of bugs listed as fixed on their bug list. If they were to release a 3.3.2 version containing the subverting code that could be around for years to come. Regards, Owen [ The only workaround that I'd even consider is an Havoc's suggesting of an environment variable like: GTK_ENABLE_SETUGID_HAXORING Though it would worry me that people who don't understand setugid GTK+ is equivalent to a setugid shell would try to set that from their source code. ] So don't document it. Spit out a warning message telling everybody just that. As a final thought, do you have any concept of what packagers are likely to do? Is it going to be like Qt, with Linux distributions shipping with 1.2.x and 2.x versions of GTK+ for some time to come? If so, you could include a workaround in the 1.2.x series but drop it from 2.x. This way we can continue to link against 1.2.x, fix the real problem before 1.2.x gets dropped and then take advantage of all the extra facilities 2.x provides. -- Ali Harlow Email: [EMAIL PROTECTED] Research programmer Tel: (020) 7477 8000 X 4348 Applied Vision Research Centre Intl: +44 20 7477 8000 X 4348 City University Fax: (020) 7505 5515 London Intl: +44 20 7505 5515 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk+-1.2.10
On Wed, 14 Mar 2001, Ben Gertzfield wrote: "Owen" == Owen Taylor [EMAIL PROTECTED] writes: Owen Please just fix your application. In the quick look I took Owen GTK+ frontend is only 7000 lines or so, with a strong Owen separation between that and the core. Splitting that apart Owen into a separate process is simply not that hard. Well, it's not that hard for a new application, but it's really hard for something historical like Gnomehack, (based on Nethack) which needs the ability to open files at any point during the game (if you die, it may randomly decide to save your file as a "bones" file for other players to come across) in the save directory. Hi Ben. Just to point out that the solution that I'm discussing with the NetHack dev-team is to develop plug-in windowing interfaces which would have other advantages rather than a setgid helper (although this also would be possible). -- Ali Harlow Email: [EMAIL PROTECTED] Research programmer Tel: (020) 7477 8000 X 4348 Applied Vision Research Centre Intl: +44 20 7477 8000 X 4348 City University Fax: (020) 7505 5515 London Intl: +44 20 7505 5515 ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list
Re: gtk+-1.2.10
J. Ali Harlow wrote: In the meantime, we will be forced to ship stable versions that subvert your check if you refuse to provide a workaround. The code is already written and in place. The user will see nothing. Wow, we could play a game here. Owen scores a point whenever he releases GTK source (or a patch, just to make the cycle shorter) which makes GTK unusable with the existing game binaries. You score a point whenever you release source or a patch which will work setgid with the existing GTK binaries. To make it more interesting, patches don't have to be portable, ie. a single OS on a specific architecture counts. And mere mortals can take whichever side they want, but they only may select compiler, linker and assembler flags, without changing the sources. I would be delighted to delete it if 1.2.9 was the only version that needed it. Why, 1.2.8 and earlier should also be in the game. :-) -- .-. .-.Sarcasm is just one more service we offer. (_ \ / _) |[EMAIL PROTECTED] | ___ gtk-list mailing list [EMAIL PROTECTED] http://mail.gnome.org/mailman/listinfo/gtk-list