g_atomic_pointer*
Hi, I need to use an atomic pointer for my app. The documentation for the glib atomic operations is not exactly helpful. Anyway, I wrote a test program: 8 /* atomic.c */ #include glib.h int main() { char* myptr = 0; char* str = Hello; g_atomic_pointer_set(myptr, str); char* p = g_atomic_pointer_get(myptr); return 0; } 8 I had to use the output of gcc `pkg-config --cflags glib-2.0` atomic.c -E to understand what was meant to be used as the parameters. Anyway, the output of this does not look at all atomic: (not that i'm any expert) 8 ... # 4 atomic.c 2 int main() { char* myptr = 0; char* str = Hello; ((void) (*(myptr) = (str))); char* p = ((gpointer)*(myptr)); return 0; } 8 This is on a x86_64, running Gentoo, glib-2.20.5. I don't know if I've got the idea right for how these functions are supposed to be used. Any ideas? Cheers, james. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Download snapshot from Git repository
I have some trouble, at my full time work, I can't get access to a the Git repository other than by web interface, any Git protocolo is blocked! I found at sourceforge.net git service, you can download a shapshot of the current master or what ever commit you require from the web interface!!! Can any buddy add this to the GNOME Git repository? P.D. I don't know where to send this request, sorry if it is wrong place to publish it. -- Trabajar, la mejor arma para tu superación de grano en grano, se hace la arena (R) (en trámite, pero para los cuates: LIBRE) ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GTK+ at the UX Hackfest
Heya, We had a GNOME Usability hackfest last week in London, and a couple of TODO items, and questions cropped up which I thought I would share. For all those tasks, if resources are scarce to get the work done, I think adding those as ideas for the upcoming GSoC 2010 would be good, once technical requirements have been discussed. Cheers Widgets --- Having often used widgets in GTK+ means that we reduce differences in appearance and behaviour between applications and make applications easier to maintain. If the APIs are carefully thought of, usability and design changes can be made without touching the applications. A couple of widgets were mentioned: - a sidebar widget (which I never followed-up on): https://bugzilla.gnome.org/show_bug.cgi?id=307044 - a breadcrumb navigation widget (which could be used in nautilus, the file chooser and yelp, for example) No bugs filed, Cody will be working on filing a bug, and start discussions about the API soon - Segmented bar? It's used in Rhythmbox, Banshee, the Ubuntu installer and could probably be used in others There's a C version in Rhythmbox now: https://bugzilla.gnome.org/show_bug.cgi?id=558576 - Others? Theming --- Just a couple of opened questions: - GTK+ 3.0 theme. How final are the widget set used in the various mockups that were posted during the UX hackfest? Cody mentioned that this is something he might be able to allocate some time for. Thomas Wood might be able to help (though he was non-committal when we mentioned it during the hackfest) A couple of examples: http://jimmac.musichall.cz/log/?p=946 (lower down the post) http://www.hadess.net/2010/02/were-removing-settings-again.html - OSD icons/symbolic icons For a variety of reasons (which are best explained by people that aren't me) we'd like to switch to using symbolic icons instead of colourful ones in the notification areas, and OSD popups. The notification area icons might also end up being used as the Label for menus. In such cases, it would be nice if the OSD icons could use the same properties as text itself (change from black to white when hightlighted, in the default theme), and symbolic colours in GTK+ themes could be used (so that red means warning in both icons and in other places in the UI) Jakub dropped a mail to Bedhad about making those SVG icons as first-class fonts in pango/fontconfig, though I don't know whether this would be the best technical way of achieving those goals. The problems are Colours, and Sizing. Some examples: http://jimmac.musichall.cz/log/?p=946 - a11y instant-on (if not instant-off) a11y is enabled in applications when the XSettings mention that the GTK+ modules should be loaded. We could make GTK+ programs instant-apply the XSettings (what applications would be breaking? Could we whitelist a11y to be the only one auto-loaded? Can we make the change for GTK+ 3.0?) The other problem is that application need to initialise themselves, and register with the at-spi bus to appear in things like screen readers. Could somebody with more knowledge on the subject tell me what changes would be necessary for a11y to become instant-apply? Instant-load/unload of the GTK+ modules in the XSettings sounds like something we could be doing for GTK+ 3.0. Cheers ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: GTK+ at the UX Hackfest
From: Bastien Nocera had...@hadess.net CCing gnome-accessibility list, as probably I will forgot several things. - a11y instant-on (if not instant-off) a11y is enabled in applications when the XSettings mention that the GTK+ modules should be loaded. We could make GTK+ programs instant-apply the XSettings (what applications would be breaking? Could we whitelist a11y to be the only one auto-loaded? Can we make the change for GTK+ 3.0?) The other problem is that application need to initialise themselves, and register with the at-spi bus to appear in things like screen readers. Could somebody with more knowledge on the subject tell me what changes would be necessary for a11y to become instant-apply? The initalization can be done at any moment (and as you said, made by the application themselves). Right now gtk apps require to load gail and atk-bridge modules, so they just need to load this modules using gmodule, and then call the method gtk_module_init (although the method gnome_accessibility_module_init is also provided). At this moment, to made that more easy, this is done during the gtk_init, as it load the gtk modules reading the envar GTK_MODULES (as far as I undertand, the idea now is avoid that and start to use XSettings). About the unload, there are also a method gnome_accessibility_module_shutdown (but not gtk_module_shutdown one), so it would be just call this method and unload the modules. So in theory, no changes should be required from the a11y modules, except, perhaps, add a gtk_module_shutdown method, in order to be more general. In the gtk side, I don't know much about the XSettings, but I suppose that you are talking more general, and XSetting will manage all the gtk modules to be loaded (engines, and so on). So XSettings would have the lists of modules instead of the envvar, and inform to the applications that this setting has changed. In this case is just load/unload the a11y modules as any other gtk modules. Anyway, there are some applications that made that in a custom way. The main example is firefox. As they have some custom a11y thingies, they override this procedure (ie loading by hand the atk bridge). So if firefox wants to use the XSettings solution he would require to rewrite that part, and from the gtk side, it should allow a process to be overriden. Firefox created a log of headaches in this aspect. More information and several cross-bugs here [1] Other issue is that the at-spi daemon (corba or dbus) must be running before the application load the modules (one part of this a11y initialization from the application side is register on at-spi). This can be tricky on the first application that want to instant-on the a11y, and it would require to check if the daemon is running, and if not, execute that. The other module part are general (just load gtk modules when required) but this step requires specific code. BR [1] http://mail.gnome.org/archives/gnome-accessibility-list/2009-January/msg00030.html === API (apinhe...@igalia.com) ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: GTK+ at the UX Hackfest
On Mon, 2010-03-01 at 16:44 +0100, Piñeiro wrote: In the gtk side, I don't know much about the XSettings, but I suppose that you are talking more general, and XSetting will manage all the gtk modules to be loaded (engines, and so on). So XSettings would have the lists of modules instead of the envvar, and inform to the applications that this setting has changed. In this case is just load/unload the a11y modules as any other gtk modules. AFAIK GTK+ already reads the XSettings variable and loads modules accordingly in gtk_init(). The filling of that property is currently done by gnome-settings-daemon. Cheers, Cosimo ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: GTK+ at the UX Hackfest
From: Cosimo Cecchi cosi...@gnome.org On Mon, 2010-03-01 at 16:44 +0100, Piñeiro wrote: In the gtk side, I don't know much about the XSettings, but I suppose that you are talking more general, and XSetting will manage all the gtk modules to be loaded (engines, and so on). So XSettings would have the lists of modules instead of the envvar, and inform to the applications that this setting has changed. In this case is just load/unload the a11y modules as any other gtk modules. AFAIK GTK+ already reads the XSettings variable and loads modules accordingly in gtk_init(). The filling of that property is currently done by gnome-settings-daemon. Yes, you are right, I have just made a quick search, thanks. Probably people like Mathias Clasen, Li Yuan and Willie Walker knows more about xsettings and a11y relation. After another quick search on the bugzilla, I found some interesting (and resolved) bugs about this issue: https://bugzilla.gnome.org/show_bug.cgi?id=535827 https://bugzilla.gnome.org/show_bug.cgi?id=565110 https://bugzilla.gnome.org/show_bug.cgi?id=563943 === API (apinhe...@igalia.com) ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Re: Creating GObject/GTK bindings for language
I apologize for being so terse. I was grasping at straws, trying to think of a specific question regarding GTK binding to get me started. There have been plenty of bindings to scripting languages in the past, so I thought asking about them in general would be the quickest way to get information about making binding. I would like bindings for GTK from Objective C. I originally started to bind classes manually, starting with GList in GLib. While I know that this will take time, if I use that method, I'll die before I finish. I've looked at the obgtk and GTKKit bindings for GTK1, and some of it does look helpful (like how to associate ObjC methods with signals), but GTK has grown so much since then. I'm not sure if it's reasonable to build off of that. How much of this process is not automated? I would like to know how to minimize some of the work involved. Looking at the gir xml stored in the GLib.typelib reveals xml descriptions of what looks like all of the library's classes, but doing the same thing for the libxml typelib shows a gir file that doesn't look complete. How do I know I can trust the .gir file to have a complete description of the library it purports to describe. Secondly, is it header information that is usually automatically generated? Do maintainers then go and manually write the implementations themselves? Finally, do you have a suggestion as to where I can start? Am I on the right track in first trying to get automatically generated headers from the typelib information? --- On Fri, 2/26/10, John Palmieri jo...@redhat.com wrote: From: John Palmieri jo...@redhat.com Subject: Re: Creating GObject/GTK bindings for language To: Tristin Celestin tristin_celes...@yahoo.com Cc: gtk-devel-list@gnome.org Date: Friday, February 26, 2010, 12:14 PM - Tristin Celestin tristin_celes...@yahoo.com wrote: I want to be able to use GObject and GObject based libraries from an object oriented scripting language with no bindings for GObject and GObject based libraries currently. How does one go about creating GObject bindings for another language? I've read the GObject-Introspection pages at gnome.org and looked at the PyGobject binding, but I still don't have a clear idea of where to start. Which language? Have you ever done bindings in that language before? Usually you would wrap a library by making equivalent API calls in that language and marshaling API parameters and results using the glue C/C++ libraries that the language provides for creating modules. More complex libraries usually have some sort of automation for this and some languages have generic automated binding tools like SWiG. With the advent of GObject-Introspection you can now write a minimal interface module that reads in the gir files and routes and marshals method calls based on the gir data structure. PyGObject is a poor library to look at because it does not yet use GObject-Introspect and does the wrapping with its own targeted tool. It is better to look at the Gjs or Seed javascript bindings. Every language is going to be different as they all have their own API for creating C extension modules so again, you need to know how to wrap a simple library in your language before tackling GTK+. -- John (J5) Palmieri Software Engineer Red Hat, Inc. ___ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list
Tutorial for using advanced text features in pango library
Hi Kindly let me know if there is any tutorial for using advanced text features in the pango library. Basil -- The end is only the beginning ___ gtk-i18n-list mailing list gtk-i18n-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Re: PangoF2 in win32 not applying GSUB.
I think I found the cause to the problem. Pango assumes that the FT_StreamRec::base field, if non-zero, points to the whole font file read or mapped into memory. See pango_ot_info_get(). As such this is correct according to FreeType documentation, as said in ftsystem.h, base :: For memory-based streams, this is the address of the first stream byte in memory. This field should always be set to NULL for disk-based streams. Now, for some reason the base field is not set to NULL on Windows when pango_ot_info_get() gets called, even if the FT stream is not memory-based. (FreeType doesn't contain code to map fonts into memory on Windows, even if the API as such is almost as easy to use as mmap() co.) Freetype, a bit dangerously, uses the FT_StreamRec::base field internally while reading stuff from the font file, setting it in FT_Stream_EnterFrame() and resetting it to NULL in FT_Stream_ExitFrame(). Before pango_ot_info_get() gets called, FT_Stream_EnterFrame() has been called but the corresponding call to FT_Stream_ExitFrame() doesn't seem to have happened yet. Whether this is a bug in FreeType, a Windows- or MinGW-specific problem, or whether Pango uses FreeType in some wrong/undefined way, no idea. So face-stream-base is non-NULL and Pango thinks it is a memory-based stream even if base points to some random buffer with just a part of the font file. A quick fix is to make the code in pango_ot_info_get() always use the else branch on Windows, and then indeed for instance in GIMP's text tool Arabic shaping works again, and hopefully also your Telugu problem is solved. At least the result looks different. I now notice that FreeType 2.3.12 has been released, but it doesn't seem to work any differently. --tml ___ gtk-i18n-list mailing list gtk-i18n-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Re: Tutorial for using advanced text features in pango library
Hi Basil, I did not come across any tutorials for advance stuff. For the basic tutorials, here are the links http://x11.gp2x.de/personal/google/ http://www.ibm.com/developerworks/library/l-u-pango2/ For advanced stuff, I use Google CodeSearch with the API I am looking for This gets me code snippets. Since advanced stuff is usually strict in the order in which you call things, I use the flow as it is. http://www.google.com/codesearch You can also look at the samples that I have cobbled together in the previous post. I used code snippets from Inkscape for that . Regds Ravi Kiran --- On Mon, 3/1/10, Basil Saji sajiba...@gmail.com wrote: From: Basil Saji sajiba...@gmail.com Subject: Tutorial for using advanced text features in pango library To: gtk-i18n-list@gnome.org Date: Monday, March 1, 2010, 8:13 AM Hi Kindly let me know if there is any tutorial for using advanced text features in the pango library. Basil -- The end is only the beginning -Inline Attachment Follows- ___ gtk-i18n-list mailing list gtk-i18n-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-i18n-list ___ gtk-i18n-list mailing list gtk-i18n-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Re: PangoF2 in win32 not applying GSUB - Fixed.
Thanks Tml, This fixed the issue for me, now the GSUBs are working properly in win32. I just commented out the portion in pango_ot_info_get() in pango-1.26.2\pango\pango-ot-info.c. PangoOTInfo * pango_ot_info_get (FT_Face face) { PangoOTInfo *info; if (G_LIKELY (face-generic.data face-generic.finalizer == pango_ot_info_finalizer)) return face-generic.data; else { if (face-generic.finalizer) face-generic.finalizer (face-generic.data); info = face-generic.data = g_object_new (PANGO_TYPE_OT_INFO, NULL); face-generic.finalizer = pango_ot_info_finalizer; info-face = face; /* if (face-stream-base != NULL) { hb_blob_t *blob; blob = hb_blob_create ((const char *) face-stream-base, (unsigned int) face-stream-size, HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE, NULL, NULL); info-hb_face = hb_face_create_for_data (blob, face-face_index); hb_blob_destroy (blob); } else */ { info-hb_face = hb_face_create_for_tables (_get_table, NULL, info); } hb_face_set_unicode_funcs (info-hb_face, hb_glib_get_unicode_funcs ()); /* XXX this is such a waste if not SFNT */ if (!hb_ot_layout_has_font_glyph_classes (info-hb_face)) synthesize_class_def (info); } return info; } Warm Regds, Ravi Kiran. --- On Mon, 3/1/10, Tor Lillqvist t...@iki.fi wrote: From: Tor Lillqvist t...@iki.fi Subject: Re: PangoF2 in win32 not applying GSUB. To: Ravi Kiran. kira...@yahoo.com Cc: gtk-i18n-list@gnome.org Date: Monday, March 1, 2010, 10:41 AM I think I found the cause to the problem. Pango assumes that the FT_StreamRec::base field, if non-zero, points to the whole font file read or mapped into memory. See pango_ot_info_get(). As such this is correct according to FreeType documentation, as said in ftsystem.h, base :: For memory-based streams, this is the address of the first stream byte in memory. This field should always be set to NULL for disk-based streams. Now, for some reason the base field is not set to NULL on Windows when pango_ot_info_get() gets called, even if the FT stream is not memory-based. (FreeType doesn't contain code to map fonts into memory on Windows, even if the API as such is almost as easy to use as mmap() co.) Freetype, a bit dangerously, uses the FT_StreamRec::base field internally while reading stuff from the font file, setting it in FT_Stream_EnterFrame() and resetting it to NULL in FT_Stream_ExitFrame(). Before pango_ot_info_get() gets called, FT_Stream_EnterFrame() has been called but the corresponding call to FT_Stream_ExitFrame() doesn't seem to have happened yet. Whether this is a bug in FreeType, a Windows- or MinGW-specific problem, or whether Pango uses FreeType in some wrong/undefined way, no idea. So face-stream-base is non-NULL and Pango thinks it is a memory-based stream even if base points to some random buffer with just a part of the font file. A quick fix is to make the code in pango_ot_info_get() always use the else branch on Windows, and then indeed for instance in GIMP's text tool Arabic shaping works again, and hopefully also your Telugu problem is solved. At least the result looks different. I now notice that FreeType 2.3.12 has been released, but it doesn't seem to work any differently. --tml ___ gtk-i18n-list mailing list gtk-i18n-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Re: Problem identifying GtkTextTags for syntax highlighting
Hi Sanny, Many thanks! Both your suggestions work fine for getting current cursor position by mouse clicks. I am collecting the key values via key-press-event, but so does the text default handler, so the problem is still present for key navigation. However, I could make it work by using the key-release event instead. Lucky! My fumbles also took me to the mark-set signal of GtkTextBuffer. This signal is emitted when text marks change. It works for both mouse and keyboard. However, a single mouse click produces four events, for example the following when I click keyword 'while': findtag ret 28 iter 153571352 mark insert markset MTOKEN Keyword(4) findtag ret 29 iter 153572264 mark selection_bound markset MTOKEN Keyword(4) findtag ret 30 iter 153580256 mark (null) markset MTOKEN Keyword(4) findtag ret 31 iter 153580720 mark (null) markset MTOKEN Keyword(4) The first insert mark is the one I want so I can filter out the others. The last two are unnamed and I don't know what they are. However, when I drag the mouse from letter h to letter l in the 'while' keyword I get the following avalanche of about 70 events: findtag ret 32 iter 153571408 mark insert markset MTOKEN Keyword(4) findtag ret 33 iter 153571352 mark selection_bound markset MTOKEN Keyword(4) findtag ret 34 iter 153576792 mark (null) markset MTOKEN Keyword(4) findtag ret 35 iter 152410200 mark (null) markset MTOKEN Keyword(4) findtag ret 36 iter 153571464 mark insert markset MTOKEN Keyword(4) findtag ret 37 iter 153571872 mark (null) markset MTOKEN Keyword(4) findtag ret 38 iter 153572688 mark (null) markset MTOKEN Keyword(4) findtag ret 39 iter 153577664 mark (null) markset MTOKEN Keyword(4) findtag ret 40 iter 153573152 mark (null) markset MTOKEN Keyword(4) findtag ret 41 iter 153578128 mark insert markset MTOKEN Keyword(4) findtag ret 42 iter 153576976 mark (null) markset MTOKEN Keyword(4) findtag ret 43 iter 153580552 mark insert markset MTOKEN Keyword(4) findtag ret 44 iter 152410624 mark (null) . and when I resize the screen I get hundreds of events for a 10-line test text. For a normal program there would many thousands of these unwanted events. The mark-set would work, but I feel uneasy about it. I also discovered and tried the GtkWidget signal event-efter. It worked. Initialise: [code] g_signal_connect ( G_OBJECT (e) , event-after , G_CALLBACK (eventaftercb) , buf ) ; [/code] with callback: [code] static gboolean eventaftercb (GtkWidget * w, GdkEvent * ev, gpointer user_data ) { if ( (ev-type == GDK_BUTTON_PRESS) ) { printf ( %d BTNpress\n , (int)ev-type ) ; return buttonpresscb ( w, (GdkEventButton *)ev , (char *)user_data ) ; } else if ( (ev-type == GDK_KEY_PRESS) ) { printf ( %d keyPress\n , (int)ev-type ) ; return keypresscb ( w, (GdkEventKey *)ev , (char *)user_data ) ; } return true ; } [/code] Need to test all this a bit more, but as of now, I prefer the event-after method. Would be grateful for comments. Ken --- On Mon, 1/3/10, Sanny Chawla sanny.cha...@gmail.com wrote: From: Sanny Chawla sanny.cha...@gmail.com Subject: Re: Problem identifying GtkTextTags for syntax highlighting To: Ken Resander kresan...@yahoo.com Cc: gtk-list@gnome.org Date: Monday, 1 March, 2010, 2:22 AM Hi Ken, The cursor value which your code is calculating from insert mark is getting updated in button-release-event. So the syntax tokens can be identified in button-release-event callback. You can even try using below method to find the cursor position in button-press-event itself. 1. Convert the x,y coordinates received in the button-press-event to buffer coordindates. 2. Calculate the GtkTextIter from the buffer coordinates. eg : /* Button press callback */ { gtk_text_view_window_to_buffer_coords(text_view, gtk_text_view_get_window_type (GTK_TEXT_VIEW(text_view), event-window),event-x, event-y, x, y); gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), curr, x, y); /* Identify if curr iter is associated with syntax token tag array */ ... ... } regards , Sanny On Sun, Feb 28, 2010 at 5:23 PM, Ken Resander kresan...@yahoo.com wrote: I am trying to do a bit of syntax highlighting. I am using gtk_text_buffer_create_tag and gtk_text_buffer_insert_with_tags to syntax-highlight the intial text (from file). That works fine. The program needs to identify existing syntax tokens in order to do appropriate syntax checking should the user decide to go back and amend them and I am having problems with this. Find a token-tag from current position: [code] static int findtagfromcursor ( GtkTextBuffer * buf ) { GtkTextMark * mark = gtk_text_buffer_get_insert (buf); GtkTextIter curiter ; gtk_text_buffer_get_iter_at_mark (buf, curiter, mark); int k = 0 ; while ( k NUMTOKENS ) { if ( gtk_text_iter_has_tag ( curiter , tags [ k ] ) )
Re: Remarks on gtk docs
On Mon, Mar 01, 2010 at 06:17:15AM +0100, Joost wrote: I've used TK with tcl 1995-1999 writing software to handle plain TeX on Linux. And nearly every Python programmer is using it in the Tkinter form, when making the first steps in Python I've yet to see a Python programmer using Tkinter. On my planet everyone uses Python for scripting (i.e. just on command line) and then, the small fraction of them that develop something with a GUI, uses Gtk+ or Qt. The long list of issues you continue with belongs to Bugzilla. Gtk+ development is not done on this list. Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
Gtk+ development is not done on this list. Oh no, you let out the secret. Now the s/n ratio will drop on lists that developers actually read. --tml ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
On Mon, Mar 01, 2010 at 11:17:25AM +0200, Tor Lillqvist wrote: Gtk+ development is not done on this list. Oh no, you let out the secret. Now the s/n ratio will drop on lists that developers actually read. Well, maybe I should say that Gtk+ development is in fact done on alt.sex.spanking Usenet group. Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Problem identifying GtkTextTags for syntax highlighting
Hi Ken, I am not sure if event-after would be a clean approach. However , following way for getting notified for any event which results in cursor-position change for text buffer will be useful. This will be called only if the cursor-position property is updated. g_signal_connect (buffer, notify::cursor-position, G_CALLBACK (gtk_text_view_notify_cursor_position), view); /*callback method*/ void gtk_text_view_notify_cursor_position(GtkTextBuffer *buffer, GParamSpec *pspec,gpointer user_data) { /*calculate cursor position using insert mark*/ } regards , Sanny On Mon, Mar 1, 2010 at 2:33 PM, Ken Resander kresan...@yahoo.com wrote: Hi Sanny, Many thanks! Both your suggestions work fine for getting current cursor position by mouse clicks. I am collecting the key values via key-press-event, but so does the text default handler, so the problem is still present for key navigation. However, I could make it work by using the key-release event instead. Lucky! My fumbles also took me to the mark-set signal of GtkTextBuffer. This signal is emitted when text marks change. It works for both mouse and keyboard. However, a single mouse click produces four events, for example the following when I click keyword 'while': findtag ret 28 iter 153571352 mark insert markset MTOKEN Keyword(4) findtag ret 29 iter 153572264 mark selection_bound markset MTOKEN Keyword(4) findtag ret 30 iter 153580256 mark (null) markset MTOKEN Keyword(4) findtag ret 31 iter 153580720 mark (null) markset MTOKEN Keyword(4) The first insert mark is the one I want so I can filter out the others. The last two are unnamed and I don't know what they are. However, when I drag the mouse from letter h to letter l in the 'while' keyword I get the following avalanche of about 70 events: findtag ret 32 iter 153571408 mark insert markset MTOKEN Keyword(4) findtag ret 33 iter 153571352 mark selection_bound markset MTOKEN Keyword(4) findtag ret 34 iter 153576792 mark (null) markset MTOKEN Keyword(4) findtag ret 35 iter 152410200 mark (null) markset MTOKEN Keyword(4) findtag ret 36 iter 153571464 mark insert markset MTOKEN Keyword(4) findtag ret 37 iter 153571872 mark (null) markset MTOKEN Keyword(4) findtag ret 38 iter 153572688 mark (null) markset MTOKEN Keyword(4) findtag ret 39 iter 153577664 mark (null) markset MTOKEN Keyword(4) findtag ret 40 iter 153573152 mark (null) markset MTOKEN Keyword(4) findtag ret 41 iter 153578128 mark insert markset MTOKEN Keyword(4) findtag ret 42 iter 153576976 mark (null) markset MTOKEN Keyword(4) findtag ret 43 iter 153580552 mark insert markset MTOKEN Keyword(4) findtag ret 44 iter 152410624 mark (null) . and when I resize the screen I get hundreds of events for a 10-line test text. For a normal program there would many thousands of these unwanted events. The mark-set would work, but I feel uneasy about it. I also discovered and tried the GtkWidget signal event-efter. It worked. Initialise: [code] g_signal_connect ( G_OBJECT (e) , event-after , G_CALLBACK (eventaftercb) , buf ) ; [/code] with callback: [code] static gboolean eventaftercb (GtkWidget * w, GdkEvent * ev, gpointer user_data ) { if ( (ev-type == GDK_BUTTON_PRESS) ) { printf ( %d BTNpress\n , (int)ev-type ) ; return buttonpresscb ( w, (GdkEventButton *)ev , (char *)user_data ) ; } else if ( (ev-type == GDK_KEY_PRESS) ) { printf ( %d keyPress\n , (int)ev-type ) ; return keypresscb ( w, (GdkEventKey *)ev , (char *)user_data ) ; } return true ; } [/code] Need to test all this a bit more, but as of now, I prefer the event-after method. Would be grateful for comments. Ken --- On *Mon, 1/3/10, Sanny Chawla sanny.cha...@gmail.com* wrote: From: Sanny Chawla sanny.cha...@gmail.com Subject: Re: Problem identifying GtkTextTags for syntax highlighting To: Ken Resander kresan...@yahoo.com Cc: gtk-list@gnome.org Date: Monday, 1 March, 2010, 2:22 AM Hi Ken, The cursor value which your code is calculating from insert mark is getting updated in button-release-event. So the syntax tokens can be identified in button-release-event callback. You can even try using below method to find the cursor position in button-press-event itself. 1. Convert the x,y coordinates received in the button-press-event to buffer coordindates. 2. Calculate the GtkTextIter from the buffer coordinates. eg : /* Button press callback */ { gtk_text_view_window_to_buffer_coords(text_view, gtk_text_view_get_window_type (GTK_TEXT_VIEW(text_view), event-window),event-x, event-y, x, y); gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), curr, x, y); /* Identify if curr iter is associated with syntax token tag array */ ... ... } regards , Sanny On Sun, Feb 28, 2010 at 5:23 PM, Ken Resander
Re: Problem identifying GtkTextTags for syntax highlighting
Hi Sanny Many thanks, I didn't know about the notify:: technique to find out about changes of properties. I have read the manual several times, but must have missed it. Is it there? It returns a notification, but it is lagging one behind in the same way as button-press and key-press. I also tried using g_signal_connect_after for mouse as well as keyboard, but the result was the same. I tried it with event-after too filtering on GDK_PROPERTY_NOTIFY, but did not get it. Regards Ken --- On Mon, 1/3/10, Sanny Chawla sanny.cha...@gmail.com wrote: From: Sanny Chawla sanny.cha...@gmail.com Subject: Re: Problem identifying GtkTextTags for syntax highlighting To: Ken Resander kresan...@yahoo.com Cc: gtk-list@gnome.org Date: Monday, 1 March, 2010, 6:41 PM Hi Ken, I am not sure if event-after would be a clean approach. However , following way for getting notified for any event which results in cursor-position change for text buffer will be useful. This will be called only if the cursor-position property is updated. g_signal_connect (buffer, notify::cursor-position, G_CALLBACK (gtk_text_view_notify_cursor_position), view); /*callback method*/ void gtk_text_view_notify_cursor_position(GtkTextBuffer *buffer, GParamSpec *pspec,gpointer user_data) { /*calculate cursor position using insert mark*/ } regards , Sanny On Mon, Mar 1, 2010 at 2:33 PM, Ken Resander kresan...@yahoo.com wrote: Hi Sanny, Many thanks! Both your suggestions work fine for getting current cursor position by mouse clicks. I am collecting the key values via key-press-event, but so does the text default handler, so the problem is still present for key navigation. However, I could make it work by using the key-release event instead. Lucky! My fumbles also took me to the mark-set signal of GtkTextBuffer. This signal is emitted when text marks change. It works for both mouse and keyboard. However, a single mouse click produces four events, for example the following when I click keyword 'while': findtag ret 28 iter 153571352 mark insert markset MTOKEN Keyword(4) findtag ret 29 iter 153572264 mark selection_bound markset MTOKEN Keyword(4) findtag ret 30 iter 153580256 mark (null) markset MTOKEN Keyword(4) findtag ret 31 iter 153580720 mark (null) markset MTOKEN Keyword(4) The first insert mark is the one I want so I can filter out the others. The last two are unnamed and I don't know what they are. However, when I drag the mouse from letter h to letter l in the 'while' keyword I get the following avalanche of about 70 events: findtag ret 32 iter 153571408 mark insert markset MTOKEN Keyword(4) findtag ret 33 iter 153571352 mark selection_bound markset MTOKEN Keyword(4) findtag ret 34 iter 153576792 mark (null) markset MTOKEN Keyword(4) findtag ret 35 iter 152410200 mark (null) markset MTOKEN Keyword(4) findtag ret 36 iter 153571464 mark insert markset MTOKEN Keyword(4) findtag ret 37 iter 153571872 mark (null) markset MTOKEN Keyword(4) findtag ret 38 iter 153572688 mark (null) markset MTOKEN Keyword(4) findtag ret 39 iter 153577664 mark (null) markset MTOKEN Keyword(4) findtag ret 40 iter 153573152 mark (null) markset MTOKEN Keyword(4) findtag ret 41 iter 153578128 mark insert markset MTOKEN Keyword(4) findtag ret 42 iter 153576976 mark (null) markset MTOKEN Keyword(4) findtag ret 43 iter 153580552 mark insert markset MTOKEN Keyword(4) findtag ret 44 iter 152410624 mark (null) . and when I resize the screen I get hundreds of events for a 10-line test text. For a normal program there would many thousands of these unwanted events. The mark-set would work, but I feel uneasy about it. I also discovered and tried the GtkWidget signal event-efter. It worked. Initialise: [code] g_signal_connect ( G_OBJECT (e) , event-after , G_CALLBACK (eventaftercb) , buf ) ; [/code] with callback: [code] static gboolean eventaftercb (GtkWidget * w, GdkEvent * ev, gpointer user_data ) { if ( (ev-type == GDK_BUTTON_PRESS) ) { printf ( %d BTNpress\n , (int)ev-type ) ; return buttonpresscb ( w, (GdkEventButton *)ev , (char *)user_data ) ; } else if ( (ev-type == GDK_KEY_PRESS) ) { printf ( %d keyPress\n , (int)ev-type ) ; return keypresscb ( w, (GdkEventKey *)ev , (char *)user_data ) ; } return true ; } [/code] Need to test all this a bit more, but as of now, I prefer the event-after method. Would be grateful for comments. Ken --- On Mon, 1/3/10, Sanny Chawla sanny.cha...@gmail.com wrote: From: Sanny Chawla sanny.cha...@gmail.com Subject: Re: Problem identifying GtkTextTags for syntax highlighting To: Ken Resander kresan...@yahoo.com Cc: gtk-list@gnome.org Date: Monday, 1 March, 2010, 2:22 AM Hi Ken, The cursor value which your code is calculating from insert mark is getting updated in button-release-event. So the syntax tokens can be identified
Re: Use Umlauts on a Swiss Keyboard
Thanks for your answer. I've added a comment (with some more details) to the proposed bug. But based on the bug reports it seems that there is not easy fix and any modification could change the behaviour of any other layout. Thanks to your response I learned that it's possible to enter unicode directly in GTK applications with Ctrl+Shift+U, at least for me that is good enough. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
That is not only your planet. There are also that folks, who run youtube, there is Zope (where Mr. van Rossum worked), there are the (unknown for me) systems, for which the reporting tools of www.reportlabs.com are made for. Or slqalchemy - also only useful in large projects. My OKamba is consisting of more than 100 files Python and i have experienced the power of that language. The planet you describe as yours, must be Mars. Kind regards, Joost Behrends ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
On Mon, Mar 01, 2010 at 02:13:05PM +0100, Joost wrote: There are also that folks, who run youtube, there is Zope (where Mr. van Rossum worked), there are the (unknown for me) systems, for which the reporting tools of www.reportlabs.com are made for. Or slqalchemy - also only useful in large projects. My OKamba is consisting of more than 100 files Python and i have experienced the power of that language. And the funny part is that none of it backs your claim [cite] nearly every Python programmer is using it in the Tkinter form, when making the first steps in Python [/cite] Not even anecdotally. Actually, I was kidding, the funny part is the `my Python project has more files than your Python project' stuff. Seriously, you claimed that Python is used in a certain manner by almost all its users. After my remark that I don't see it to be used at all in this way no evidence that what I observe is in fact an eccentric behaviour followed. So, please provide it or cease speaking for `almost all Python programmers'. Yeti ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
My planet is so much worse and more aggressive, that i see no legitimation for any cease to speak of ... from you. After all that tries to exclude my from mankind. And what has to be in the buglist, what on the developer list and so on, lies not in your hands. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: [gnome-db] Include Gir file with constant #x1b;[;31;1m
I'll test it as soon as possible, by using JavaScript and may be Vala. Very thanks. 2010/2/27 Vivien Malerba vmale...@gmail.com: On 25 February 2010 19:03, Piotr Pokora piotrek.pok...@gmail.com wrote: Daniel Espinosa pisze: Are there any important reason for this? Because 4.2 will be released shorty (I think). I am doing my best to have Libgda 4.0.7 included in upcoming Ubuntu Lucid (which is Long Term Supported release). To make this happen I requested Libgda updates in Debian unstable (which migrated to testing release already). If GIR support could be ported to 4.0 branch and 4.0.8 could be released in reasonable short time, there is a chance many people could be happy with stable and easy available Libgda for long time. GIR support has been added to the LIBGDA_4.0 branch, but I haven't tested it at all (though it's the same as for the master branch and it works fine), so some minimal testing should be done here. I can make a 4.0.8 anythime you want. Tell me. Vivien Vivien -- Trabajar, la mejor arma para tu superación de grano en grano, se hace la arena (R) (en trámite, pero para los cuates: LIBRE) ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
Hi David, On Mon, 1 Mar 2010 10:04:27 +0100 you wrote: I've yet to see a Python programmer using Tkinter. Oooh! Ooooh! Sir! Sir! http://lintrain.sourceforge.net http://www.livewires.org.uk/python And I could name others. TkInter is not dead. However, that shouldn't detract from the important Gtk points that are being discussed. If there are any ;) :P ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: [gnome-db] Include Gir file with constant #x1b;[;31;1m
On 1 March 2010 17:01, Daniel Espinosa eso...@gmail.com wrote: I'll test it as soon as possible, by using JavaScript and may be Vala. Very thanks. Ok, thanks a lot. BTW, you were working on Gobject introspection for Libgda-ui, do you have something working? If so I can integrate it into the current trunk and release it with the next 4.1.x version. Regards, Vivien ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: [gnome-db] Include Gir file with constant #x1b;[;31;1m
I'm near, but I can fine the way to make compile and generate gir and typedef files for Gda UI, some thing is missing to include, I don't know if some headers files or the Gda-4.0.gir file. I'll test different ways to make it work. For know including Gda-4.0.gir file throws an exception due to some constants defined in Gda 4.1.x, I'll check them on 4.0.x too, witch if I delete them from the parsing to generate gir file compilations fails. I hope to have some thing working, as soon as I receive retrofit from gtk-devel-list about the g-ir-scanner parser, or I can manage to generate the gir file with out GDA gir file. Actually parsing/compilation fails because it doesn't fine GdaSet object, may be this is the only one object I have to skip to have a partially support for Gda-UI API. 2010/3/1 Vivien Malerba vmale...@gmail.com: On 1 March 2010 17:01, Daniel Espinosa eso...@gmail.com wrote: I'll test it as soon as possible, by using JavaScript and may be Vala. Very thanks. Ok, thanks a lot. BTW, you were working on Gobject introspection for Libgda-ui, do you have something working? If so I can integrate it into the current trunk and release it with the next 4.1.x version. Regards, Vivien -- Trabajar, la mejor arma para tu superación de grano en grano, se hace la arena (R) (en trámite, pero para los cuates: LIBRE) ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Download snapshot from Git repository
I have some trouble, at my full time work, I can't get access to a the Git repository other than by web interface, any Git protocolo is blocked! I found at sourceforge.net git service, you can download a shapshot of the current master or what ever commit you require from the web interface!!! Can any buddy add this to the GNOME Git repository? P.D. I don't know where to send this request, sorry if it is wrong place to publish it. -- Trabajar, la mejor arma para tu superación de grano en grano, se hace la arena (R) (en trámite, pero para los cuates: LIBRE) ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Remarks on gtk docs
Gentlemen, Please, enough. This type of debate is not the purpose of this list. Consider also your cultural biases and the misunderstanding of tone and intent that they may cause. Leon Opit On 2 March 2010 03:02, Robert Pearce r...@bdt-home.demon.co.uk wrote: Hi David, On Mon, 1 Mar 2010 10:04:27 +0100 you wrote: I've yet to see a Python programmer using Tkinter. Oooh! Ooooh! Sir! Sir! http://lintrain.sourceforge.net http://www.livewires.org.uk/python And I could name others. TkInter is not dead. However, that shouldn't detract from the important Gtk points that are being discussed. If there are any ;) :P ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Capturing global key press events
I'd like to capture global key press events to enable a Global Shortcuts feature in my application. I've looked at a few other projects that have such capabilities and they all seem to hook straight into xlib. Is there a more GTK way of doing it? At the moment I'm using, XKeysymToKeycode($DISPLAY,XStringToKeysym(some key in here)); And then passing the resulting key code to XGrabKey, XGrabKey($DISPLAY,key,Mod4Mask|ShiftMask,$WINDOW,True,GrabModeAsync,GrabModeAsync); Then I call XSync($DISPLAY,0); I dont know why, but if I dont, gtk segfaults. I then wait for events with XNextEvent($DISPLAY,event); inside a pthread and when an event comes by, i call a signal callback surrounded with gdk_threads_enter and _leave. Now all this worked nicely for a while, but somehow I've managed to break it :( It doesnt seem to pick up the events from the keys I passed to XGrabKeys anymore. If I switch to AnyModifier, it picks things up, but obviously the keyboard becomes unusable for other applications then. I believe XGrabKeys will alert me with a BadAccess error if i try to use a key that is already being grabbed by another x client, but I dont know how well this mechanism works. Mod4Mask seems to refer to the Super Key, aka, Windows Key. So in my example I have modifiers Shift+Super and keycode key. When it worked, I had Shift+Super+{z,x,c,v,b} setup. Now nothing works and for the best of me, I can't seem to understand what I've changed. A little background information: My app is heavily threaded, there are about 12+ threads at any given time. They are all created with pthread_create, and use gdk_threads_enter/leave before touching anything gdk/gtk/glib related. In main() I call g_thread_init( NULL ); and gdk_threads_init(); before gtk_init(argc,argv); I've read in some places one should surround gtk_main() with gdk_threads_enter/leave, but this absolutely doesnt make any sense to me. If I try to do that, the app locks in gtk_main and doesnt startup. My assumption is that gdk_threads_enter() acts like sem_wait() and gdk_threads_leave() acts like sem_post(), where gdk_threads_init() sets the value of the semaphore to 1. With this assumption I've used gdk_threads_enter/leave throughout my app and it definitely works. I'm guessing there is some sort of conflict between the key-press-event for the top level GtkWindow and my xlib key grabbing, but I don't know how to debug the situation further. Any ideas whats going on? thanks, Vikram. PS: GTK docs are much better than X11 docs :) ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Capturing global key press events
Lex Trotman wrote: On 2 March 2010 15:29, Vikram Noel Ambrose noel.ambr...@gmail.com mailto:noel.ambr...@gmail.com wrote: I'd like to capture global key press events to enable a Global Shortcuts feature in my application. I've looked at a few other projects that have such capabilities and they all seem to hook straight into xlib. Is there a more GTK way of doing it? At the moment I'm using, XKeysymToKeycode($DISPLAY,XStringToKeysym(some key in here)); And then passing the resulting key code to XGrabKey, XGrabKey($DISPLAY,key,Mod4Mask|ShiftMask,$WINDOW,True,GrabModeAsync,GrabModeAsync); Then I call XSync($DISPLAY,0); I dont know why, but if I dont, gtk segfaults. I then wait for events with XNextEvent($DISPLAY,event); inside a pthread and when an event comes by, i call a signal callback surrounded with gdk_threads_enter and _leave. Now all this worked nicely for a while, but somehow I've managed to break it :( It doesnt seem to pick up the events from the keys I passed to XGrabKeys anymore. If I switch to AnyModifier, it picks things up, but obviously the keyboard becomes unusable for other applications then. I believe XGrabKeys will alert me with a BadAccess error if i try to use a key that is already being grabbed by another x client, but I dont know how well this mechanism works. Mod4Mask seems to refer to the Super Key, aka, Windows Key. So in my example I have modifiers Shift+Super and keycode key. When it worked, I had Shift+Super+{z,x,c,v,b} setup. Now nothing works and for the best of me, I can't seem to understand what I've changed. A little background information: My app is heavily threaded, there are about 12+ threads at any given time. They are all created with pthread_create, and use gdk_threads_enter/leave before touching anything gdk/gtk/glib related. In main() I call g_thread_init( NULL ); and gdk_threads_init(); before gtk_init(argc,argv); I've read in some places one should surround gtk_main() with gdk_threads_enter/leave, but this absolutely doesnt make any sense to me. If I try to do that, the app locks in gtk_main and doesnt startup. My assumption is that gdk_threads_enter() acts like sem_wait() and gdk_threads_leave() acts like sem_post(), where gdk_threads_init() sets the value of the semaphore to 1. With this assumption I've used gdk_threads_enter/leave throughout my app and it definitely works. I'm guessing there is some sort of conflict between the key-press-event for the top level GtkWindow and my xlib key grabbing, but I don't know how to debug the situation further. Any ideas whats going on? thanks, Vikram. PS: GTK docs are much better than X11 docs :) I assume you've looked at accelerator groups and accelerator maps then, what don't they do? By global I meant from any keyboard on a particular X Display. ie, my gtk application will not be the focus of input. ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: Issues with performance of Simple List
On 27 February 2010 22:28, Mike Martin redt...@googlemail.com wrote: I am having issues with the performance of simple list in a wierd way Basicaly I have a simple list object embedded into a window which gets data from a sqlite database via user defined criteria If I dont access the simplelist at all changes to the data are nearly instantaeous however if access the simple list at all there is a delay between 20-40 seconds Solved it finally - it seems there was a strange interaction between sqlite and simplelist to do with a corrupted index dropped and restored index and everything is sweet ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list