Re: d'n'd on a listview
Hi! I have read the document at http://developer.gnome.org/doc/API/2.0/gtk/gtk-GtkTreeView-drag-and-drop.html about high-level drag'n'drop api for gtktreeview, but still don't know where to start. I understand most of this functions, but what events I have to connect to, to enable drag and drop on a single listview. I need an abbility to drag a row and drop it on another row on the same listview. regards hs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Providing gtk_main() with asynchronous data
On Sun, 2005-07-31 at 15:44 -0600, Pat Mahoney wrote: (not subscribed; please CC replies) I'm trying to find a way to provide my mainloop with asynchronous data from a thread. I have read this: http://mail.gnome.org/archives/gtk-app-devel-list/2004-July/msg00181.html which describes how to use a GAsyncQueue and GSource to watch the queue for available data (and to have the thread wake up the mainloop when data is available). A callback is run in the context of gtk_main when data is available. It works perfectly except for one show-stopper problem: Note that using a custom GSource here is perhaps overcomplicated. The simplest method is: g_idle_add (function_to_call_in_main_thread, data_to_pass_to_function); (Or use g_idle_add_full() if you want to prioritize the callback higher than the default idle priority.) Regards, Owen ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fonts
On Tue, 2005-08-02 at 00:16 +1000, Russell Shaw wrote: Hi, Does all text in gtk/pango get sent to the X server as ascii, or are bitmaps sent too? If sent as ascii, is it 7-bit, 8-bit, or something longer? Does gtk have any control over what renders the fonts at the X server? Is XDrawString used? When rendering using Xft or (for in GTK+-2.7, Cairo), characters are rendered client side and sent to the server as images. Then a RenderCompositeGlyphs request is made to draw those images to the screen. It looks conceptually like: Using glyphset 1432413: draw glyph #3 at 40,10 draw glyph #4 at 50,10 [...] Regards, Owen ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Providing gtk_main() with asynchronous data
On Mon, Aug 01, 2005 at 05:36:47PM -0400, Tristan Van Berkom wrote: In gereral this is how we deal with this problem: typedef struct { GSource source; gpointer my; gint extended; gchar *data; } GMySource; Thanks, works great. My C skills are weak... should have caught that from the g_source_new() docs. -- Pat Mahoney [EMAIL PROTECTED] ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Providing gtk_main() with asynchronous data
On Tue, 2005-08-02 at 06:36 -0600, Pat Mahoney wrote: On Tue, Aug 02, 2005 at 07:47:32AM -0400, Owen Taylor wrote: On Sun, 2005-07-31 at 15:44 -0600, Pat Mahoney wrote: (not subscribed; please CC replies) I'm trying to find a way to provide my mainloop with asynchronous data from a thread. I have read this: http://mail.gnome.org/archives/gtk-app-devel-list/2004-July/msg00181.html which describes how to use a GAsyncQueue and GSource to watch the queue for available data (and to have the thread wake up the mainloop when data is available). A callback is run in the context of gtk_main when data is available. It works perfectly except for one show-stopper problem: Note that using a custom GSource here is perhaps overcomplicated. The simplest method is: g_idle_add (function_to_call_in_main_thread, data_to_pass_to_function); (Or use g_idle_add_full() if you want to prioritize the callback higher than the default idle priority.) Yes, that is simplest. In my case, the CPU usage jumps to 100% (though the app is still responsive). My particular app is reading frames from one or more webcams (select() doesn't work with video4linux devices, so this must be done in a seperate thread or process). The camera_thread is triggered by the mainloop to snap a picture which it pushes onto a GAsyncQueue. My callback on_camera_frame_available() checks the queue and returns immediately if there is no data. Similarly, the GSourceFuncs check the queue. However, by using the GSource, the check is performed about 2-3 times per frame (using printf() to watch that, so timing may be skewed), while the g_idle_add() method runs my callback continually, and so the GAsyncQueue is constantly being checked for data, sucking down the CPU. Your idle function presumably has the wrong return value. To quote: http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-idle-add If the function returns FALSE it is automatically removed from the list of event sources and will not be called again. Regards, Owen ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
VFS monitor
I am using gnome_vfs_monitor_addto monitor a directory. When there are subsequent changes to the dirctory, the application crashes with this message: libgnomevfs-ERROR **: file gnome-vfs-monitor.c: line 246 (actually_dispatch_callback): assertion failed: (callback_data-send_state != CALLBACK_STATE_SENDING) aborting... Anybody knows the meaning? ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Fonts
On Tue, 2005-08-02 at 10:35 +1000, Russell Shaw wrote: I was wandering if every time a gtk app prints some text, the instructions for each character to print are sent as 1 byte, or 4 bytes like utf-8 or whatever (eg, 0x61 for 'a') so that the text rendering thing on the server side knows which glyph to render, or if there are fonts where each *bitmap* for a character is sent from the client to the server. It's rather more complex than that. In the simplest case, an instruction to draw at a given location is sent using the X protocol, and the operands include the graphics context to use, the drawable to draw onto, the x and y coordinates (all as 16-bit integers I think, although compression is used in some circumstances) followed by the 16-bit length of the string, followed by the string, and the server maps each character of the string to the corresponding bitmap in a font. However, it turns out to be faster and more efficient to render the fonts to bitmaps on the client. The first time each character is used it is sent to the server as a bitmap, but subsequently it is reused. One reason that this is more efficient is that in order for the client to tell the server to use the server-side fonts, the server has to send the full font metrics to the client -- the bounding box of each character, etc. -- and this is a lot of data. Is pango running on the client side, or the server side? client. A previous post mentioned font caching. I was wandering if gtk can be speeded up. For any particular application there may be ways to speed up rendering, but in general a lot of effort has already been put into making it at least reasonably fast. Have you written a program that's too slow? One thing to check is that your DISPLAY variable is set to :0.0 and not to the full hostname -- this can make a significant difference on slow systems. Otherwise it's hard for me to guess where you might have performance problems: it's necessary to measure. Liam Liam Quin, http://www.holoweb.net/~liam/ http://fromoldbooks.org/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Query - Using Gtk on the Framebuffer..
Hello Everybody i want to use GTK on the Framebuffer..i have read the doc related to this... but i m confused.. i m using gtk+2.0 ( installed with Redhat 9)..able to work with it..but now i want to try Framebuffer Programming...let me know any Tutorial available for that.. now it's written in the docs to compile GTK+ with framebuffer support you will need FreeType 2 i will get this from the mentioned site..but if i install freetype will my previous gtk work properly..i mean i will download the tarball for freetype and will extract it will this help me out or wat else i have to do to work with Gtk on framebuffer. Any sample tutorials available for working with framebuffer using GTK. Pls help me out ..i m new to this.. Thanx Waiting for ur reply Hazzy. - Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: d'n'd on a listview
Hi again! Sorry if this topic was explained in the past. I connected drag'n'drop events to my treeview: g_signal_connect (object, drag-begin, G_CALLBACK (_drag_start_cb), NULL); g_signal_connect (object, drag-data-get, G_CALLBACK (_drag_data_get_cb), NULL); g_signal_connect (object, drag-data-received, G_CALLBACK (_drop_cb), NULL); g_signal_connect (object, drag-end, G_CALLBACK (_drag_end_cb), NULL); gtk_tree_view_enable_model_drag_source (widget, 0, target_table, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (widget, target_table, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE); but none if this callbacks are called when I drag and drop rows from this treeview. why ? thanks in advance hs ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Providing gtk_main() with asynchronous data
That is an excellent example, and I also was working solving this AsyncQueue method! Have you run into any examples of communicating TO a separate thread? Sydney ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: d'n'd on a listview
it was my fault, I didn't add a button mask to gtk_tree_view_enable_model_drag_source ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: GdkEvent -- XEvent
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tristan Van Berkom wrote: Hi all, As usual, I'm trying to do something that just wasnt' meant to be done :) (otherwise when would I have any fun ?) I'm trying to write a widget that will display a netscape gecko plugin stream on linux, the plugin framework delivers an XEvent to the plugin and lets the plugin react, essentially; I want to do this: gint widget_event_handler (GtkWidget *widget, GdkEvent *event, gpointer data) { FunkyPointer fptr = gdk_get_some_obscure_internal_thingy (); XEvent *event = fptr-walk-the-obscure-structures; deliver_event_to_plugin (plugin, event); } Hmmm, surly the XEvent isnt gone during the emission is it ? I'm relatively sure the XEvent is indeed lost by the time you see it in your event handler. If you'll look at the various XEvent and GdkEvent structures, however, you'll note that they're fairly similar (I think it's safe to assume GdkEvent was originally based on XEvent). You can construct XEvents from GdkEvents, though there's a little work involved, especially if you care about all event types and not just a few particular events. -brian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (MingW32) iD8DBQFC7+VP6XyW6VEeAnsRAvVhAKDCp6Gx1WhaoWZZ5mOFsuWbiZ9VugCfSWsn tsbGl6OQds+93MXTEC4lYYk= =9b9u -END PGP SIGNATURE- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
pkg-config vs gnome-config
If this message if out of place or already answered, please point me to the right direction and I'll be more than happy to follow up there. I'm working on an app that uses gtk+-2.0 and a gdk_canvas. 'gnome-config' points to the gtk-1.2 installation and pkg-config leaves out the necessary include directories such that I get errors about gnome.h not being found. I'm not finding any .pc files in /usr/lib/pkgconfig that look like their for a standalone gnome app. Do I need to write one? Thanks. Here's what I have in my Makefile right now: $(CC) $(CFLAGS) $(DEBUGFLAGS) `pkg-config gdk-2.0 --libs --cflags` -o p p.c mark ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: pkg-config vs gnome-config
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark C. Smith wrote: If this message if out of place or already answered, please point me to the right direction and I'll be more than happy to follow up there. I'm working on an app that uses gtk+-2.0 and a gdk_canvas. 'gnome-config' points to the gtk-1.2 installation and pkg-config leaves out the necessary include directories such that I get errors about gnome.h not being found. I'm not finding any .pc files in /usr/lib/pkgconfig that look like their for a standalone gnome app. Do I need to write one? Thanks. Here's what I have in my Makefile right now: $(CC) $(CFLAGS) $(DEBUGFLAGS) `pkg-config gdk-2.0 --libs --cflags` -o p p.c GDK is a semi-internal backend support library for GTK. You want to be using 'gtk+-2.0' in your pkg-config line. If you are using gnome2 libraries, check out /usr/lib/pkgconfig/libgnome*.pc for things you might be using. You'll probably want 'libgnome-2.0' and perhaps 'libgnomeui-2.0'. IIRC, libgnomeui-2.0 will include cflags/libs parameters for GTK as well, so you can probably omit 'gtk+-2.0'. gnome-config is for gnome 1.x, I believe. -brian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (MingW32) iD8DBQFC8AFm6XyW6VEeAnsRAoHGAJ9G53EYxU2KHrEHmzcp+LdInaZcfgCfdRCE S5o/GLw/RMgp/43hKFj+v1s= =PO0Q -END PGP SIGNATURE- ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
General CPU usage question
I'm sure this question has been asked before, so maybe just point me to the right place where I could look. Suppose, as a simple example, I am setting the bg color of a GtkEventBox and suppose there is a lot of redundancy, meaning that, say, I set the background color to red when it's already red. In practice, this often happens when you do not do any internal tracking that would minimize the number of GUI calls you make. My questions is: does this increase the CPU usage? Is it possible, for example, that Gtk tracks things down internally and doesn't physically update the color when the color requested is the same? More generally, should redundancy be explicitly avoided, or Gtk avoids it internally? Thanks, Nickolai ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
g_spawn_async_with_pipes problems
Hello people. I call an external program, like this: ok = g_spawn_async_with_pipes(/tmp, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, std_in, std_out, std_err, error); For both the std_out and std_err file descriptors, I connected g_io_watch functions. I didn't do that for std_in, as I wanted to send commands on that pipe asynchronously. This works if instead of std_in, I write NULL in the spawn call. Just modifying the line to what is above, seems to block both stdout and stderr output pipes. Could someone point me to some application where g_spawn_async_with_pipes is uses with all three pipes used? I asked Dr Google without success. Thanks, John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list