Re: Mouse wheel events
Tom Trebisky wrote: Hello, I have a GTK 2 application I have been developing that I would like to have use mouse wheel events. I have a mouse event handler that gets left and right button events just fine, (being connected to the button release event). Naturally, it doesn't get a thing when I rotate the center wheel on the mouse. Can anyone tell me what to do, or direct me to appropriate documentation? Investigate the GDK_SCROLL event. It gives you a GdkEventScroll event structure that contains a direction field with GDK_SCROLL_UP or GDK_SCROLL_DOWN. Of course, this is different from the X11 event model which maps scroll wheel events to mouse buttons 4 and 5. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: I can't understand the difference output of only a line differ
Binary Chen wrote: Hi, I tried gdk_draw_image with a small program, but the behavior is very confusing, please help me find out whats happening. [...] I've read through the thread detailing your GTK troubles. I also know you are trying to write a custom GTK player for a particular multimedia format. I just wanted to throw out the possibility of asking your client whether they have any interest in open sourcing the video codec itself? Take this step and there is a community of fanatical open source multimedia enthusiasts (myself included) who would try to incorporate the codec into FFmpeg (ffmpeg.org), at which point it would be accessible to a huge number of existing media players. Think about it... -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: When g_timeout_add doesn't seem to be enough
Rafał Mużyło wrote: Should problably add that I'm rewriting the app to use libao (so esd would be covered) and audio is generated, not played from a file. I am not familiar with libao and whether or not the PCM output functionality is blocking or not (or configurable). If its behavior is blocking: audio_thread: while (running) mix_audio() output_audio() If the behavior is non-blocking (i.e., the output_audio() function returns immediately), you will have to go through the trouble of waiting somehow until the device is ready to receive more data. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to draw a UYVY Image
Evans Magaoga wrote: I am capturing video frames using the using video for Linux function. Is possible to display a frame (Image) in UYVY format on the screen directly using GTK. I am display RGB frame fine. I would like to know if I can display UYVY grames without converting it into RGB Perhaps use an Xv overlay? That's outside the purview of GTK, but I know it's still possible since there are GTK movie players that use Xv overlays. And you get hardware scaling for free. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: How to convert a jpg image to a GtkImage ?
Gregory Hosler wrote: Hi all, I have an application, that amoung other things, is receiving a jpg file from a network connection. Once that file is in memory (it's relatively small), I wish to load it into a GtkImage (so that I can display it, e.g. by adding the GtkImage to a vbox, or something like that). I've been thru the Dev Help pages, and I have some questions: 1) If the image were in an actual file, I could load it e.g. with gtk_image_new_from_file(). It's not intuitive to me which function to use to load my in memory file into a GtkImage, and I am reluctant to save the image to a file, just to load it, and then delete the file... 2) I'm seeing the following fnctions, and, well, I'm confused. I see GtkImage the related gtk_image functions. I see GdkPixbuf the related gdk_pixbuf functions. I see GtkPixmap the related gtk_pixmap functions. When do I use which ? (and in order to display my jpg image in a v/h-box, is GtkImage really the proper widget to use ?) My first impulse is that you will need to drag libjpeg into this (pretty standard everywhere) and delegate image decoding over to that module. Then create a new image in memory with gdk_image_new() and copy the decoded RGB data over. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Difference between GdkPixbuf and GdkPixmap
Gianni Moschini wrote: Basicly I'm developing a GtkDrawingArea based application. As far as I understand, a GdkPixbuf is stored on the client, and a Pixmap on the server. Of course there are many more differences, but technically that's all I need to know. What is this program intended to do? Something that has to update the frame often, like a video player? Or an image viewing app where things don't change often. The results were pretty slow. Good looking[1], but slow. I suppose this is caused by the the client-server traffic for the pixbuf to be drawn each frame. What facility are you using for profiling? 'top'? Some other tool? Or does it just 'feel' slower? -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Accelerator keys and popup menus?
Stefan Kost wrote: Hi, Daniel Pekelharing wrote: Hi all, Sorry to be posting yet more questions about accel keys... I have created a popup menu and assigned accelerator keys to some of the items, I assigned a GtkAccelGroup to the menu using gtk_menu_set_accel_group(..), I attached the same GtkAccelGroup to the main window with gtk_window_add_accel_group(..), I assigned each item an accel path gtk_menu_item_set_accel_path(..), and finally I set an accelerator key with gtk_accel_map_add_entry(..). The problem is that the accelerator keys don't work on the popup menu, using the exact same functions they work fine on the main menu.. Am I missing something somewhere? Thanks! I seem to have the same problem. Have you found a solution in the last 2 years? I had this same problem at one point. The details are a little fuzzy, but the key is getting the terminology straight. Perhaps what you are looking for is a mnemonic vs. an accelerator. Look that up. It might be what you're looking for. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fake pushing a GTK+ button
danielg RHCE wrote: I'm pulling my hair out over something that I believe should be easy but I cannot see it. I have a program that has your basic set of buttons, windows, switches and adjustables. I have added a listener to tell me if a directory has been added to or changed. The printf statement works great and says, Directory changed at all the right times and is silent at all the right other times. All I wanted to do was to refresh the directory listing inside the program, unfortunately, I don't know the data structure it uses to create the directory tree. Easy enough, right? All I have to do is tell the program that the refresh button has been clicked whenever the directory changes. No, I don't know enough to know what to put in this post to help, but I've got the code and I do have a decent idea how to read it, ask all the questions you like, I'll be happy to answer. I'm stuck. Perhaps gtk_button_pressed() is what you are looking for? http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#gtk-button-pressed Emits a GtkButton::pressed signal to the given GtkButton. There's also one for a clicked signal; not sure about the diff. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Gtk+ icon compiled into executable
brad smith wrote: Hello, I am new to Gtk+ and writing a small application with glade. I have my source file and glade file and icon for the dialog. My question is how can I include the icon in the final binary so it does not have to included in the same folder as the binary. Perhaps convert the icon file to textual data that can be #include'd in the source code? -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Querying Key State
Hi, From my GTK app, I need to query the state of a key. E.g., I need to check if the up-arrow is currently down or up. Is there a clean GTK/GDK way to do this? I know that X11 has XQueryKeymap() but I don't want to have to fall back on that if I can help it. Thanks... -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can A Drawable Canvas Receive Key Events?
Mike Melanson wrote: Tristan Van Berkom wrote: Did you add the events to the event mask before the widget was realized ? Does the widget in question have keyboard focus at the time you want to recieve the keyboard events ? Is the widget in question marked to be focus-capable ? (i.e. the can-focus bit/property) This last item did the trick. I set the can-focus property and the GtkDrawingArea now registers key presses and releases. Thanks. Now that it works in the contrived standalone app, I need to figure out how to get key events in an XEmbed'ed application. I apply the same can-focus property change but I'm afraid I might be fighting with the hosting app for the key events. Answering my own question since I know there are interested people out there... I found that when I put a big text widget inside the XEmbed'ed GtkPlug container instead of a big drawable canvas, it was able to receive focus. Digging into the GTK source code, I noticed that it calls gtk_widget_grab_focus() when it receives a button press event. So I did the same for my canvas widget when the user clicks in it, and it seems to work. The widget retains focus until the user clicks outside of the window. Wow, I can't believe that looking at the source actually helped. :) -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can A Drawable Canvas Receive Key Events?
Mike Melanson wrote: I found that when I put a big text widget inside the XEmbed'ed GtkPlug container instead of a big drawable canvas, it was able to receive focus. Digging into the GTK source code, I noticed that it calls gtk_widget_grab_focus() when it receives a button press event. So I did the same for my canvas widget when the user clicks in it, and it seems to work. The widget retains focus until the user clicks outside of the window. I missed a crucial step here. You also need to specify that the ordinarily non-focusable widget can receive focus by setting its can-focus property: GTK_WIDGET_SET_FLAGS (GTK_WIDGET(my_widget), GTK_CAN_FOCUS); -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Can A Drawable Canvas Receive Key Events?
Tristan Van Berkom wrote: Did you add the events to the event mask before the widget was realized ? Does the widget in question have keyboard focus at the time you want to recieve the keyboard events ? Is the widget in question marked to be focus-capable ? (i.e. the can-focus bit/property) This last item did the trick. I set the can-focus property and the GtkDrawingArea now registers key presses and releases. Thanks. Now that it works in the contrived standalone app, I need to figure out how to get key events in an XEmbed'ed application. I apply the same can-focus property change but I'm afraid I might be fighting with the hosting app for the key events. -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Can A Drawable Canvas Receive Key Events?
Hi, I have a standalone test app that has nothing inside the main window but a big, drawable RGB canvas (GtkDrawingArea). I can receive nearly any kind of event via the canvas: Expose, mouse motion, button press/release, scroll wheel, etc. However, I *cannot* figure out how to get key press events. I even added the key up/down events to the widget's event list using the GDK_KEY_PRESS_MASK and GDK_KEY_RELEASE_MASK flags passed to gtk_widget_add_events(). Is it even supposed to be possible to get key events for the canvas? Is a non-text widget forbidden from receiving key events? When I swap the canvas out for a more text-oriented widget, I get all the key events I want. Thanks... -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
BGR vs. RGB in GTK/GDK
Hi, I have an app that has been drawing bitmaps to the screen using X11 facilities. I'm trying to convert it to use GTK/GDK. This app has always rendered bitmaps in blue-green-red (BGR) pixel order which, per my understanding, is the native order that the hardware expects. Now, I am using gdk_draw_rgb_image()/gdk_draw_rgb_32_image() which clearly states that it wants data in RGB order. Is there a facility I am overlooking for rendering the BGR bitmap? Thanks... -- -Mike Melanson ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list