Re: how to i get the arrow-buttons moving?

2014-09-03 Thread Gergely Polonkai
Hello Gary,

do I get it right, you want to manupulate/query the labels upon
keypresses? Like when the user presses the Up arrow, fetch the text of
the first label and print it somewhere? In that case, I’d like to know
if you have a GtkApplication with GtkApplicationWindows, or “just” a
simple GtkWindow?

For the former, I would go for actions and accels (see
gtk_application_set_accels_for_action() and friends), while the former
may require catching the ::key-press-event signal.

Best,
Gergely

On 4 September 2014 00:24, Gary Kline kl...@thought.org wrote:
 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 On Wed, Sep 03, 2014 at 10:44:55PM +0200, Marcus Karlsson wrote:
 On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote:
  thanks for your input, marcus, but could you give me a few lines of
  code?  I tried using the gtk_label_set_text() for over an hour
  last night until it felt like my shoulder was going to drop off and
  fall on the floor!

 You should be able to set the text with something like:

 gtk_label_set_text (GTK_LABEL (label), some text);

 But this requires that you have a valid pointer to your label, eiter in
 a global variable or passed to the signal handler as the user_data
 pointer.

  other than usinng g_signal_connect() to bail out with a Quit,
  the only times I see anything to do with a signal are after going
  GTK_ARROW_UP or _DOWN  I may have misplaced the
  gtk_label_get_text() stuff.
 
  iv'e got:
 
  gtk_label_get_text(GTK_LABEL(user_data), buf );
 
  which now looks aways off...  need more clues.

 Gtk_label_get_text () returns the string in the return value, so you
 need to to something like:

 str = gtk_label_get_text (GTK_LABEL (user_data));

 This of course also requires that the user_data pointer is pointing at a
 label. In your code sample you passed 0 and 1 as the pointers, which
 most likely will not be valid pointers to your labels.

 It's often a good idea to group the elements that you need to access
 into an object and pass it as the user_data pointer. A struct would be
 sufficient. This could also include a field which says which label is
 currently selected, for example using and int in the range of 1 to 3.

 If you want to reuse the signal handler and still distinguish which
 button caused the signal then you can use the currently unused first
 argument which should point to the sender of the signal, or the button
 which was pressed down.

   Marcus

 well, here's the dope: after my 27th cup of french roast, it's all
 coming together. *Or*, with a few more hacks, most things will fit.

 still, no one has been able to answer my main question: how, using
 the arrow keys, do I attach onto the individual labels?  I print
 3 labels to demonstrate what will appear of the window.  there
 probably will be dozens of strings that will become labels.  I
 need the up/down arrow keys to select One label.  Another part of
 the program will speak that string.

 your code examples  were helpful.  my main snafu was in mixing up
 the GTK_MACROS.  The main step is getting the arrow keys to
 incicatte--probably with a horizontal line--the right label.

 gary


 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
  Twenty-eight years of service to the Unix community.


 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: how to i get the arrow-buttons moving?

2014-09-04 Thread Gergely Polonkai
An accel is a keyboard shortcut. You should take a look at
gtk_window_add_accel_group() and the GtkAccelGroup API.

For speech synthesis, I would use the libespeak API instead - the same
library espeak uses. This way you can omit the file handling part of your
code. This page should contain everything you need, but there are several
examples out there: http://espeak.sourceforge.net/speak_lib.h

Best,
Gergely
On 4 Sep 2014 06:02, Gary Kline kl...@thought.org wrote:

 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 On Thu, Sep 04, 2014 at 12:32:06AM +0200, Gergely Polonkai wrote:
  Hello Gary,
 
  do I get it right, you want to manupulate/query the labels upon
  keypresses? Like when the user presses the Up arrow, fetch the text of
  the first label and print it somewhere?

 *YES*.  in another directory, three or four C files grab hold
 of [[ Say ]] /tmp/files/text.3.txt {or} /tmp/files/text.NN.txt.
 these TXT files contain what the speech-ompaired person has
 typed.  they are voiced by espeak and other speech binaries.

 when I hit the up- or doen-arrow button I want SOmething to
 appear on the window that has the arrow icons.  when the
 user hits Enter or mouse-clicks, that Something voices what
 the users himself cannot.


  In that case, I’d like to know
  if you have a GtkApplication with GtkApplicationWindows, or “just” a
  simple GtkWindow?


 in my arrow.c, in main(), I have a

 GtkWidget *window;

 and after gtk_init() is:


 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 .
 .
 .
 so it is just a simple window.




  For the former, I would go for actions and accels (see
  gtk_application_set_accels_for_action() and friends), while the former
  may require catching the ::key-press-event signal.
 
  Best,
  Gergely


 I'll google around and see what functions do what!  iv'e seen
 the `accels' scroll past while searching for other parts of
 code.  I had 0.0 idea what it was. :)

 thanks much,

 gary



  On 4 September 2014 00:24, Gary Kline kl...@thought.org wrote:
   =
   Organization: Thought Unlimited.  Public service Unix since 1986.
   Of_Interest: With 28 years  of service  to the  Unix  community.
  
   On Wed, Sep 03, 2014 at 10:44:55PM +0200, Marcus Karlsson wrote:
   On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote:
thanks for your input, marcus, but could you give me a few
 lines of
code?  I tried using the gtk_label_set_text() for over an hour
last night until it felt like my shoulder was going to drop off
 and
fall on the floor!
  
   You should be able to set the text with something like:
  
   gtk_label_set_text (GTK_LABEL (label), some text);
  
   But this requires that you have a valid pointer to your label, eiter
 in
   a global variable or passed to the signal handler as the user_data
   pointer.
  
other than usinng g_signal_connect() to bail out with a Quit,
the only times I see anything to do with a signal are after
 going
GTK_ARROW_UP or _DOWN  I may have misplaced the
gtk_label_get_text() stuff.
   
iv'e got:
   
gtk_label_get_text(GTK_LABEL(user_data), buf );
   
which now looks aways off...  need more clues.
  
   Gtk_label_get_text () returns the string in the return value, so you
   need to to something like:
  
   str = gtk_label_get_text (GTK_LABEL (user_data));
  
   This of course also requires that the user_data pointer is pointing
 at a
   label. In your code sample you passed 0 and 1 as the pointers, which
   most likely will not be valid pointers to your labels.
  
   It's often a good idea to group the elements that you need to access
   into an object and pass it as the user_data pointer. A struct would be
   sufficient. This could also include a field which says which label is
   currently selected, for example using and int in the range of 1 to 3.
  
   If you want to reuse the signal handler and still distinguish which
   button caused the signal then you can use the currently unused first
   argument which should point to the sender of the signal, or the button
   which was pressed down.
  
 Marcus
  
   well, here's the dope: after my 27th cup of french roast, it's
 all
   coming together. *Or*, with a few more hacks, most things will
 fit.
  
   still, no one has been able to answer my main question: how,
 using
   the arrow keys, do I attach onto the individual labels?  I
 print
   3 labels to demonstrate what will appear of the window.  there
   probably will be dozens of strings that will become labels.  I
   need the up/down arrow keys to select One label.  Another part
 of
   the program will speak that string

Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gergely Polonkai
On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote:

 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 things that I *thought* might work by using

 s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));

 fails.  (with contains the String label1)  I have a index,
 n that can range from 1 to 99--whatever GtkWidget *label I
 need.  the next thing that occured was some kind of

 typedef struct
 {

 GtkWidget  *label1,
*label2,
*label3,
...
*label999;
 } Labels;

 can abybody clue on how to use my n index counter to stick
 one of the labels so they show up on my arrow window?

 thanks much.

 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
Unix
  Twenty-eight years of service to the Unix community.


This definitely calls for an array:

GtkWidget *label[1000];

as you cannot reference to a variable with a constructed name (like $$a in
PHP). If your struct holds only pointers, though, you can also cast it to
an array:

((GtkWidget **)label_list)[99]

but I haven't tested it, and highly discourage it.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: more of a C question than GTK+3.0??

2014-09-06 Thread Gergely Polonkai
What I would do instead is:

GtkWidget **label[1000]; // if you have a dynamic number of labels,
consider using a GArray maybe
int i = 0;

label[i++] = gtk_label_new(first text); // this will be label[0]
label[i++] = gtk_label_new(second text); // this will be label[1]
…

After this, instead of creating a string label1, you just need the
number 1, and can use this:

s = gtk_label_get_text(GTK_LABEL(label[1]));

where 1 can instead be a variable of int that holds 1:

int num = 1;
s = gtk_label_get_text(GTK_LABEL(label[num]));

On 6 September 2014 09:32, Gary Kline kl...@thought.org wrote:
 =
 Organization: Thought Unlimited.  Public service Unix since 1986.
 Of_Interest: With 28 years  of service  to the  Unix  community.

 On Sat, Sep 06, 2014 at 08:08:34AM +0200, Gergely Polonkai wrote:
 On 6 Sep 2014 03:12, Gary Kline kl...@thought.org wrote:
 
  =
  Organization: Thought Unlimited.  Public service Unix since 1986.
  Of_Interest: With 28 years  of service  to the  Unix  community.
 
  things that I *thought* might work by using
 
  s = gtk_label_get_text(GTK_LABEL((GtkWidget)buf));
 
  fails.  (with contains the String label1)  I have a index,
  n that can range from 1 to 99--whatever GtkWidget *label I
  need.  the next thing that occured was some kind of
 
  typedef struct
  {
 
  GtkWidget  *label1,
 *label2,
 *label3,
 ...
 *label999;
  } Labels;
 
  can abybody clue on how to use my n index counter to stick
  one of the labels so they show up on my arrow window?
 
  thanks much.
 
  --
   Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
 Unix
   Twenty-eight years of service to the Unix community.
 

 This definitely calls for an array:

 GtkWidget *label[1000];

 as you cannot reference to a variable with a constructed name (like $$a in
 PHP). If your struct holds only pointers, though, you can also cast it to
 an array:

 ((GtkWidget **)label_list)[99]

 but I haven't tested it, and highly discourage it.



 I will heed your advise!  a workaround may be in three *.c
 files.  but first:: sleep.

 --
  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
  Twenty-eight years of service to the Unix community.


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: convert gtktable to gtkgrid

2014-09-23 Thread Gergely Polonkai
Hello,

you have to change the GtkTable object class to a GtkGrid (obviously).
Also, (x|y)-options and (x|y)-padding are not present in the GtkGrid,
so you have to remove those packing definitions (child properties).

If you have multiple GtkTables with lots of children, I don’t think
there is an “easy way”, as you have to process each child of a
packing tag within each child tag that has an object child with
its type attribute set to GtkTable.

Best,
Gergely

On 23 September 2014 11:19, Andrea Zagli aza...@libero.it wrote:
 i have many glade files made for gtk2 with gtktable

 in gtk3 gtktable is deprecated in favour of gtkgrid

 is there an easy way to convert gtktable to gtkgrid?

 thanks in advance
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Deprecated function ed icons on button

2014-10-06 Thread Gergely Polonkai
Hello,

yes, stock icons are now deprecated in favour of icon names, preferably
symbolic icons (especally if you are building a GNOME component). Creating
image buttons may seem a  bit harder than before.

As you may have already seen, a GtkButton is subclassed from GtkBin, which
means you can pack another widget into it. It can be a GtkLabel, or even a
GtkEntry (this sounds crazy), or, in your case, a GtkImage.

Create a GtkImage with gtk_image_new_from_icon_name(), then add it to the
button with gtk_container_add(GTK_CONTAINER(button), image).

And now that you hopefully understand the concept, I'd like to introduce
gtk_button_new_from_icon_name() :) For this, you need GTK 3.10, though, but
it's a shorthand for the above.

Personally, I prefer using Glade/GtkBuilder, although Glade doesn't support
some of the newer widgets, and gives you hard times with other stuff.

Best,
Gergely Polonkai
On 6 Oct 2014 17:03, arkkimede arkkim...@gmail.com wrote:

 Hi,
 I'm starting to learn GTK+ and I'm using beginner tutorial found on GTK web
 site.
 (I'm working on linux debian testing amd64 with Xfce)
 The actual version of GTK is 3.x and the tutorial is related to 2.x
 This means that some time there are some deprecated function that have to
 be substituted with the new ones.
 Some time the task is easy like

 gtk_vbox_new(FALSE, 0) == gtk_box_new(GTK_ORIENTATION_VERTICAL, 0)

 some time not so easy.

 One of these case is  gtk_image_menu_item_new_from_stock(GTK_STOK_NEW,NULL)
 The new version is
 gtk_menu_item_new_with_label or
 gtk_menu_item_new_with_mnemonic.

 I made the new version, the compiler do not print any message but the final
 result is that the icon
 disappear.

 Googling I found that this is the new philosophy of GTK and to see the
 icons I have to made some settings in my environment.

 Somewhere I found that I have to put in ~/.config/gtk-3.0/settings.ini
 some like
 [Settings]
 gtk-menu-images=1
 gtk-button-images=1

 Running the GTK program I do not see any icons!

 Could you help me to find a solution, please?

 Thanks in Advance
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Understanding accelerators.

2014-10-07 Thread Gergely Polonkai
Mnemonics are discouraged by the HIG, and AFAIK they are not displayed by
recent GTK versions.

From the user's perspective, I think there is no difference. However, if
you are using GApplication/GtkApplication, it is easier to register accels,
and you can even make them easily customizable for the users. I'm yet to
find a good example on the Interwebs, but if you take a look at GNOME 3.14
apps, you will find some for sure.

Best,
Gergely
On 7 Oct 2014 16:12, Michael Cronenworth m...@cchtml.com wrote:

 On 10/07/2014 04:45 AM, Oscar Lazzarino wrote:

 I'm trying to understand the difference between accelerators and the
 “key-press-event” signal.

 Let's say I have a window with just one button quit. I'd like to handle
 the
 controloq key event to quit the application.

 I now I can connect to the top window key-press-event, but - just to
 understand
 how things work - is there any way to do the same with accelerators? Or
 are
 accelerators exclusively intended to be used with menus?

 I'm totally lost in the documentation bouncing between actions,
 accelerators,
 accerator groups, action groups, ui managers, etc, and I can't find a
 SIMPLE
 example.

 Any help would be greatly appreciated.


 There are menu accelerators and there are mnemonic accelerators. What you
 need to use for a quit button is a mnemonic accelerator. You do not
 attach to any key-press signal. Attach to the button clicked signal. GTK
 provides the functionality to capture the keyboard press and route it to
 the button click.

 You're complicating this a little. It's not that complicated. :)
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Understanding accelerators.

2014-10-07 Thread Gergely Polonkai
This is becoming offtopic, but… this is strange, last time I saw a
discussion about them, they were considered out of date or something and
many was upset that they are gone (even if only at theme level). Sorry
then, it's my mistake.
On 7 Oct 2014 16:31, Michael Cronenworth m...@cchtml.com wrote:

 On 10/07/2014 09:18 AM, Gergely Polonkai wrote:

 Mnemonics are discouraged by the HIG, and AFAIK they are not displayed by
 recent
 GTK versions.

  From the user's perspective, I think there is no difference. However, if
 you
 are using GApplication/GtkApplication, it is easier to register accels,
 and you
 can even make them easily customizable for the users. I'm yet to find a
 good
 example on the Interwebs, but if you take a look at GNOME 3.14 apps, you
 will
 find some for sure.


 It's quite humorous that no one responds to most queries on this list, but
 as soon as I do there are a handful of replies to point out how I'm wrong.

 Mnemonics are not displayed by default, yes, as that's a stylistic
 preference of the theme you use and not a GTK default. Discouraged? This is
 news to me. I just ran through a handful of GNOME apps and they all use
 mnemonics. In fact... the GNOME HIG page *encourages* to make shortcut
 keys as mnemonic as possible[1].

 Menu and mnemonic accelerators do have differences. The former can be
 assigned to any key combination. The later only apply to the ALT key.

 [1] https://developer.gnome.org/hig/stable/keyboard-input.html.en

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkHeaderBar minimu width

2014-10-11 Thread Gergely Polonkai
On 11 Oct 2014 18:46, Damien Sandras dsand...@seconix.com wrote:

 Hi everyone,


 I have started porting Ekiga to use new GTK+3 widgets.

That's great news, I like both very much :-)


 I am using a GtkHeaderBar in the main window. The main window mainly
 displays a roster.

 The problem is that as soon as I use a GtkHeaderBar, the window seems to
 have a minimum width and can not resized below that minimum width.

 That minimum width is a bit to wide, at least for a roster.

 Is there a possibility to fix this?

Checking on with th header bar sources, it has its own
get_preferred_width() method, which calculates the preferred width based on
the children of the header bar. My first thought is to subclass
GtkHeaderBar, chain up to get the width calculated by calling its original
get_preferred_width(), then adjust it if needed.


 Thanks,
 --
 Damien SANDRAS

 Ekiga Project
 http://www.ekiga.org


 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Best,
Gergely Polonkai
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Plotting library for GTK+

2014-12-02 Thread Gergely Polonkai
Isn't plplot an option for you? TL;DR, but it seems it can serve that
purpose you need it for.
On 2 Dec 2014 18:10, jcup...@gmail.com wrote:

 On 2 December 2014 at 16:17, Sergei Naumov vo...@rambler.ru 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
  out of them. What is a canonical tool for such a purpose?

 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. It's fast and beautiful enough, for me anyway.

 https://github.com/GNOME/goffice

 John
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Pygobject memory leak in set_property?

2015-01-02 Thread Gergely Polonkai
Hello,

How big is the memory increase? set_text() allocates memory for text, which
might be the cause.

Best,
Gergely
On 1 Jan 2015 22:55, Colin Myers colin.my...@tabernus.com wrote:

 Hello list,

 I've been wrangling with a leak in my Pygobject/Gtk application and
 believe the following lines of python demonstrate the problem:


 from gi.repository import Gtk
 cell = Gtk.CellRendererText()
 text = 'Hello world'
 while True:
 cell.set_property('text', text)


 No new python objects are allocated in the loop but top shows growing
 memory. Similarly I found this leaks:

 label = Gtk.Label()
 text = 'Hello world'
 while True:
 label.set_property('label', text)


 But this does not:

 label = Gtk.Label()
 text = 'Hello world'
 while True:
 label.set_text(text)


 I feel like I am missing something obvious, please help!


 Regards,
 Colin
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gir and refcounting

2015-01-02 Thread Gergely Polonkai
My first thought is that Perl and Glib::Object::Introspection is just fine.
If I were you, I would further debug my own application, with something
like refdbg (http://refdbg.sourceforge.net/ despite the looks, it still
works nowadays) or GObject-list (https://github.com/danni/gobject-list
haven’t tried it myself, but it got pretty good feedback).

Best,
Gergely

On 2 January 2015 at 12:24, Wouter Verhelst w...@uter.be wrote:

 Hi,

 After help on this list, I got my API documentation to work properly,
 and have since added GObject-Introspection annotations so that I could
 use it from perl.

 When running the following script:

 ---
 use Glib::Object::Introspection;

 Glib::Object::Introspection-setup(
 basename = Joy,
 version = 1.0,
 package = Joy);

 my $stick = Joy::Stick-open(/dev/input/js0);
 if(!$stick-get(open)) {
 print(Joystick could not be opened.\n);
 exit 0;
 }
 print Joystick  . $stick-describe() .  has  .
 $stick-get_button_count() .  buttons and  . $stick-get_axis_count() . 
 axes\n;
 ---

 then the output is:

 Joystick Logitech Inc. WingMan Gamepad Extreme has 10 buttons and 4 axes
 GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT
 (object)' failed during global destruction.
 GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion 'G_IS_OBJECT
 (object)' failed during global destruction.
 GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)'
 failed during global destruction.

 (or, when no joystick is present:)

 Joystick could not be opened.
 GLib-GObject-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT
 (object)' failed during global destruction.
 GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion 'G_IS_OBJECT
 (object)' failed during global destruction.
 GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)'
 failed during global destruction.

 This occurs because somehow, perl seems to have a higher reference count
 than does glib, causing it to deref the object when it's already been
 destroyed. I've been trying to figure out what the problem is, but so
 far without luck.

 Anyone know what's happening?

 Code is at https://github.com/yoe/libjoy

 Thanks,

 --
 It is easy to love a country that is famous for chocolate and beer

   -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK, can GtkNotebook have a single control and all tabs pointing to it?

2015-02-09 Thread Gergely Polonkai
Hello,

I'm afraid this is not possible to do it this way; you will have to create
some kind of wrapper widget. I would go on with GtkStack, and for the tabs
themselves you may take a look into GtkStackSwitcher's source code.

Best,
Gergely
On 9 Feb 2015 14:43, Leo Ufimtsev lufim...@redhat.com wrote:

 Hello,

 I'm an SWT developer. We build SWT on top of GTK.

 In swt, some developers like to create a GtkNotebook (TabFolder) with many
 tabs but all pointing to the same control. (sigh, odd, I know...)

 The control is a viewer, and changing tabs changes the content of the
 viewer.

 However, in gtk I haven't been able to make this work. If I add the same
 child twice, it gives me warnings and errors:
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), child1, label1);
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), child1, label2);

 Warning:
 (gtk3_testing:17322): Gtk-WARNING **: Can't set a parent on widget which
 has a parent


 Theoretically speaking, can a GtkNotebook have tabs that all point to the
 same control? (and we just listen to tab-changing events)? Or is this
 impossible by principle of widget-hierarchy?

 Thank you

 Leo Ufimtsev | Intern Software Engineer @ Eclipse Team

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Misconduct of GTK+/glib Bugtracker Admins

2015-06-07 Thread Gergely Polonkai
Hello,

I’m sorry to say that, but I find your name very appropriate in this case:
*Ignorant* Guru. You seem to ignore every statement that says something
else that you do.

GNOME is not a Red Hat product. It is a GNOME Foundation product, if you
want to put it anywhere. It is led by several developers, Red Hat employees
or not, who put a lot of effort to make it better. I personally know that
they *do* accept patches, as I have sent some of them in the past, and
possibly will send more in the future. You were told several times that if
you don’t like the way it works, then create a patch: GNOME developers
don’t necessarily have the time to make this work for you. You can see how
many problems they have to deal with either by looking at the bug tracker
or the IRC channel they hang around on.

I try to repeat what so many others said before in this thread: if you have
put half the effort into writing a patch instead of writing such not-well
backed complaints, this problem should have been solved already.

Disclaimer: I’m not officially connected with GNOME nor Red Hat, Inc. I
just use GNOME since 1.something, and although I don’t necessarily agree
with all the steps they took, I still like this platform.

Kind regards,
Gergely

2015-06-07 21:20 GMT+02:00 Lucas Levrel llev...@yahoo.fr:

 Le 7 juin 2015, IgnorantGuru a écrit :

  As for who agrees with me and who doesn't, outside of fanboy lists and
 such, most people I encounter are QUITE unhappy with GTK 3, and often ask
 why I use it at all.


 Indeed, can't you go back and use GTK 2 instead ? (Maybe does this bug
 exist in GTK2 as well?)

 --
 Lucas Levrel

 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Misconduct of GTK+/glib Bugtracker Admins

2015-06-07 Thread Gergely Polonkai
Hello,

I didn’t really want you to believe me, I just shared my experiences,
that’s all. I got help several times from these “Red Hat employees” before,
although I wouldn’t say it came in an instant; I must confess that
sometimes I bugged them or IRC before they answered my calls. The keywords
here are patience, persistence and and politeness. I’d like to think I bear
all these virtues and use them well. Reading your bug report and the
original message, I think if you state your problems without getting
personal with either them or the companies they work for (or you think they
work for), you could have gotten more far.

Yes, I also think they were not very respectful, but to be honest, you
called for it: if you threaten someone by any means, don’t be surprised if
they strike back. It goes just like this everywhere in this world.

I will leave this thread alone now. Of course, if you have anything to
discuss with me we can do that in private, and I hereby grant you to
publish our discussions with my name if we do so.

I still hope your problem gets solved, as I can see the use case and the
annoyance of your users.

Wishing you the best,
Gergely Polonkai

2015-06-07 23:18 GMT+02:00 IgnorantGuru ignorantg...@openmailbox.org:

 On Sun, 7 Jun 2015 21:53:24 +0200
 Gergely Polonkai gerg...@polonkai.eu wrote:

  Hello,
 
  I’m sorry to say that, but I find your name very appropriate in this
  case: *Ignorant* Guru. You seem to ignore every statement that says
  something else that you do.
 
  GNOME is not a Red Hat product. It is a GNOME Foundation product, if
  you want to put it anywhere. It is led by several developers, Red Hat
  employees or not, who put a lot of effort to make it better. I
  personally know that they *do* accept patches, as I have sent some of
  them in the past, and possibly will send more in the future. You were
  told several times that if you don’t like the way it works, then
  create a patch: GNOME developers don’t necessarily have the time to
  make this work for you. You can see how many problems they have to
  deal with either by looking at the bug tracker or the IRC channel
  they hang around on.
 
  I try to repeat what so many others said before in this thread: if
  you have put half the effort into writing a patch instead of writing
  such not-well backed complaints, this problem should have been solved
  already.
 
  Disclaimer: I’m not officially connected with GNOME nor Red Hat, Inc.
  I just use GNOME since 1.something, and although I don’t necessarily
  agree with all the steps they took, I still like this platform.
 
  Kind regards,
  Gergely

 Gergely,

 Thank you for your reply, but you do not seem to be processing the
 information here any better than you say I am.  This bug's resolution means
 little to my software.  I was merely offering some input to help them solve
 it.  It's very low on my list of things to be addressed.  It's a minor
 annoyance to a few my users, indirectly in other apps' behavior.

 The real issue here, which you didn't process at all, is the conduct of
 the admins/developers.  Period.  If you find their behavior acceptable or
 of high quality, so be it.  I do not.

 Since sending these list mails, I have noticed a phenomenon.  People are
 disagreeing with me publicly, yet more are writing to me privately
 agreeing, and giving examples where these same developers were, to use one
 person's words:  [to see more] more shockingly antagonizing behavior from
 ebassi, you should check out how he talked to J. Ralls (the gtk-osx
 maintainer) a few years back. Worth a read, downright disrespectful.

 Someone also writes, They centralized everything 'under the main GTK
 site', then nothing happened. Patches are still not being applied. etc.

 Another writes, Although I've been working with GTK+ since the first
 versions, I'm today also very disappointed.

 Yet these people are not comfortable posting such comments here or being
 quoted by name.  This is a pattern I have seen before surrounding Red Hat,
 as well as GTK+ - people feel they cannot speak their mind on these issues.

 Seems your story differs from theirs, and since I've experienced what
 they're referring to directly (for years), and have seen countless other
 examples, why would I believe you?
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: vte widget improvement idea

2015-06-11 Thread Gergely Polonkai
I don't think it is a bad idea per se. Here are some ideas from me:

• it should be either turned off by default
• or it should warn the user like »hey, you are going to paste multiple
lines, are you sure?« with an option to silence such warnings

Also I remember a warning, maybe from ViM that warned me about such an
occasion. This means that the terminal has some knowledge on this.
On 11 Jun 2015 19:13, Wouter Verhelst w...@uter.be wrote:

 On Thu, Jun 11, 2015 at 06:55:13PM +0300, Martin Kunev wrote:
 [...]
  My idea is to add a setting (something like
  vte_terminal_set_paste_escape()) that, when turned on, escapes the
  dangerous characters (unquoted line feeds) from the clipboard text and
 then
  pastes.
 [...]
  Any thoughts on this feature? Do you think this is a good idea? Any
  suggestions?

 To be honest, I think that's a terrible idea.

 You're assuming that pasting something into a shell is always a bad
 idea. It is if you did it by accident, but if you do it on purpose, it
 isn't.

 If I mail my customer to please paste these two commands from their mail
 into a shell window, I don't want to have to tell them to switch off
 this protection first.

 If I have a web page with documentation which says that to create a new
 user, first run adduser usxername, and then run passwd username, I
 don't want to have to tack on but you can't paste that in the shell
 window.

 There are plenty of valid uses for pasting something into a terminal
 window. Let's not throw the kid out with the bath water.

 --
 It is easy to love a country that is famous for chocolate and beer

   -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Auto-resize scrolled window

2015-09-22 Thread Gergely Polonkai
Can you also show us your widget hierarchy like Lucas did? The problem you
outline should not happen in a usual hierarchy.
On 22 Sep 2015 22:11, "Subsentient" <thinkingrod...@gmail.com> wrote:

> GTK 2, using C calls.
>
> On 09/22/15 08:52, Gergely Polonkai wrote:
>
> Before anyone could actually answer:
>
> • what version of GTK are you using?
> • how do you build your window? Are you using plain C calls, or some UI
> builder like Glade?
>
> Best,
> Gergely
> On 22 Sep 2015 02:33, "Subsentient" <thinkingrod...@gmail.com> wrote:
>
>> When I resize the window, I'm having difficulty finding a way to make a
>> scrolled window automatically resize with it. I can't use
>> gtk_widget_set_size_request(), because then I won't be able to shrink it
>> down again.
>> Working in C. How can I have a widget automatically resize to fill all
>> available space given by a window, and then be willing to shrink again if
>> the user tries to resize the window?
>>
>> Thanks.
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Auto-resize scrolled window

2015-09-22 Thread Gergely Polonkai
Before anyone could actually answer:

• what version of GTK are you using?
• how do you build your window? Are you using plain C calls, or some UI
builder like Glade?

Best,
Gergely
On 22 Sep 2015 02:33, "Subsentient"  wrote:

> When I resize the window, I'm having difficulty finding a way to make a
> scrolled window automatically resize with it. I can't use
> gtk_widget_set_size_request(), because then I won't be able to shrink it
> down again.
> Working in C. How can I have a widget automatically resize to fill all
> available space given by a window, and then be willing to shrink again if
> the user tries to resize the window?
>
> Thanks.
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: How does one get the screen coordinates of the workspace?

2015-12-29 Thread Gergely Polonkai
Hello,

this makes me wonder why you need these coordinates?

If you want to set the window size to the maximum, then just maximize it.

If you want to move it around automatically, like put it on the center of
the screen, don't do that. There are situations, e.g. for users with
multiple monitors of diyzfferent sizes, when you do more harm than good
with this approach.

Best,
Gergely
On Dec 29, 2015 11:26 PM, "Rick Berger"  wrote:

> I'm looking for to get the screen coordinates, height and width of the
> workspace on Ubuntu's desktop. The only way I see to doing this, is in
> starting the app: maximize its window; get the workspace info from its
> window's coordinates and dimensions; then un-maximize its window. I believe
> these can be done with GDK.
>
> Is there better way to do this?
>
> Rick
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Preventing fade on loss of focus?

2016-09-06 Thread Gergely Polonkai
Hello,

how exactly do you play the video? Do you open a separate video player like
Totem, or you embed it somehow to your main window?

Best,
Gergely

On Tue, Sep 6, 2016, 21:00 Mark Farver  wrote:

> I am using GTK3 with Weston/Wayland and when I play a video using
> gstreamer my main window loses focus and all the labels dim.  This is
> not the behavior I want since the video is part of the window.  This
> is an ATM like kiosk, so there is no user interface issues related to
> the loss of focus.
>
> Is there a way to modify the window system to disable the dimming
> feature, or set the focus/unfocused styles the same?
>
> Thank you
> Mark Farver
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Adding and removing widgets at runtime

2016-09-12 Thread Gergely Polonkai
Hello,

I have no knowledge of Java/Swing, but based on your requirements I guess
you need FlowBox[1].

Best,
Gergely

[1] https://developer.gnome.org/gtk3/stable/GtkFlowBox.html

On Mon, Sep 12, 2016, 16:35 Daniel.  wrote:

> Hi everybody,
>
> I have a library implementing some protocol. That library is
> multithread and is responsible to delivery messages to remote nodes
> and retrieve it's responses. I need to visualise the whole mess
> running.
>
> To do this I wrote a simple application in Java/Swing where for each
> remote node one thread is created. The thread will send a message and
> wait for response in a closed loop. Each thread is represented at GUI
> by a label on the screen. When it's idle the background of that label
> becomes green, when is waiting for response it is yellow and if
> timeouts it becomes red. All labels have the same information so that
> they have exactly the same size.
>
> Beside the request/repsonse there is events that can arrive from the
> nodes too. That events need to be replied as the messages. When an
> event arrives it's showed up on screen as a new label. When it's reply
> is acknowledge it's removed from the screen.
>
> In pratice there is a big container where the labels came and go and
> change its background colors based on messages, replies and events
> comming and going.
>
> I've been using FlowLayout as the "big container". The labels are
> added and arrange horizontally by FlowLayout. When no room is avaible
> at the current row, a new row is added. When the rows exceed the
> window size a scrowbar appears.
>
> I'm looking for something silimar with GTK2 (I'll run in a embeeded
> system that doesn't have GTK3).
>
> My questions are:
>
> 1) Is there some container with equivalent behavior to the Swing's
> FlowLayout? If no I think I'll need to build one from hbox+vbox, what
> would be the best aproach to it.
> 2) How is the best way to change the background of a label?
> 3) What is the better aproach when adding instantiating, adding,
> showing, hiding removing and freeing widgets at runtime? What can get
> wrong?
>
> References:
> https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html#flow
>
> Best regards,
> --
> "Do or do not. There is no try"
>   Yoda Master
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Accessors vs Properties

2017-01-04 Thread Gergely Polonkai
Hello,

I don't know about others, but in my own code, my_obj_set_property() does
nothing else just calls the setter functions (and the same for getters). It
makes much more sense, and I saw it in a lot of Gtk and Gnome code, too.

Best,
Gergely

On Wed, Jan 4, 2017, 19:27 Tobias Knopp  wrote:

> Hi,
>
> I am working on Gtk language bindings for the Julia programming language (
> https://github.com/JuliaGraphics/Gtk.jl <
> https://github.com/JuliaGraphics/Gtk.jl>) and have a question regarding
> the accessor methods (methods with „get“ and „set“ in them) and the
> property system.
>
> - Is any accessor backuped with a property and vice versa?
> - Which one is to prefer?
>
> I tried to find documentation on this but have not found anything.
>
> Thanks,
>
> Tobias
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk_dialog_get_action_area() deprecation

2016-12-31 Thread Gergely Polonkai
It would be helpful to see your exact use case. If you put only buttons in
your GtkBox, you will be fine with gtk_dialog_add_button(). If you add
other, more complex widgets, there might be a design flaw in your
application. Solutions in between might be OK, but without knowing what you
want to achieve, it's hard to tell.

Best,
Gergely

On Sat, Dec 31, 2016, 10:39 Richard Shann  wrote:

> The documentation for gtk_dialog_get_action_area() suggests using
> gtk_dialog_add_button() etc. However, my application is storing a GtkBox
> in that area - is there a way to do this, going forward?
>
> Richard
>
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Live Thumbnail of Widgets

2017-06-02 Thread Gergely Polonkai
On Fri, Jun 2, 2017, 20:57 infirit  wrote:

> On 20/05/17 16:27, Gerald Nunn wrote:
> > I'm looking for some advice on alternative solutions that would fit my
> > needs. In an ideal solution, the thumbnails would be updated real time
> > similar to the windows in gnome-shell when you go into overview mode.
> > However any solution that increases the rendering speed sufficiently to
> > permit buffered but near real-time updates would be sufficient as well.
>
> I never done anything like this so please anyone correct me if I am
> wrong, but..
>
> Have you though about connecting to the widget's draw signal? With it
> you get a cairo context which one usually draws on but I can imagine you
> could just as well create a pixbuf  miniature. So, get the surface from
> the cairo context with cairo_get_target, then use
> gdk_pixbuf_get_from_surface to create the pixbuf.
>
> ~infirit
>

If I get it right, whenever you want to draw the thumbnail, you reparent
the widget to an offscreen window. How about reparenting them at the moment
they disappear from eyesight, and leaving them there until it needs to be
displayed? That might save you some CPU time.

Also, I would probably use the widget itself as the thumbnail, shielded by
an unclickable, transparent layer. However, all the rescaling that has to
be done this way may introduce significant CPU usage.

Maybe you should take a look into the sources of Boxes. I don't remember,
how they generate the thumbnails for the VM screens, but it might help.

Best,
Gergely

>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: PyGObject: pep8 konform

2018-06-01 Thread Gergely Polonkai
My take would be to ignore this specific line with a magic comment. Or, if
you really donʼt want to d that, a

from importlib import import_module # isnʼt that line wonderful?
Gtk = import_module('gi.repository.Gtk')

might do the trick.

(Note that I wrote it without having Python at hand; maybe you have to
import gi.repository, and do getattr(repository, Gtk) instead.)

Best,
Gergely

On Fri, Jun 1, 2018, 14:47  wrote:

> How do I make PyGObject code PEP8 konform?
>
> e.g.
>
> #!/usr/bin/env python3
> import gi
> gi.require_version('Gtk', '3.0')
> from gi.repository import Gtk
>
> This code causes
> E402 module level import not at top of file
> E402 module level import not at top of file
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Key press synthesis (for WebKitGTK)

2018-11-23 Thread Gergely Polonkai
Hello,

from the manual
(https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-key-press-event),
the signature of key-press-event handlers is:

```
gboolean
user_function (GtkWidget *widget,
   GdkEvent  *event,
   gpointer   user_data)
```

From the same manual:

> Returns
>
> TRUE to stop other handlers from being invoked for the event. FALSE to
> propagate the event further.

So if you change your handler’s return type from `void` to `gboolean`
and return `FALSE` if the lisp thingy doesn’t understand your key, it
will be automatically propagated to the next handler (which, hopefully,
will insert your "a" key.

Best,
Gergely

Pierre Neidhardt writes:

> Hi all!
>
> I'm working on the GTK port of Next browser (http://next.atlas.engineer/,
> source: https://source.atlas.engineer/public/next).
>
> I have a window with a WebKitGTK view in it.
>
> I intercept all key-press-events and send them to a third-party Lisp program 
> via
> XML-RPC.
>
> Whenever the Lisp program does not recognize the key bindings, it notifies the
> GTK program.  From there, GTK must forward the key press to the WebKit view.
>
> Example:
>
> - The focus is on a text field on a web page.
> - I press "a".
> - "a" is sent to the Lisp third party program.
> - Lisp does not know what to do with "a", and sends a message back to the GTK 
> program.
> - The GTK program must insert "a" in the text field in the WebKit view.
>
>
> To achieve that, I think I need to synthesize a key press event during the 
> last
> step.
> (Unless someone can think of a direct way to forward a key press to the WebKit
> view.)
>
> Here is what I've got:
>
> - In the widget creation function:
>
> --8<---cut here---start->8---
>   g_signal_connect(buffer->web_view, "key-press-event", 
> G_CALLBACK(window_send_event), window);
> --8<---cut here---end--->8---
>
> A 'window_send_event' callback for all key-presses.  I use Libsoup to send an
> XML-RPC message containing the keypress to the Lisp program:
>
> --8<---cut here---start->8---
> void window_send_event(GtkWidget *widget, GdkEventKey *event, gpointer data) {
>   // ...  Some provision to avoid infinite loops...
>
>   WindowEvent *window_event = g_new(WindowEvent, 1);
>   Window *window = (Window *)data;
>   window_event->window = window;
>   window_event->event = event;
>
>   g_debug("Sending keypress XML-RPC message for window %p", 
> window_event->window);
>   soup_session_queue_message(xmlrpc_env, msg, _event_callback, 
> window_event);
> }
> --8<---cut here---end--->8---
>
> And finally, the callback when the response arrives from the Lisp program:
>
> --8<---cut here---start->8---
> void window_event_callback(SoupSession *_session, SoupMessage *msg, gpointer 
> data) {
>   // ...
>   if (!g_variant_get_boolean(consumed)) {
>   g_debug("Event not consumed, forwarding to GTK");
>
>   WindowEvent *window_event = (WindowEvent *)data;
>
>   GdkDevice *device = NULL;
>   GdkDisplay *display = gdk_display_get_default();
>   GdkSeat *seat = gdk_display_get_default_seat(display);
>   device = gdk_seat_get_keyboard(seat);
>
>   GdkEvent *event = gdk_event_new(GDK_KEY_PRESS);
>   event->key = *(window_event->event);
>   event->key.string = g_strdup(window_event->event->string);
>   event->key.time = gtk_get_current_event_time();
>   event->key.window = 
> g_object_ref(gtk_widget_get_window(GTK_WIDGET(window_event->window->base)));
>   gdk_event_set_device(event, device);
>
>   gtk_main_do_event(event);
>   gdk_event_free(event);
>
>   g_debug("Event emitted");
>   }
> }
> --8<---cut here---end--->8---
>
> The
>
> --8<---cut here---start->8---
>   gtk_main_do_event(event);
> --8<---cut here---end--->8---
>
> call is not caught anywhere though.  Any idea why?
>
> I've tried with different event settings and sometimes I get
>
> --8<---cut here---start->8---
> (next-gtk-webkit:10768): GLib-GObject-WARNING **: 15:31:27.027: 
> gsignal.c:2172: signal id '68' cannot be chained from current emission stage 
> for instance '0x1c3a2a0'
> --8<---cut here---end--->8---
>
> I don't understand the above error message.  Any idea what could issue it?
>
> Any clue, anyone?
>
> Cheers!
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Key press synthesis (for WebKitGTK)

2018-11-24 Thread Gergely Polonkai
On Sat, Nov 24, 2018 at 09:59:00AM +0100, Pierre Neidhardt wrote:
> Hi Gergely,
> 
> > So if you change your handler’s return type from `void` to `gboolean`
> > and return `FALSE` if the lisp thingy doesn’t understand your key, it
> > will be automatically propagated to the next handler (which, hopefully,
> > will insert your "a" key.
> 
> Thanks for the tip.  Indeed, I had missed that.
> 
> That said, the current situation is a little more complex because the call to
> Lisp is _asynchronous_.  Which means that I can only know the answer from the
> callback of the Soup request, not within the key-press handler.  In the Soup
> callback, the key press event is gone, hence my need to synthesize a new one.
> 
> I have successfully managed to synthesize a key-press event in a dummy 
> program.
> In the above scenario, it fails seemingly because it happens from within a 
> Soup
> callback.  Maybe Libsoup uses different threads, which causes threading issue
> when manipulating GTK widgets?

No, it shouldn’t, at least not by default.

How about you send the event as `user_data` to `soup_request_send()` (or 
whatever method you use) and send that to the webkit widget?

> 
> I also tried to synthesize the key event from another callback started in a
> g_idle_add() in the Soup callback, to no avail.
> g_main_context_invoke() seems to make no difference.
> 
> Thoughts?
> 
> -- 
> Pierre Neidhardt
> https://ambrevar.xyz/



-- 
You must believe in things that are not true.
Otherwise, how will they become?
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list