GTK threads and socket operations

2014-11-26 Thread Sergei Naumov
Hi! I am writing an application that periodically reads data from network sockets (from Modbus enabled devices actually) and displays them in GTK+ application. I read some tutorials about GTK threads and created a separate thread that encompasses Modbus reads and updates to GTK labels:

Re: GTK threads and socket operations

2014-11-26 Thread Bernhard Schuster
You modify your label from a thread that is not the main/ui thread. Gtk+ is not threadsafe (few exceptions). Use g_idle_add/ g_timeout_add/ and friends (those are threadsafe) to implicitly serialize your ui modifications into the gtk mainloop. Do not use GDK_THREADS_ENTER/LEAVE foo unless you are

RE: Re: GTK threads and socket operations

2014-11-26 Thread Sergei Naumov
Is there any tutorial on them? I searched the Web and did not find any good tutorial on GTK threads. -- Sergei O. Naumov 26.11.2014, 12:41:16 пользователь Bernhard Schuster (schuster.bernh...@gmail.com) написал: You modify your label from a thread that is not the main/ui thread. Gtk+ is

Re: Re: GTK threads and socket operations

2014-11-26 Thread Emmanuele Bassi
hi; On 26 November 2014 at 10:27, Sergei Naumov vo...@rambler.ru wrote: Is there any tutorial on them? I searched the Web and did not find any good tutorial on GTK threads. the only tutorial needed is probably something like: Q: Can I use GTK API from different threads? A: No. if you

Re: GTK threads and socket operations

2014-11-26 Thread Mathieu Comandon
Hi! Speaking of threading in Gtk, I'm using it quite extensively in my application and never was really sure I was doing the right thing. Here are the part in my codebase where I handle background jobs and downloads: https://github.com/lutris/lutris/blob/master/lutris/util/jobs.py

Re: GdkGLContext for Mac OS X Quartz backend patches

2014-11-26 Thread Emmanuel Briot
The cairo patch is provisional and may need further work; basic problem is that a quartz surface created for a window takes its device scale into account on the Quartz (CGContext) side but the cairo side doesn't know about it and treats it like a 1x-scaled surface. This was leading many

Removing global variables

2014-11-26 Thread Alexandre Bique
Hi, I wonder if it would be possible to remove gtk's global variables? I'd like to do something like: GtkCtx *gtk_ctx = gtk_init(..); GtkWindow *window = gtk_window_new(gtk_ctx, ...); ... gtk_main_loop(gtk_ctx); So in this way it would be possible to run many gtk main loop in different threads

Re: Removing global variables

2014-11-26 Thread Paul Davis
On Wed, Nov 26, 2014 at 3:16 PM, Alexandre Bique bique.alexan...@gmail.com wrote: Hi, I wonder if it would be possible to remove gtk's global variables? I'd like to do something like: GtkCtx *gtk_ctx = gtk_init(..); GtkWindow *window = gtk_window_new(gtk_ctx, ...); ...

Re: Removing global variables

2014-11-26 Thread Paul Davis
On Wed, Nov 26, 2014 at 3:16 PM, Alexandre Bique bique.alexan...@gmail.com wrote: I need that for implement plugin's UI, like VST plugins. GTK (and all other desktop, non-statically linkable toolkits) are a particularly poor engineering choice for these types of plugins.

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 2:35 PM, Paul Davis p...@linuxaudiosystems.com wrote: You can run any number of event loops in a process. You can only run 1 GTK main loop. So can I run one event loop in a thread, do my UI without having a gtk_main_loop? On Wed, Nov 26, 2014 at 2:35 PM, Paul Davis

Re: Removing global variables

2014-11-26 Thread Bernhard Schuster
VST like plugins - elaborate please. I am sure one can handle pretty much anything using g_main_context fun, but please provide more information on what you want to achieve exactly. Best Bernhard On Nov 26, 2014 2:42 PM, Alexandre Bique bique.alexan...@gmail.com wrote: On Wed, Nov 26, 2014 at

Re: Removing global variables

2014-11-26 Thread Paul Davis
On Wed, Nov 26, 2014 at 3:42 PM, Alexandre Bique bique.alexan...@gmail.com wrote: On Wed, Nov 26, 2014 at 2:35 PM, Paul Davis p...@linuxaudiosystems.com wrote: You can run any number of event loops in a process. You can only run 1 GTK main loop. So can I run one event loop in a thread, do

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 2:46 PM, Bernhard Schuster schuster.bernh...@gmail.com wrote: VST like plugins - elaborate please. I am sure one can handle pretty much anything using g_main_context fun, but please provide more information on what you want to achieve exactly. A VST plugin is a virtual

Re: Removing global variables

2014-11-26 Thread Emmanuele Bassi
hi; On 26 November 2014 at 13:52, Paul Davis p...@linuxaudiosystems.com wrote: You can run any number of event loops in a process. You can only run 1 GTK main loop. So can I run one event loop in a thread, do my UI without having a gtk_main_loop? first of all, if the host is written

Re: Removing global variables

2014-11-26 Thread Paul Davis
On Wed, Nov 26, 2014 at 3:52 PM, Alexandre Bique bique.alexan...@gmail.com wrote: So the plugin has to initialize its UI toolkit and render it. But as all the plugins are loaded in the same process, for performances reason, it is unsafe to run gtk_main_loop() in each of them. this is all

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 2:58 PM, Paul Davis p...@linuxaudiosystems.com wrote: this is all part of the many reasons why these toolkits are problematic. Qt has similar issues. The correct answer would depend on the host, which is obviously not a desirable condition to have to understand. So I

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 2:58 PM, Paul Davis p...@linuxaudiosystems.com wrote: this is all part of the many reasons why these toolkits are problematic. Qt has similar issues. The correct answer would depend on the host, which is obviously not a desirable condition to have to understand. And so

Re: Removing global variables

2014-11-26 Thread Emmanuele Bassi
hi; On 26 November 2014 at 14:05, Alexandre Bique bique.alexan...@gmail.com wrote: On Wed, Nov 26, 2014 at 2:58 PM, Paul Davis p...@linuxaudiosystems.com wrote: this is all part of the many reasons why these toolkits are problematic. Qt has similar issues. The correct answer would depend on

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 3:12 PM, Emmanuele Bassi eba...@gmail.com wrote: if you want to do: Thread 1: gtk_init() → GUI → gtk_main() Thread 2: gtk_init() → GUI → gtk_main() ... Thread N: gtk_init() → GUI → gtk_main() then no: you cannot achieve that with GTK+, and there are no plans

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 3:17 PM, Emmanuele Bassi eba...@gmail.com wrote: you mean apart from the major breakage of API, the massive complication of the internals, and the portability issues? It is about adding a pointer to a context. GtkCtx *gtk_ctx = gtk_ctx_new(); GtkWindow *window =

Re: Removing global variables

2014-11-26 Thread Emmanuele Bassi
hi; On 26 November 2014 at 14:22, Alexandre Bique bique.alexan...@gmail.com wrote: On Wed, Nov 26, 2014 at 3:17 PM, Emmanuele Bassi eba...@gmail.com wrote: you mean apart from the major breakage of API, the massive complication of the internals, and the portability issues? It is about adding

Re: Removing global variables

2014-11-26 Thread Alexandre Bique
On Wed, Nov 26, 2014 at 3:31 PM, Emmanuele Bassi eba...@gmail.com wrote: hi; On 26 November 2014 at 14:22, Alexandre Bique bique.alexan...@gmail.com wrote: On Wed, Nov 26, 2014 at 3:17 PM, Emmanuele Bassi eba...@gmail.com wrote: you mean apart from the major breakage of API, the massive

gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Lance Arsenault
Hello GTK developer, I've read the latest docs, looked at the latest (git) GTK+3 code, and searched the archives, and found not direct answer to this question: 1. Is there a method, that is not deprecated, that can give the effect of gtk_widget_set_double_buffered() for GTK3? There are a

Re: gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Jasper St. Pierre
On Wed, Nov 26, 2014 at 10:40 AM, Lance Arsenault lance.arsena...@gmail.com wrote: Hello GTK developer, I've read the latest docs, looked at the latest (git) GTK+3 code, and searched the archives, and found not direct answer to this question: 1. Is there a method, that is not deprecated,

Re: gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Emmanuele Bassi
hi; On 26 November 2014 at 18:40, Lance Arsenault lance.arsena...@gmail.com wrote: Hello GTK developer, I've read the latest docs, looked at the latest (git) GTK+3 code, and searched the archives, and found not direct answer to this question: 1. Is there a method, that is not deprecated,

Re: gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Lance Arsenault
Hi Emmanuele, apps using X11 to draw directly should stop doing that, because this is not 1997 any more, and we have better drawing API. Many many apps need a faster drawing API than Cairo in order to do high frame rate animations. Interactive games is the most popular example. I have

Re: gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Jasper St. Pierre
Hey, I just built Quickscope from source, and can't find any code that draws using cairo inside it. Where is it? On Wed, Nov 26, 2014 at 6:08 PM, Lance Arsenault lance.arsena...@gmail.com wrote: Hi Emmanuele, apps using X11 to draw directly should stop doing that, because this is not 1997

Re: gtk_widget_set_double_buffered() is deprecated, so what can replace it?

2014-11-26 Thread Paul Davis
On Thu, Nov 27, 2014 at 4:18 AM, Jasper St. Pierre jstpie...@mecheye.net wrote: Hey, I just built Quickscope from source, and can't find any code that draws using cairo inside it. Where is it? i think that quickplot and quickscope are not the same thing.

Re: introspection

2014-11-26 Thread Daniel Espinosa
I found in your GIR file, it don't detect (for example) confi_new() as a function of Confi object and it is not introspectable. Also, all functions are free no related to any GObject. Then you haven't provided enough information to detect namespace and its GObjects. You should add a prefix, as a

GtkIconView: Change highlight of Icons

2014-11-26 Thread alexsson
Hi all, Im trying to understand how to change the highlights of icons when using for example Thunar (file-browser). http://gtk.10911.n7.nabble.com/file/n85723/screenshot4.png As you can see in my picture above, I highlighted the folder CytoscapeConfiguration, however, I only want to highlight

Application written under GTK 2.20.1 won't start under GTK 2.24.22

2014-11-26 Thread Dmitry Perov
Hello! I've got an application that was written rather long ago using GTK+ 2.20.1 and now I'm trying to launch it on a new system that has GTK+ 2.24.22 installed. The program compiles fine, without any warnings, opens a window and hags forever refusing to draw anything. I use Cairo for drawing.

RE: How to change one specific color in GtkTreeView

2014-11-26 Thread alexsson
Thanks. However, I just added one line in my gtkrc: GtkTreeView::row_ending_details = 1 And that did it! -- View this message in context: http://gtk.10911.n7.nabble.com/How-to-change-one-specific-color-in-GtkTreeView-tp85693p85722.html Sent from the Gtk+ - General mailing list archive at

Problem in using GLib functions with structure

2014-11-26 Thread Satyam Singh
Dear Sir/ Madam, I have been using the Glib to make doubly linked list of structures on eclipse of Ubuntu. I have encountered problem in using *“g_list_find”* and “*g_list_remove” *functions for structure data type. When I used both of the above functions, I first entered the data and stored

Changing GtkScrolledWindow's scrolling behavior doesn't work.

2014-11-26 Thread Lee Fallat
Hey GTK fans, Recently I've been trying to adjust scrolling such that when the scroll wheel is used, the window will scroll the height of a font. I am using this for developing a text editor (not important though). To clarify I'm aiming to have it scroll one line at a time. I have tried using

Bind GtkTreeView row to some object

2014-11-26 Thread John Tall
Hello. I have a GtkTreeView that is used to display some data. Let's say that I have a class that defines a person, and that I have a number of objects representing different persons. I want to display the name of each person in the tree view so I add a row for each person and set the value of

Re: GStreamer and Gtk3

2014-11-26 Thread Wouter Verhelst
On Tue, Nov 25, 2014 at 09:38:59PM +0100, Torsten Schoenfeld wrote: On 23.11.2014 14:30, Wouter Verhelst wrote: Unfortunately, this doesn't work, and I can't figure out what the issue is. The program currently outputs the following: [ unknown state-changed ] Argument [ unknown ]

Re: GStreamer and Gtk3

2014-11-26 Thread Wouter Verhelst
On Wed, Nov 26, 2014 at 10:26:21PM +0100, Wouter Verhelst wrote: Thanks! That got me a little further. Not yet where I want to be (it's using the whole window rather than just the part that I want it to use for video output), but at least I'm seeing the videotestsrc output now. ... and that