Re: Valgrind questions

2011-09-20 Thread jcupitt
I posted this the last time this subject came up (twice last year, I think), but I made this valgrind suppression file for my project:  http://www.vips.ecs.soton.ac.uk/development/nip2.supp Run with: $ export G_DEBUG=gc-friendly This makes Glib clear certain memory areas after using the

Re: Valgrind questions

2011-09-20 Thread jcupitt
Hi Tom, On 20 September 2011 11:38, Thomas Harty wrote: > Running like that, I still get quite a few leaks detected by valgrind. Some > of them are created by g_type_add_interface_static, which looks like another > type_init leak, which we can safely ignore. So, I've added the following to > t

Re: GLib with Flex and Bison

2011-10-03 Thread jcupitt
On 3 October 2011 01:37, Craig wrote: > I am about to try to use GLib in a Bison file, mainly calling > functions on the GList Object.  I have never tried this before.  Will it > work?  Are there any threading issues? Bison and flex don't use threads, so no, there's no issue there, it works fine.

Re: gtk and linux

2011-11-03 Thread jcupitt
Hi Craig, On 3 November 2011 08:07, Craig wrote: > Is there a list of linux "flavors" like Ubuntu, KDE, Red Hat... that > include or don't include gtk? And, let's say that a type of linux I think all will include gtk, either as part of the standard install or available via the package manager. T

Re: Valgrind questions

2011-11-23 Thread jcupitt
Hi Tom, On 23 November 2011 15:21, Thomas Harty wrote: > any suggestions for what's causing this leak report and the best way to > suppress it? That looks like a gtk/gtkmm bug to me, but it's hard to tell without some context. Could you make a tiny test program which shows this behaviour? It a

Re: obtain parent from menu callback

2011-11-28 Thread jcupitt
Widget *menu, GtkWidget *button, Rowview *rview ) { do_stuff( rview ); } Source here, along with some other stuff. It's only 100 lines or so. https://github.com/jcupitt/nip2/blob/master/src/gtkutil.c John ___ gtk-app-devel-list maili

Re: mutex doubt

2011-12-06 Thread jcupitt
2011/12/6 Marcelo Elias Del Valle - SYSMAP SOLUTIONS - Claro MA-SP - : >        Do I need to call g_thread_init() manually before calling g_mutex_new > (), in a glib only application? Or is it auto called by default when I call > g_type_init() and therefore I don't need to do it? Older versions

Re: Focus behaviour on widget derived from a gtkentry

2011-12-07 Thread jcupitt
On 7 December 2011 09:16, Geert Janssens wrote: > I am now having problems to set the focus on this widget programmatically. In > this particular use case, the widget is added to a GtkAssistant, and during > the prepare of the page showing this widget, I call a gtk_widget_grab_focus on > it. This

Re: a couple questions...

2011-12-08 Thread jcupitt
Hi Gary, On 8 December 2011 01:00, Gary Kline wrote: >        i'll need a play button and callback that invokes, say, >        espeak -f on that file. Make a play button with gtk_button_new_from_stock(GTK_STOCK_PLAY): http://developer.gnome.org/gtk3/stable/GtkButton.html#gtk-button-new-from-sto

Re: GLIB for a webserver

2011-12-11 Thread jcupitt
Hi Marcelo, On 10 December 2011 23:05, Marcelo Elias Del Valle wrote: >    Imagine the following scenario: the application running on my web > server spends 20k of memory for each concurrent request. If I have > enough concurrent requests in a way it will consume more memory than, > let's say, 2G

Re: how to use hbox?

2011-12-12 Thread jcupitt
Hi Gary, 2011/12/11 Gary Kline : >        well, i've reached a stumbling block.  the app i am working >        on had things is a vertical stack.  so far, there about 6 >        rectangles.  the first shows the default title and the >        count: Something like "talk.0.txt" Here's a tiny demo p

Re: GLIB for a webserver

2011-12-13 Thread jcupitt
On 13 December 2011 10:45, Marcelo Elias Del Valle wrote: > I was thinking in monitor the server memory to not let it reach the maximum > allowed by the OS, which seems to be the basic idea behind what you have > said. Although I think it' s better than nothing, the problem is that other > machine

Re: list troubles?

2011-12-16 Thread jcupitt
On 16 December 2011 08:17, Gary Kline wrote: > i've asked what i thought were straightforeward quwstions recently. > zip.  am i getting thru? The last mail I see from you in my mail archive is 2 days ago, saying "thanks" to Florian. Were there some more since then? John _

Re: GtkTreeView very slow for large lists

2011-12-16 Thread jcupitt
2011/12/16 John Lindgren : > Lately I have been trying to improve the performance with large > playlists (i.e. on the order of 100,000 entries).  The one remaining > problem spot seems to be GtkTreeView.  I am attaching a simple test > program that creates a GtkTreeView with 3 columns and 100,000 r

Re: GtkTreeView very slow for large lists

2011-12-16 Thread jcupitt
On 16 December 2011 10:36, wrote: > 2011/12/16 John Lindgren : >> Lately I have been trying to improve the performance with large >> playlists (i.e. on the order of 100,000 entries).  The one remaining >> problem spot seems to be GtkTreeView.  I am attaching a simple test >> program that creates

Re: maybe known, maybe not...

2012-01-08 Thread jcupitt
Hi Gary, On 8 January 2012 02:49, Gary Kline wrote: > o am trying to have a "run" button fork off a new gvim and increase > a global counter after the first gvim is closed.  my main gtk goes > dark and nothing responds in this case.  i don't know if every If you do this: system("gvim stuff.tx

progress bar use

2012-01-16 Thread jcupitt
On Monday, 16 January 2012, Nick Belshaw wrote: > I would like to implement a progress-bar to make clear to users stuff is > happening. > Specifics involve loading and pre-processing of files. Some files might be > very big requiring some 10's of seconds to do all stuff. > At the moment the proces

Re: porting Xlib/Motif apps to GTK+

2012-02-29 Thread jcupitt
Hi Roger, I moved a medium-sized (100k lines) application from Motif/X11 to gtk+ a while ago. As you say, gdk_ is a thin layer over the X11 drawing system, so converting that is pretty easy. Gdk has quite a few helpers too, eg. stuff for rendering a 24-bit image to whatever visual the server has,

Re: porting Xlib/Motif apps to GTK+

2012-02-29 Thread jcupitt
As a short-term fix I think it'd be fine to target gtk2, it's going to be around for years. In my opinion, the time of xor rubber banding has passed, it's just too hard to get it working reliably in complex situations. Once you have double buffering, background scrolling, overlapping display objec

Re: gtk+ 2.24 installation problems

2012-03-04 Thread jcupitt
Hi Roger, On Saturday, 3 March 2012, Roger Davis wrote: > I then downloaded those sources and first built glib 2.27.93 with a > simple './configure --prefix=/usr; make; make install;'. That went fine, Oh dear, I think you may have broken your system. You've overwritten files which were being run

Re: Scrollable object problem in GTK 2.20 (Windows)

2012-03-06 Thread jcupitt
Hi John, On 6 March 2012 09:38, John Emmas wrote: > We're using GTK+ v2.20.0 which was current at that time. The Windows version > has a peculiar problem > > The problem affects any "scrollable / draggable" object but the easiest > example to explain is probably a scroll bar. Let's say I left

Re: Re:GtkScrolledWindow/GtkViewport question

2012-03-07 Thread jcupitt
Hi Michael, Unfortunately I don't think this is easy. You need o do some kind of crazy hack, like realizing but not mapping the dialog, measuring the size you get, guessing the amount of chrome the theme is adding from that, then setting the default window size and finally mapping. I'd love to be

Re: Making a cursor (cross hair) track between image displays

2012-04-04 Thread jcupitt
Hi Jim, On 2 April 2012 17:00, Tilton, James C. (GSFC-6063) wrote: > When I place the cursor in one of the display images, I would like to have a > cross hair appear at the cursor location of the window in which the cursor is > placed at the location currently pointed to by the cursor. I would

Re: Making a cursor (cross hair) track between image displays

2012-04-04 Thread jcupitt
On 4 April 2012 15:37, Tilton, James C. (GSFC-6063) wrote: > Your response is very helpful. The one key question that remains for me is: > > How do I draw a "floating crosshair"? You need to do it by hand, unfortunately, though it's not so hard (I think). The trick (in my opinion) is to have a c

Re: problems understanding gtk3/gdk/cairo interaction

2012-04-06 Thread jcupitt
Hi Roger, You should do all drawing in the expose handler and nowhere else. Don't do any direct drawing in your data hander, instead update your model and queue an expose event. On 7 April 2012 02:16, Roger Davis wrote: > presumably this includes the GtkDrawingArea widget as well. If there is >

Re: Getting the "busy" cursor to display.

2012-04-10 Thread jcupitt
On 10 April 2012 16:58, James Tappin wrote: >      call gdk_display_sync(gdk_display_get_default()) >      call gdk_window_set_cursor(draw_window, busy_cursor) >      call gdk_display_sync(gdk_display_get_default()) My gtk2 program does this with: gdk_window_set_cursor( w

Re: Getting the "busy" cursor to display.

2012-04-11 Thread jcupitt
On 10 April 2012 18:33, James Tappin wrote: > Thanks for the suggestion. Unfortunately in this case it doesn't help. (I > have also tried gdk_display_flush and gdk_window_flush, but still the same > story). Here's a tiny test program that works for me with gtk2. It just uses: gdk_window_set_cu

Re: Help with a multi-threaded application. Spot a crash.

2012-05-31 Thread jcupitt
On 31 May 2012 07:11, Osmo Antero wrote: > The actual code has also a LockedCounter (mutex controlled) object > that feeds each thread with a unique sequence number. Only the thread > with highest sequence number can tick and change the GUI, others will > simply die away. I expect you know, but t

Re: Help with a multi-threaded application. Spot a crash.

2012-06-01 Thread jcupitt
Hi again Osmo, On 31 May 2012 17:50, Osmo Antero wrote: > Jcupitt: > Ok, g_idle_add() seems to need protection by gdk_threads_enter() and > leave(). > Ref: > http://developer.gnome.org/gdk/stable/gdk-Threads.html#gdk-threads-add-idle That's out of date. g_idle_add() does not

Re: Help with a multi-threaded application. Spot a crash.

2012-06-01 Thread jcupitt
On 1 June 2012 20:41, Chris Vine wrote: > jcup...@gmail.com wrote: >> That's out of date. g_idle_add() does not need any locking by you. > > I think you may be confusing this with the fact that with glib >= 2.32 > it is no longer necessary to call g_thread_init() to make glib thread > safe, which

Re: Porting Between Linux and Windows

2012-06-23 Thread jcupitt
On 16 June 2012 01:33, Eric Tavenner wrote: > I am trying to teach myself C++.  My goal is to be able to write code for > the same app in either Linux or Windows, and compile for both from the same > code.  Is this possible? Yes, I have a largish C/C++ program which I can build for Windows and Li

Re: Threads and idle functions

2012-07-02 Thread jcupitt
Hi Igor, On Tuesday, 3 July 2012, Igor Chetverovod wrote > > Hi David, > probably you should use macros: > gdk_threads_enter () > gdk_threads_leave (). Those macros were used to lock the main gdk thread in earlier versions of gtk if you wanted to call gtk_ functions from many threads. They are n

Re: GTK 2.24.10 memory leak on win32?

2012-07-03 Thread jcupitt
On 2 July 2012 15:44, Gabriele Greco wrote: > I'm posting the code here before creating a bugzilla entry for it since I'm > not sure I can use g_idle_add to notify a new frame is available without > freeing the source, that works in linux and in older WIN32 versions and it > seems correct since g_

Re: Another thread/idle/timeout question

2012-07-05 Thread jcupitt
you mean something more complicated and I've misunderstood :( I use semaphores for hairier thread synchronisation problems. http://en.wikipedia.org/wiki/Semaphore_%28programming%29 I have a set of simple semaphore functions over the g_thread primitives: https://github.com/jcupitt/libvips/blob/maste

Re: yet another thread question

2012-07-06 Thread jcupitt
Hi again David, On Friday, 6 July 2012, David Buchan wrote: > > When the user presses a button, an idle function is begun to watch a flag > which will tell it a message has been left in a string for it by a worker > thread. The worker thread is then started. It will produce results to be > disp

Re: yet another thread question

2012-07-06 Thread jcupitt
On 6 July 2012 14:49, David Buchan wrote: > If I understand the first solution correctly, we're creating a separate idle > function for each message. If the worker thread gets a bit ahead of the GUI > updates, then a few idle functions might pile up. ok. But one thing I don't > understand is that

Re: auto refresh file in textview

2012-08-24 Thread jcupitt
Hi Rudra, On 23 August 2012 13:45, Rudra Banerjee wrote: > whenever I am writing, it is saved, but to see the change, I have to > reopen the file(obviously). What do you need to know? Do you want your textview to update as the file changes? If your program is appending to the file as well as di

Re: auto refresh file in textview

2012-08-24 Thread jcupitt
On 24 August 2012 14:41, Rudra Banerjee wrote: > I am sorry but I really don't know how to write on a buffer. I append to a textview like this: void log_text( Log *log, const char *buf ) { GtkTextView *text_view = GTK_TEXT_VIEW( log->view ); GtkTextBuffer *text_buffer = gtk_text_

Re: parsing bibtex with GKeyFile parser

2012-09-06 Thread jcupitt
On 6 September 2012 13:01, Rudra Banerjee wrote: > I am thinking of possibility of parsing a bibtex file with gkeyfile > parser. bibtex has the structure like: > @Book{a, > Author="b and q and r, s ", > Editor="c", > Title="d", > } GKeyFile syntax is not much like that. Yo

Re: Gtk_Tree_View, drawing speed

2012-09-26 Thread jcupitt
On 26 September 2012 07:09, Arne Pagel wrote: > Do you see any other option? Have you tried setting the fixed-height hint on the treeview? By default treeview supports variable-height rows. This is great, of course, but there is a performance penalty: whenever the model changes, the view has to

Re: Best way to busy-wait in Python 3 / Gtk+ 3?

2012-10-07 Thread jcupitt
On 6 October 2012 15:48, Filip Lamparski wrote: > However, the thumbnail loading process takes a long time, so I want to put > it into another process, with the GUI displaying a spinner or a progress > bar until the loading finishes. Sorry, I don't use Python much, but in C you'd start a thread t

Re: Best way to busy-wait in Python 3 / Gtk+ 3?

2012-10-07 Thread jcupitt
Sorry I missed the process bit. To have the load in another process, use a pipe to send worker results back to the main process, and add the pipe to your gtk main loop as an event source. You obviously can't use any gtk/glib stuff in your worker, you'd need to just make a .jpg, then do all the wi

Re: GUI freezes waiting for callback function to return

2012-12-13 Thread jcupitt
On 13 December 2012 11:21, Mateusz Marzantowicz wrote: > I'm writing very simple application in Python using pygobject. I'm using > > What I've observed is that GUI (menu to be specific) freezes till my > callback function finishes. It's completely unacceptable for GUI This is because callbacks a

Re: Stock Id's and Icons on buttons

2012-12-17 Thread jcupitt
On 15 December 2012 23:47, Perdie Perduta wrote: > Can any one help me understand how to add my own stock id's or icons > to these menu buttons, preferably in Glade rather than having to code > it in the software. I have some C here that adds new stock items: https://github.co

Re: GTK app development for windows.

2013-01-30 Thread jcupitt
-mingw-w64. If you have many other dependencies, jhbuild is very convenient. I have a repro here which builds a setup.exe installer for a large application, including a lot of deps. https://github.com/jcupitt/build-win32/tree/master/7.30 John ___ g

Re: window-popup = menu

2013-03-13 Thread jcupitt
Hi Mariano, Just call gtk_menu_popup() and it'll position the menu away from the screen edges for you. https://developer.gnome.org/gtk3/stable/GtkMenu.html#gtk-menu-popup John On 13 March 2013 04:05, Mariano Gaudix wrote: > Hello how i can determine the size of a window-popup hidden ? ¿

Re: window-popup = menu

2013-03-13 Thread jcupitt
Hi again, You can connect to the "map" event. This happens after the window has been realized and just before the window appears on the screen, so the size has been calculated. https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-map In ::map, change window x/y to move it away from t

Re: Wake screen saver

2013-03-18 Thread jcupitt
Hi Paul, On 18 March 2013 21:22, Paul Stelzig wrote: > Is there a way make the screen saver wake up without a key press or mouse > movement? My program is written in C with GTK+ 3.0 I'm running on Linux Mint > 13 with the mate desktop. The program is monitoring a inputs from a DIO > card, an

Re: Widget alignment

2013-05-22 Thread jcupitt
Hi Kip, On 22 May 2013 01:17, Kip Warner wrote: > How can I have this image widget added to the parent such that it is > always vertically aligned with the top of the page, but keeping the > other child box below it still vertically centred? I've tried wrestling > with Glade, but I can't figure o

Re: Widget alignment

2013-05-23 Thread jcupitt
On 23 May 2013 01:18, Kip Warner wrote: > I think your scrolled window is being allocated the width of the page, and then the image is falling to the left within that. Try without the srcolled window. Could you post a complete example? J

Re: GtkBox vs GtkGrid

2013-06-03 Thread jcupitt
Hi Tom, On 2 June 2013 13:12, Thomas A. Moulton wrote: > Am I missing something? > > If I use GtkBox it seems that once I add a child I can't get access to it's > address any more (GtkWidget *) > > So if I create a box with some things in it in glade I really can't do much > with them. > (Other t

Re: GUI freeze and long blocking operation

2013-06-12 Thread jcupitt
e enable progress feedback while long_job(): do a bit of work self.progress.update(percent) hide progress feedback mark gui active again Code here, if it's any help: https://github.com/jcupitt/rtiacquire John ___ gtk-app-devel-li

Re: GUI freeze and long blocking operation

2013-06-13 Thread jcupitt
Hi Kip, On 13 June 2013 06:40, Kip Warner wrote: > If I start the long job function from within my assistant's "prepare" > signal callback, as opposed to en-queueing it there via idle_add(), then > the GUI doesn't refresh throughout the duration of the long job. This > happens even though I do pu

Re: GUI freeze and long blocking operation

2013-06-14 Thread jcupitt
On 14 June 2013 07:29, Kip Warner wrote: > Hey Tristan. I see what you mean, but I think I should have provided > more code to show that what I was actually doing I think was what your > followup suggestion was. Namely do some short work, update the GUI, do > some more short work, repeat. > >

Re: GUI freeze and long blocking operation

2013-06-15 Thread jcupitt
I did a music player that pulses a set of lightbulbs in time: https://github.com/jcupitt/huebert/blob/master/huebert/controller.py Every method starts with: logging.debug('methodname: parameters') And I debug by running with logging enabled and dumping the output to a file:

Re: Valgrind is grinding my gears

2013-11-05 Thread jcupitt
I have a valgrind file here I use for my large gtk2 program: http://www.vips.ecs.soton.ac.uk/development/nip2a.supp I get clean runs with this file. Run with something like: export G_DEBUG=gc-friendly export G_SLICE=always-malloc valgrind --suppressions=/home/john/nip2.su

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread jcupitt
Here's a tiny, complete program that does almost what you want. It's gtk2, but should work fine with gtk3. It just updates a status bar, but it'd be easy to make it do a textview instead. John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome

Re: Still confused on new thread starting idle functions to update UI.

2013-12-04 Thread jcupitt
Oh dear, I think my attachment got munched (thanks Chris). Try here: http://pastebin.com/PsG2UDkY On 4 December 2013 13:31, wrote: > Here's a tiny, complete program that does almost what you want. It's > gtk2, but should work fine with gtk3. > > It just updates a status bar, but it'd be easy

Re: Drawing bit mapped image in drawing area

2014-03-27 Thread jcupitt
isplays a live video image with an overlay. It's in Python for gtk2, but gtk3 is (almost) the same, except for the drawing model for the overlay. It runs at about 50fps with not too much CPU load on my laptop. https://github.com/jcupitt/rtiacquire/blob/master/rtiacquire/preview.py The overlay

g_spawn*() on windows

2014-07-03 Thread jcupitt
Hi all, I'm using g_spawn_command_line_sync() to run a series of command-line programs (actually ImageMagick's convert, if that's important). It works fine, but on Windows I get an incredibly annoying console window flash up for a fraction of a second for each command. Does anyone have any good i

Re: g_spawn*() on windows

2014-07-03 Thread jcupitt
Hi Vivien, Yes, I'm doing that. It all works and I can capture stdout and stderr from the convert.exe I'm running, it's just that I get a very annoying command window flash on the screen each time. If anyone has any ideas about the command window, I'm all ears :-( John On 3 July 2014 14:26,

Re: g_spawn*() on windows

2014-07-03 Thread jcupitt
On 3 July 2014 15:26, Allin Cottrell wrote: > On Thu, 3 Jul 2014, Michael Cronenworth wrote: >> On 07/03/2014 08:33 AM, jcup...@gmail.com wrote: >>> Yes, I'm doing that. It all works and I can capture stdout and stderr >>> from the convert.exe I'm running, it's just that I get a very annoying >>>

Re: Plotting library for GTK+

2014-12-02 Thread jcupitt
On 2 December 2014 at 16:17, Sergei Naumov wrote: > I think this question was asked many times but googling gives a rather patchy > answer to it. So, I am writing a piece of C code that acquires some data from > hardware controllers and it also has to plot a few simple graphs and > histograms > o

Re: Plotting library for GTK+

2014-12-08 Thread jcupitt
On 8 December 2014 at 15:27, Johannes Deutsch wrote: >> I use goffice for this kind of thing. It's the plot library from >> gnumeric, so any plot you can make in gnumeric, you can make with >> goffice. > > Do you know if it's safe to consider goffice for applications based > on gtk3 that should ru

Re: Documenting properties and signals with gtk-doc

2014-12-20 Thread jcupitt
I believe (I think) signals and properties are found at build time by starting up your library and walking the classes you define. You need to add a bit more machinery to your Makefile.am to help it run g-ir-scanner for you. There's a page on the wiki about this: https://wiki.gnome.org/action/sho

Re: Documenting properties and signals with gtk-doc

2014-12-20 Thread jcupitt
Oh dear, I'm sorry, I've been fiddling with gobject-introspection too much recently. Of course you don't need introspection to generate gtk-doc output. I don't know why your signal documentation is not being generated. On 20 December 2014 at 13:10, wrote: > I believe (I think) signals and pr

Re: disabling mouse scroll on GtkComboBox and spin buttons

2016-05-22 Thread jcupitt
On 22 May 2016 at 07:36, Lokesh Chakka wrote: > Is there a way to disable mouse scroll on GtkComboBox and GtkSpinButton > widgets ? Yes, the mouse wheel to change the combo drives me CRAZY. It means you can't use the mouse wheel to scroll a window that contains widgets, since you might scroll a

Re: disabling mouse scroll on GtkComboBox and spin buttons

2016-05-22 Thread jcupitt
On 22 May 2016 at 10:57, Florian Pelz wrote: > On 05/22/2016 11:54 AM, jcup...@gmail.com wrote: >> x = gtk_combo_box_new_text(); >> g_signal_connect(x, "scroll-event", G_CALLBACK(true_cb), NULL); >> ... > > Ah yes, this is a much better way. I'm not sure it'd work for spin buttons though :-( Som

Re: How to confirm a memory leak

2016-07-30 Thread jcupitt
You need to set the malloc routines to use the real system malloc; export G_DEBUG=gc-friendly export G_SLICE=always-malloc I have this suppressions file: https://github.com/jcupitt/libvips/blob/master/libvips.supp That's for a gobject-based library, you might ne

Re: Migrate to gtk3.0

2017-03-10 Thread jcupitt
On 10 March 2017 at 15:48, Rúben Rodrigues wrote: > Yes, i'm using GtkPlot! SO, I think I'm unable to migrate this to gtk3 > because of graphs. SOmeone who knows something about this charts? > http://madebyryan.blogspot.pt/2011/08/smooth-curves-for-gtk-chart-component.html I switched from GtkPlot

Re: Cross platform development

2017-03-19 Thread jcupitt
ect buildable via cmake or autotools, it should be simple to adapt. https://github.com/jcupitt/build-win64 John ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: recommendations for new laptop as existing one could crash.

2017-06-05 Thread jcupitt
I've been happy with my xps-13, fwiw. https://arstechnica.co.uk/gadgets/2017/01/dell-xps-13-ubuntu-review-2017/ It's £1200 for the one with Ubuntu pre-installed. Fedora works well too, apparently. John ___ gtk-app-devel-list mailing list gtk-app-devel-

Re: strange segfault in threading

2007-03-14 Thread jcupitt
You don't need to poll: in your non-GUI thread you can call g_idle_add, and the callback will be executed by the main GUI thread 'soon'. Eg.: worker_fn() { for(;;) { void *stuff = g_malloc( ); calculate_stuff( stuff ); g_idle_add( update_with_stuff, stuff ); }

Re: Thread-save posting of events

2007-03-28 Thread jcupitt
On 3/28/07, Tobias Rapp <[EMAIL PROTECTED]> wrote: > that. But what is not clear to me is how to place an event in the event > loop of another thread. If I raise an signal the connected slots will be The usual recommendation is to keep all GTK stuff (including the main loop) in one thread. You ca

Re: Thread-save posting of events

2007-03-29 Thread jcupitt
On 3/29/07, Tobias Rapp <[EMAIL PROTECTED]> wrote: > Rick Jones wrote: > > I've only come across it while looking for other things, but perhaps the > > GAsyncQueues stuff would be useful for thread-to-thread comms? > > > > http://developer.gnome.org/doc/API/2.0/glib/glib-Asynchronous-Queues.html >

Re: Redrawing drawing area from main loop timer

2007-04-12 Thread jcupitt
Hi Jerome, On 4/12/07, Jerome Blondel <[EMAIL PROTECTED]> wrote: > I'm trying to redraw periodically a drawing area from the main loop > using g_timer_add. In the GSourceFunc i tried to emit a signal to > my drawing area : You need to use gtk_widget_queue_draw_area(): http://developer.gnome.org/

Re: Alternative GTK widgets

2007-05-14 Thread jcupitt
On 5/12/07, Shoq <[EMAIL PROTECTED]> wrote: > Pardon my noobness, but I am new to GTK. I had assumed there would be a > wealth of open source widgets that descend from the toolkit. I am starting > to think this was a very poor assumption on my part. I've not be able to > find anything but a few a

Re: Run Loop Memory Management

2007-05-30 Thread jcupitt
On 5/30/07, Brian J. Tarricone <[EMAIL PROTECTED]> wrote: > Using an idle > function will chew through CPU cycles while the application is > otherwise idle (really hurts laptop battery performance, for one > thing). Another option is a timeout using g_timeout_add(), but the > correct approach woul

Re: g_idle_add and thread safety

2007-06-06 Thread jcupitt
On 6/4/07, Gabriele Greco <[EMAIL PROTECTED]> wrote: > The question I have and which I didn't find answers both googling, both > looking at the sources is if g_idle_add can be called without any extra > mutex/lock from another thread. Yes, this works fine. You do need to init the threads system, b

Re: drawing area in a scrolled window

2007-06-10 Thread jcupitt
On 6/10/07, Christopher Garrett <[EMAIL PROTECTED]> wrote: > However, I have only been able to get mouse coordinates from the drawing area. > I would like to get coordinates from the origin in the top left of the > scrolled > window. What do I need to do? I tried getting coords from the alignmen

Re: Is GObject threadsafe?!

2007-07-04 Thread jcupitt
On 7/4/07, Tomasz Jankowski <[EMAIL PROTECTED]> wrote: > thread safe. It's very important to me, to know if I can safety use > g_object_set and g_object_get from many threads without providing my own > thread protection. I found something on web but it wasn't clear for me. If thread A and thread B

Re: type-punning warnings with optimizations turned on?

2007-07-06 Thread jcupitt
On 7/5/07, Alan M. Evans <[EMAIL PROTECTED]> wrote: > But with optimizations on (actually, at or above -O2), I get warnings > about type-punning on the calls to g_static_mutex_lock/unlock: > > g++ -O2 -Wall -c `pkg-config --cflags glib-2.0` test.cpp > test.cpp: In function 'void MyM

Re: type-punning warnings with optimizations turned on?

2007-07-06 Thread jcupitt
On 7/6/07, Ernie Wright <[EMAIL PROTECTED]> wrote: > > (now someone will tell me the compiler is correct and casting "int > > *x[]" to "void **" is indeed wrong :-) > > This is question 4.9 in the C FAQ: > > http://c-faq.com/ptrs/genericpp.html That's very interesting, thank you. Does that mea

Re: type-punning warnings with optimizations turned on?

2007-07-06 Thread jcupitt
On 7/6/07, Alan M. Evans <[EMAIL PROTECTED]> wrote: > That's interesting. Unfortunately for me, I don't have a lot of casting > options. Really, in this case: I meant that whatever it is that g_static_mutex_*() is doing, it might be doing a cast like this internally. Therefore you may have found a

Re: type-punning warnings with optimizations turned on?

2007-07-09 Thread jcupitt
On 7/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 7/6/07, Alan M. Evans <[EMAIL PROTECTED]> wrote: > > That's interesting. Unfortunately for me, I don't have a lot of casting > > options. Really, in this case: > > I meant that whatever it is that g_static_mutex_*() is doing, it might > b

Re: .desktop files and Makefile.am

2007-07-27 Thread jcupitt
On 7/27/07, Dani <[EMAIL PROTECTED]> wrote: > I'm changing the main Makefile.am and putting the .desktop in the main > project folder.. but without success :( I have something like: install-exec-hook: $(mkinstalldirs) ${DESTDIR}$(datadir)/applications -cp poop.desktop ${DESTDIR}$(

Re: Display grayscale image

2007-08-31 Thread jcupitt
On 8/31/07, Jim George <[EMAIL PROTECTED]> wrote: > On 8/30/07, Marco Brambilla <[EMAIL PROTECTED]> wrote: > > Is there a easy way of displaying such an image "as is" (single channel) ? > > Or must I convert it each pixel to > > the a RGB triplet needed by gtk_pixbuf_new_from_data ? > > You could

Re: GtkScale GtkHScale with multiple sliders and values?

2007-09-05 Thread jcupitt
On 9/5/07, v4r4n <[EMAIL PROTECTED]> wrote: > I've been trying to figure out how to create a GtkHScale that would let the > user determine the beginning, middle, and/or end of a single data set. > > Ideally the sliders could effect each other, but the overall size of the > scale wouldn't need to ch

Re: Scrolledwindow, layout and drawing area

2007-09-07 Thread jcupitt
Hi Federico, On 9/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > other widgets (like side panes, menu bar etc.); I need zooming and > panning features, so I went for a scrolled window => layout => > drawingarea. Why do you need the layout? You can just put a drawingarea inside a scrolledwin

Re: 16 bits grayscale images

2007-09-28 Thread jcupitt
On 9/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I don't think is trivial. Does anyone have a link to any good example > source code for making false color images. In the pat I have just Here's what I'm using at the moment: http://vips.svn.sourceforge.net/viewvc/vips/vips7/trunk/libsrc/

Re: Fast ways to draw brush outlines on a DrawingArea

2007-09-30 Thread jcupitt
On 9/30/07, Keith Feesh <[EMAIL PROTECTED]> wrote: > The way that I do things now includes redrawing the entire canvas every time > the mouse is moved, in order to clear the old > outline's drawing, and then to redraw the outline once again. This brings my > system to it's knees and I figure there

Re: Fast ways to draw brush outlines on a DrawingArea

2007-10-01 Thread jcupitt
On 9/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 9/30/07, Keith Feesh <[EMAIL PROTECTED]> wrote: > > The way that I do things now includes redrawing the entire canvas every time > > the mouse is moved, in order to clear the old > > outline's drawing, and then to redraw the outline once

Re: window resize and hpanned separator position control

2007-10-29 Thread jcupitt
On 10/29/07, Alex Nekorkin <[EMAIL PROTECTED]> wrote: > Could anyone tell me, how to make hpanned separator to be positioned in a > special way depending on the new window size? I've not tried, but I imagine you just need to add a "configure_event" handler to see the new window width and height, a

Re: non-themed widget styles?

2007-10-31 Thread jcupitt
On 10/31/07, Chris Rorvick <[EMAIL PROTECTED]> wrote: > I have a GTK application that modifies the foreground and background of > many different buttons rapidly. These buttons should not be themed, so > it seems that the gtk_widget_modify_*() functions incur an unnecessary > overhead. Is there a

Re: non-themed widget styles?

2007-10-31 Thread jcupitt
Hi again, On 10/31/07, Chris Rorvick <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On 10/31/07, Chris Rorvick <[EMAIL PROTECTED]> wrote: > >> I have a GTK application that modifies the foreground and background of > >> many different buttons rapidly. These buttons should not be themed

Re: non-themed widget styles?

2007-10-31 Thread jcupitt
On 10/31/07, Chris Rorvick <[EMAIL PROTECTED]> wrote: > configuration-based styles) work nicely. What I want to do is tell a > widget to be blue with minimal overhead. A style is still handy in I'm being so dumb here. So why doesn't gtk_widget_set_name() work for this problem? I still don't unde

Re: Telling a widget not to be in the focus chain

2007-10-31 Thread jcupitt
On 10/31/07, Steffen Gutmann <[EMAIL PROTECTED]> wrote: > So, anybody has an idea what the correct way of leaving a widget out of > the focus chain is? I use gtk_container_set_focus_chain() to set an exact list of widgets for a section of the focus chain. GList *focus_chain; focus_chain = NU

Re: Need 2D data display widget

2007-11-23 Thread jcupitt
On Nov 23, 2007 12:54 PM, Dan H <[EMAIL PROTECTED]> wrote: > I've found the GtkPlot stuff from GtkExtra. The possibilities seem to be > awesome and go way beyond my needs; however, I couldn't find any systematic > API documentation. I've tried dissecting the example programs, but they are > over

Re: write a media player using gtk+

2007-11-30 Thread jcupitt
On Nov 30, 2007 2:45 AM, Bin Chen <[EMAIL PROTECTED]> wrote: > image, but I am not familiar with XLib, so I want to know if it is > possible to use pure GTK+ API to achieve this? What about the > performance comparing to use XLib directly? You can use gdk_draw_rgb_image() to paint an RGB array to

Re: write a media player using gtk+

2007-12-02 Thread jcupitt
On Dec 2, 2007 3:51 AM, Binary Chen <[EMAIL PROTECTED]> wrote: > Do you know how you get the video memory address of the gdk drawable? I > want to use memcpy to do the copying, because the gdk-draw-rgb-image > can't be accessed during two different threads. X doesn't let you do this, because it ha

  1   2   >