calling functions defined in gtk's source file

2007-10-07 Thread Joël Krähemann
hello I want to call in my application functions like gtk_window_show,
gtk_widget_real_show and others I've downloaded gtk source and the
distributions patches
however I get an linkage error undefined reference to gtk_window_show. I'm
using make and it's file looks like

$(AGS_DIR)ags: $(AGS_OBJECTS)
gcc -o $(AGS_DIR)ags -ldl $(AGS_OBJECTS) $(LDADD)

$(AGS_DIR)ags_window.o: $(AGS_DIR)ags_window.[ch]
$(GTK_DIR)gtk/gtkwindow.[ch]
gcc ags_window.c -o ags_window.o $()

...

the c file

void
ags_window_class_init(AgsWindow *window)
{
  GtkWidgetClass *widget = (GtkWidgetClass *) window;

  widget-show = ags_window_show;
}

void
ags_window_show(GtkWidget *widget)
{
  gtk_window_show(widget);
}

you can visit my project at http://mitglied.lycos.de/joel2001k/ags/download/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


ld error multiple definitions

2007-10-13 Thread Joël Krähemann
hello I get strange errors like

/home/link/ags/file/ags_file.o: In function `ags_file_class_init':
/home/link/ags/file/ags_file.c:32: multiple definition of `ags_file_class_init'
/home/link/ags/file/ags_file.o:/home/link/ags/file/ags_file.c:32:
first defined here
...

the application with full error output is in
http://mitglied.lycos.de/joel2001k/ags/mailing_list/ags_list.tar.bz2

I don't know what's going on I don't do anything else than in other
files I believe so
please help soon

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


replacing main loop?

2013-09-06 Thread Joël Krähemann
Do I need to replace gtk+ main loop, to create widget's outside it?
namely gtk 2.24.20 and what about gtk 3.x?

please give some advice

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


jiffies gtk_main_iteration

2013-09-08 Thread Joël Krähemann
hi

in how many jiffies should gtk_main_iteration be called?

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


Re: jiffies gtk_main_iteration

2013-09-08 Thread Joël Krähemann
Hi

thank you for your response and interest. Time measurements are done
with jiffies as unit on GNU/Linux. This depends on timer frequency from
100 up to 1000 Hz.

I'd really like to know how much computing time does gtk+ need to do its
job.

I have something like the following and want to know how to initialize
frequency:

struct _AgsGuiThread
{
  AgsThread thread;

  gdouble frequency;
  gdouble iter;
};

 /* */
for(i = 0; i  i_stop; i++){
  gtk_main_iteration();
  nanosleep(wait, NULL);
}


 /* */
if(gui_thread-iter  gui_thread-frequency){
  gtk_main_iteration();
  gui_thread-iter = 0.0;
}else{
  gui_thread-iter += (gdouble) floor(1.0 / gui_thread-frequency);
}

please take a look at:

https://sourceforge.net/p/ags/wiki/threads/
https://sourceforge.net/p/ags/code/1036/tree/src/ags/thread/ags_gui_thread.c


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


Re: jiffies gtk_main_iteration

2013-09-08 Thread Joël Krähemann
Hi,
I solved the problem by introducing a macro

#define AGS_GUI_THREAD_DEFAULT_JIFFIE 200

to calculate timing like

gui_thread-frequency = 1.0 /
  (1.0 /
   (double) AGS_DEVOUT_DEFAULT_SAMPLERATE *
   (double) AGS_DEVOUT_DEFAULT_BUFFER_SIZE) *
  (1.0 /
   (double) AGS_GUI_THREAD_DEFAULT_JIFFIE);

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


gthread using gnu portable threads

2013-09-12 Thread Joël Krähemann
Hi

does someone know if there is a GThread implementation around that uses
gnu portable threads instead of pthread?

The problem is, on debian pthread_suspend and pthread_resume are just
missing.




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


***MEMORY-ERROR***

2013-11-25 Thread Joël Krähemann
Hi, I'm developing an application sf.net/p/ags. I don't want to run
gtk_main I do rather g_main_context_iteration. I'm using fedora and
recently updated to 20-beta. Gtk+ version is 2.24.22.
So my application crashes see below. Any suggestions?

[Thread 0x7fffc27fc700 (LWP 14908) exited]
[Thread 0x7fffd1ffc700 (LWP 14902) exited]
[Thread 0x7fffc2ffd700 (LWP 14907) exited]
[Thread 0x7fffd17fb700 (LWP 14903) exited]

***MEMORY-ERROR***: ags[14888]: GSlice: assertion failed: sinfo-n_allocated  0

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffe37fe700 (LWP 14892)]
0x0034f2c35c59 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0034f2c35c59 in raise () from /lib64/libc.so.6
#1  0x0034f2c37368 in abort () from /lib64/libc.so.6
#2  0x0034f5c1ab12 in mem_error () from /lib64/libglib-2.0.so.0
#3  0x0034f5c6453b in slab_allocator_free_chunk () from 
/lib64/libglib-2.0.so.0
#4  0x0034f5c647df in magazine_cache_push_magazine () from 
/lib64/libglib-2.0.so.0
#5  0x0034f5c1b0ab in thread_memory_magazine2_unload.isra.11 () from 
/lib64/libglib-2.0.so.0
#6  0x0034f5c656a8 in g_slice_free1 () from /lib64/libglib-2.0.so.0
#7  0x003509632de8 in _gtk_tree_data_list_header_free () from 
/lib64/libgtk-x11-2.0.so.0
#8  0x0035094fdc7e in gtk_file_system_model_finalize () from 
/lib64/libgtk-x11-2.0.so.0
#9  0x0034f7014fcb in g_object_unref () from /lib64/libgobject-2.0.so.0
#10 0x0035094e4899 in recent_clear_model () from /lib64/libgtk-x11-2.0.so.0
#11 0x0035094eb386 in operation_mode_set () from /lib64/libgtk-x11-2.0.so.0
#12 0x0035094ec8b2 in shortcuts_activate_iter () from 
/lib64/libgtk-x11-2.0.so.0
#13 0x0035094ecb33 in shortcuts_selection_changed_cb () from 
/lib64/libgtk-x11-2.0.so.0
#14 0x0034f70104c7 in _g_closure_invoke_va () from 
/lib64/libgobject-2.0.so.0
#15 0x0034f7029749 in g_signal_emit_valist () from 
/lib64/libgobject-2.0.so.0
#16 0x0034f702a3af in g_signal_emit () from /lib64/libgobject-2.0.so.0
#17 0x0035096582a6 in gtk_tree_view_real_set_cursor () from 
/lib64/libgtk-x11-2.0.so.0
#18 0x00350965d175 in gtk_tree_view_button_press () from 
/lib64/libgtk-x11-2.0.so.0
#19 0x0035095485bc in _gtk_marshal_BOOLEAN__BOXED () from 
/lib64/libgtk-x11-2.0.so.0
#20 0x0034f7010298 in g_closure_invoke () from /lib64/libgobject-2.0.so.0
#21 0x0034f702211b in signal_emit_unlocked_R () from 
/lib64/libgobject-2.0.so.0
#22 0x0034f7029ddd in g_signal_emit_valist () from 
/lib64/libgobject-2.0.so.0
#23 0x0034f702a3af in g_signal_emit () from /lib64/libgobject-2.0.so.0
#24 0x003509677994 in gtk_widget_event_internal () from 
/lib64/libgtk-x11-2.0.so.0
#25 0x0035095467e4 in gtk_propagate_event () from /lib64/libgtk-x11-2.0.so.0
#26 0x003509546bdb in gtk_main_do_event () from /lib64/libgtk-x11-2.0.so.0
#27 0x00350846046c in gdk_event_dispatch () from /lib64/libgdk-x11-2.0.so.0
#28 0x0034f5c492a6 in g_main_context_dispatch () from 
/lib64/libglib-2.0.so.0
#29 0x0034f5c49628 in g_main_context_iterate.isra.24 () from 
/lib64/libglib-2.0.so.0
#30 0x0034f5c496dc in g_main_context_iteration () from 
/lib64/libglib-2.0.so.0
#31 0x004a1205 in ags_gui_thread_do_gtk_iteration () at 
./src/ags/thread/ags_gui_thread.c:221
#32 0x004a14ba in ags_gui_thread_run () at 
./src/ags/thread/ags_gui_thread.c:255
#33 0x0034f701043f in _g_closure_invoke_va () from 
/lib64/libgobject-2.0.so.0
#34 0x0034f7029749 in g_signal_emit_valist () from 
/lib64/libgobject-2.0.so.0
#35 0x0034f702a3af in g_signal_emit () from /lib64/libgobject-2.0.so.0
#36 0x0049f586 in ags_thread_run (thread=0x7f) at 
./src/ags/thread/ags_thread.c:1720
#37 0x0049f8ff in ags_thread_loop (ptr=optimized out) at 
./src/ags/thread/ags_thread.c:1643
#38 0x0034f3407f33 in start_thread () from /lib64/libpthread.so.0
#39 0x0034f2cf4ead in clone () from /lib64/libc.so.6


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


Re: Help replacing GtkDrawingArea with GtkLayout

2014-03-08 Thread Joël Krähemann
Hi,

Didn't before but may be check the following:

g_object_set(G_OBJECT(layout),
  app-paintable\0, TRUE, 
  NULL);

gtk_widget_set_events (GTK_WIDGET (layout),
  GDK_EXPOSURE_MASK 
  | GDK_LEAVE_NOTIFY_MASK 
  | GDK_BUTTON_PRESS_MASK 
  | GDK_BUTTON_RELEASE_MASK 
  | GDK_POINTER_MOTION_MASK 
  | GDK_POINTER_MOTION_HINT_MASK 
  ); 


On Sun, 2014-03-02 at 14:47 +, Richard Shann wrote:
 I want to replace the existing GtkDrawingArea with a GtkLayout in a
 large application (GNU Denemo).
 When I do this just by substituting gtk_drawing_area_new() with
 gtk_layout_new(NULL, NULL) I do not receive the configure_event and
 scroll_event signals, although the code gtk_widget_add_events ..
 GDK_EXPOSURE_MASK is still in place.
 
 I suspect this is to do with the cryptic note that drawing has to be
 done to the bin_window instead of window, but beyond that I am stumped.
 The draw event is being handled fine, and mouse button clicks etc are
 all working.
 
 Any help in migrating from GtkDrawingArea to GtkLayout would be much
 appreciated.
 
 Richard Shann
 
 
 ___
 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: Help replacing GtkDrawingArea with GtkLayout

2014-03-10 Thread Joël Krähemann
On Sun, 2014-03-09 at 14:03 +, Richard Shann wrote:
  From: Jo?l Kr?hemann j...@weedlight.ch
  To: gtk-app-devel-list@gnome.org
  Subject: Re: Help replacing GtkDrawingArea with GtkLayout
  Message-ID: 1394327737.3369.3.camel@debian
  Content-Type: text/plain; charset=us-ascii
  
  Hi,
  
  Didn't before but may be check the following:
  
  g_object_set(G_OBJECT(layout),
app-paintable\0, TRUE, 
NULL);
 
 Hmm, I hadn't noticed that property. It is presumably set ok since I can
 draw and place widgets on the GtkLayout. It was the configure and scroll
 events that I didn't receive.
 BTW why do you have two NULL bytes at the end of the property name
 (AFAIK only one is needed)?
 
 Richard
 
 

Assumed you get annoyed by warnings, you can slightly disable it. It's
distribution depend what flags are per default on. For further reading:

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

regards
Joël


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


Re: Help replacing GtkDrawingArea with GtkLayout

2014-03-10 Thread Joël Krähemann
On Mon, 2014-03-10 at 09:26 +0100, Joël Krähemann wrote:
 On Sun, 2014-03-09 at 14:03 +, Richard Shann wrote:
   From: Jo?l Kr?hemann j...@weedlight.ch
   To: gtk-app-devel-list@gnome.org
   Subject: Re: Help replacing GtkDrawingArea with GtkLayout
   Message-ID: 1394327737.3369.3.camel@debian
   Content-Type: text/plain; charset=us-ascii
   
   Hi,
   
   Didn't before but may be check the following:
   
   g_object_set(G_OBJECT(layout),
 app-paintable\0, TRUE, 
 NULL);
  
  Hmm, I hadn't noticed that property. It is presumably set ok since I can
  draw and place widgets on the GtkLayout. It was the configure and scroll
  events that I didn't receive.
  BTW why do you have two NULL bytes at the end of the property name
  (AFAIK only one is needed)?
  
  Richard
  
  
 
 Assumed you get annoyed by warnings, you can slightly disable it. It's
 distribution depend what flags are per default on. For further reading:
 
 http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
 
 regards
 Joël
 
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

You should ask why I forget to add GDK_SCROLL_MASK

gtk_widget_set_events (GTK_WIDGET (layout),
  GDK_EXPOSURE_MASK 
  | GDK_LEAVE_NOTIFY_MASK 
  | GDK_BUTTON_PRESS_MASK 
  | GDK_BUTTON_RELEASE_MASK 
  | GDK_POINTER_MOTION_MASK 
  | GDK_POINTER_MOTION_HINT_MASK 
  | GDK_SCROLL_MASK
  );

then you have to

g_signal_connect(G_OBJECT(layout), scroll-event\0,
  G_CALLBACK(layout_callback), NULL);


gboolean
layout_callback(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
  /* do your thing */

  return(FALSE);
}



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


Re: GTK signals question.

2014-03-10 Thread Joël Krähemann
Do you have an other thread?
May be concurrency problems?


On Wed, 2014-03-05 at 01:43 -0500, Chris Moller wrote:
 Okay, I'm out of ideas...
 
 I'm writing an app, that among a lot of other stuff, has three mutually 
 interacting spinbuttuns, i.e., if I increment spinbutton A, its callback 
 then updates values in B and C.  B and then would try to update A, and 
 C, etc., resulting in a bottomless recursion.  So, what I need to do is, 
 while I'm in A's callback, block the B and C callbacks; while in in B, 
 block A and C and so on.
 
 Every combination of g_signal_handler_block(), 
 g_signal_handlers_block_matched(), etc, I've tried just results in seg 
 faults--all that stuff works fine outside the callbacks, but the moment 
 I stick them in a callback, death happens.
 
 Any suggestions?
 
 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: Help replacing GtkDrawingArea with GtkLayout

2014-03-11 Thread Joël Krähemann
On Tue, 2014-03-11 at 14:01 +, Richard Shann wrote:
 On Tue, 2014-03-11 at 13:18 +0100, Joël Krähemann wrote:
  On Tue, 2014-03-11 at 08:12 +, Richard Shann wrote:
   On Tue, 2014-03-11 at 04:43 +0100, Joël Krähemann wrote:
On Mon, 2014-03-10 at 09:52 +, Richard Shann wrote:
 On Mon, 2014-03-10 at 09:29 +0100, Joël Krähemann wrote:
  On Mon, 2014-03-10 at 09:26 +0100, Joël Krähemann wrote:
   On Sun, 2014-03-09 at 14:03 +, Richard Shann wrote:
 From: Jo?l Kr?hemann j...@weedlight.ch
 To: gtk-app-devel-list@gnome.org
 Subject: Re: Help replacing GtkDrawingArea with GtkLayout
 Message-ID: 1394327737.3369.3.camel@debian
 Content-Type: text/plain; charset=us-ascii
 
 Hi,
 
 Didn't before but may be check the following:
 
 g_object_set(G_OBJECT(layout),
   app-paintable\0, TRUE, 
   NULL);

Hmm, I hadn't noticed that property. It is presumably set ok 
since I can
draw and place widgets on the GtkLayout. It was the configure 
and scroll
events that I didn't receive.
BTW why do you have two NULL bytes at the end of the property 
name
(AFAIK only one is needed)?

Richard


   
   Assumed you get annoyed by warnings, you can slightly disable it. 
   It's
   distribution depend what flags are per default on. For further 
   reading:
   
   http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
   
   regards
   Joël
   
   
   ___
   gtk-app-devel-list mailing list
   gtk-app-devel-list@gnome.org
   https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
  You should ask why I forget to add GDK_SCROLL_MASK
 
 Well, I didn't ask because I already tried it. The GtkLayout didn't
 receive that nor the configure signal even with setting
 GDK_ALL_EVENTS_MASK. What *did* work is receiving the events on the
 parent.
 But I am still curious why you have two NULL bytes termination your
 signal name strings, the extra one must surely get ignored...
 
 Richard
 
 
  
  gtk_widget_set_events (GTK_WIDGET (layout),
GDK_EXPOSURE_MASK 
| GDK_LEAVE_NOTIFY_MASK 
| GDK_BUTTON_PRESS_MASK 
| GDK_BUTTON_RELEASE_MASK 
| GDK_POINTER_MOTION_MASK 
| GDK_POINTER_MOTION_HINT_MASK 
| GDK_SCROLL_MASK
);
  
  then you have to
  
  g_signal_connect(G_OBJECT(layout), scroll-event\0,
G_CALLBACK(layout_callback), NULL);
  
  
  gboolean
  layout_callback(GtkWidget *widget, GdkEvent *event, gpointer 
  user_data)
  {
/* do your thing */
  
return(FALSE);
  }
  
  
  
 
 
Is your code somewhere online? Are you using
gtk_widget_set_size_request()?

   
   I gave a minimal example earlier in the thread:
   
   https://mail.gnome.org/archives/gtk-app-devel-list/2014-March/msg7.html
   
   
   Richard
   
   
  Much better! As someone told you before the widget is realized you have
  to set the appropriate flags.
 
 The widget is not realized before the flags are set. Indeed gtk_main()
 has not even been called, so no signals have been emitted when the flags
 are set.
 Here is the code with the sequence altered as you suggest:
 
 8
 #include gtk/gtk.h
 static gboolean
 configure_event ()
 {
 fprintf (stderr, configure-event\n);
 gtk_main_quit ();
 return FALSE;
 }
 
 int main(int argc, char *argv[])
 {
 GtkWidget *window;
 GtkWidget *layout;
 GtkWidget *label1;
 
 gtk_init (argc, argv);
 
 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

 layout = gtk_layout_new (NULL, NULL);
 gtk_widget_add_events (layout, GDK_ALL_EVENTS_MASK);
 gtk_container_add (GTK_CONTAINER (window), layout);

 
 label1 = gtk_label_new (label 1);
 
 gtk_layout_put (GTK_LAYOUT (layout), label1, 10, 50);
   
 
 gtk_widget_show_all (window);
 
 GdkWindow *win = gtk_widget_get_window(layout); 
 g_print(win is %p initial mask 0x%x\n, win, gdk_window_get_events
 (win));
 gdk_window_set_events (win, gdk_window_get_events (win) |
 GDK_STRUCTURE_MASK);
 g_print(After adding GDK_STRUCTURE_MASK mask 0x%x\n,
 gdk_window_get_events (win));
 
 g_signal_connect (layout, configure-event, G_CALLBACK
 (configure_event), NULL);
 
 gtk_main ();
 
 return 0;
 }
 
 
 
 As you can verify, it makes no difference - it would be very bizarre if
 it did.
 
  
  layout = gtk_layout_new (NULL, NULL);
  
  /* SET FLAGS HERE */
  
  gtk_container_add (GTK_CONTAINER (window), layout);
  
  
  and don't forget to add the missing parameters.
 
 The parameters in the definition of the callback

Re: Help replacing GtkDrawingArea with GtkLayout

2014-03-11 Thread Joël Krähemann
On Tue, 2014-03-11 at 21:14 +0100, Joël Krähemann wrote:
 On Tue, 2014-03-11 at 14:01 +, Richard Shann wrote:
  On Tue, 2014-03-11 at 13:18 +0100, Joël Krähemann wrote:
   On Tue, 2014-03-11 at 08:12 +, Richard Shann wrote:
On Tue, 2014-03-11 at 04:43 +0100, Joël Krähemann wrote:
 On Mon, 2014-03-10 at 09:52 +, Richard Shann wrote:
  On Mon, 2014-03-10 at 09:29 +0100, Joël Krähemann wrote:
   On Mon, 2014-03-10 at 09:26 +0100, Joël Krähemann wrote:
On Sun, 2014-03-09 at 14:03 +, Richard Shann wrote:
  From: Jo?l Kr?hemann j...@weedlight.ch
  To: gtk-app-devel-list@gnome.org
  Subject: Re: Help replacing GtkDrawingArea with GtkLayout
  Message-ID: 1394327737.3369.3.camel@debian
  Content-Type: text/plain; charset=us-ascii
  
  Hi,
  
  Didn't before but may be check the following:
  
  g_object_set(G_OBJECT(layout),
app-paintable\0, TRUE, 
NULL);
 
 Hmm, I hadn't noticed that property. It is presumably set ok 
 since I can
 draw and place widgets on the GtkLayout. It was the configure 
 and scroll
 events that I didn't receive.
 BTW why do you have two NULL bytes at the end of the property 
 name
 (AFAIK only one is needed)?
 
 Richard
 
 

Assumed you get annoyed by warnings, you can slightly disable 
it. It's
distribution depend what flags are per default on. For further 
reading:

http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

regards
Joël


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
   
   You should ask why I forget to add GDK_SCROLL_MASK
  
  Well, I didn't ask because I already tried it. The GtkLayout didn't
  receive that nor the configure signal even with setting
  GDK_ALL_EVENTS_MASK. What *did* work is receiving the events on the
  parent.
  But I am still curious why you have two NULL bytes termination your
  signal name strings, the extra one must surely get ignored...
  
  Richard
  
  
   
   gtk_widget_set_events (GTK_WIDGET (layout),
 GDK_EXPOSURE_MASK 
 | GDK_LEAVE_NOTIFY_MASK 
 | GDK_BUTTON_PRESS_MASK 
 | GDK_BUTTON_RELEASE_MASK 
 | GDK_POINTER_MOTION_MASK 
 | GDK_POINTER_MOTION_HINT_MASK 
 | GDK_SCROLL_MASK
 );
   
   then you have to
   
   g_signal_connect(G_OBJECT(layout), scroll-event\0,
 G_CALLBACK(layout_callback), NULL);
   
   
   gboolean
   layout_callback(GtkWidget *widget, GdkEvent *event, gpointer 
   user_data)
   {
 /* do your thing */
   
 return(FALSE);
   }
   
   
   
  
  
 Is your code somewhere online? Are you using
 gtk_widget_set_size_request()?
 

I gave a minimal example earlier in the thread:

https://mail.gnome.org/archives/gtk-app-devel-list/2014-March/msg7.html


Richard


   Much better! As someone told you before the widget is realized you have
   to set the appropriate flags.
  
  The widget is not realized before the flags are set. Indeed gtk_main()
  has not even been called, so no signals have been emitted when the flags
  are set.
  Here is the code with the sequence altered as you suggest:
  
  8
  #include gtk/gtk.h
  static gboolean
  configure_event ()
  {
  fprintf (stderr, configure-event\n);
  gtk_main_quit ();
  return FALSE;
  }
  
  int main(int argc, char *argv[])
  {
  GtkWidget *window;
  GtkWidget *layout;
  GtkWidget *label1;
  
  gtk_init (argc, argv);
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
  layout = gtk_layout_new (NULL, NULL);
  gtk_widget_add_events (layout, GDK_ALL_EVENTS_MASK);
  gtk_container_add (GTK_CONTAINER (window), layout);
 
  
  label1 = gtk_label_new (label 1);
  
  gtk_layout_put (GTK_LAYOUT (layout), label1, 10, 50);

  
  gtk_widget_show_all (window);
  
  GdkWindow *win = gtk_widget_get_window(layout); 
  g_print(win is %p initial mask 0x%x\n, win, gdk_window_get_events
  (win));
  gdk_window_set_events (win, gdk_window_get_events (win) |
  GDK_STRUCTURE_MASK);
  g_print(After adding GDK_STRUCTURE_MASK mask 0x%x\n,
  gdk_window_get_events (win));
  
  g_signal_connect (layout, configure-event, G_CALLBACK
  (configure_event), NULL);
  
  gtk_main ();
  
  return 0;
  }
  
  
  
  As you can verify, it makes no difference - it would be very bizarre if
  it did.
  
   
   layout

Re: Help replacing GtkDrawingArea with GtkLayout

2014-03-13 Thread Joël Krähemann
On Wed, 2014-03-12 at 09:15 +, Richard Shann wrote:
 On Tue, 2014-03-11 at 21:43 +0100, Joël Krähemann wrote:
 [...]
   Please consider the documentation of gtk_widget_set_app_paintable()
   don't believe GtkLayout can do your job. You could try id with a
   GtkDrawingArea with a cairo surface. I do some drawing in C take a look
   at http://sourceforge.net/p/ags/code/HEAD/tree/src/ags/X/ags_editor.c
   
   regards Joël
   
   
   
   ___
   gtk-app-devel-list mailing list
   gtk-app-devel-list@gnome.org
   https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
  
  
  Finally got it you can't read GdkWindow before you didn't show the assigned 
  widget.
 
 I am unsure what you mean by read GdkWindow, as you can see from the
 console output when running the minimal example the GdkWindow attached
 to the GtkLayout does exist and does get its flags set. Those g_print()
 statements are there to confirm that fact.
 
  
  #include gtk/gtk.h
  
  gboolean
  configure_event (GtkWidget *widget,
   GdkEventConfigure *configure,
   gpointer data)
  {
fprintf (stderr, configure-event\n);
gtk_main_quit ();
return FALSE;
  }
  int main(int argc, char *argv[])
  {
GtkWidget *window;
GtkWidget *layout;
GtkWidget *label1;
GdkWindow *win;
  
gtk_init (argc, argv);
  
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  
layout = gtk_layout_new (NULL, NULL);
g_object_set(G_OBJECT(layout),
 app-paintable, TRUE,
 NULL);
  
gtk_widget_add_events (layout, GDK_ALL_EVENTS_MASK);
gtk_container_add (GTK_CONTAINER (window), layout);
  
label1 = gtk_label_new (label 1);
  
gtk_layout_put (GTK_LAYOUT (layout), label1, 10, 50);
  
  
gtk_widget_show_all (window);
  
win = gtk_layout_get_bin_window (GTK_LAYOUT(layout));
g_print(win is %p initial mask 0x%x\n, win, gdk_window_get_events
(win));
gdk_window_set_events (win, gdk_window_get_events (win) |
   GDK_STRUCTURE_MASK);
g_print(After adding GDK_STRUCTURE_MASK mask 0x%x\n,
gdk_window_get_events (win));
  
g_signal_connect (layout, configure-event,
  G_CALLBACK (configure_event), NULL);
  
gtk_main ();
  
return 0;
  }
  
 
 When I compile the version you have given the code behaves as before,
 the window pops up (because the configure-event signal has not been
 received, whose callback would cause an exit).
 Are you saying it does something different for you?
 
 Richard
 
 
replace as following:
g_signal_connect (layout, expose-event,
  G_CALLBACK (configure_event), NULL);

And you recognize that my version works. You have a problem because
GtkLayout is a fixed layout. So you never get any configure event.

Further the XcbWindow isn't instatiated unless you show the GdkWindow.
Please consider gtk source code for indept informations because there
some unreliable memories.
- that's why you can't draw before it is shown.

Joël



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


[Fwd: dereferencing void *]

2014-03-23 Thread Joël Krähemann
https://sourceforge.net/p/ags/code/1515/tree/src/ags/thread/ags_returnable_thread.c

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


Re: [Fwd: dereferencing void *]

2014-03-23 Thread Joël Krähemann
On Mon, 2014-03-24 at 00:20 +0100, Joël Krähemann wrote:
 https://sourceforge.net/p/ags/code/1515/tree/src/ags/thread/ags_returnable_thread.c
 
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Hi, I'd like to use g_atomic_pointer_set and g_atomic_pointer_get but
obtaining compile error. First the struct containing void *


struct _AgsReturnableThread
{
  AgsThread thread;

  volatile guint flags;

  volatile void *safe_data;
};


(gdb) r
Starting program: /home/joel/ags-code/ags 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need set solib-search-path or set sysroot?
[Thread debugging using libthread_db enabled]
Using host libthread_db library
/lib/x86_64-linux-gnu/libthread_db.so.1.
[New Thread 0x7fffe630a700 (LWP 5175)]
[New Thread 0x7fffe5aa9700 (LWP 5176)]
[New Thread 0x7fffe52a8700 (LWP 5177)]
[New Thread 0x7fffe4aa7700 (LWP 5178)]
[New Thread 0x7fffd700 (LWP 5179)]
[New Thread 0x7fffdf7fe700 (LWP 5180)]
[New Thread 0x7fffdeffd700 (LWP 5181)]
[New Thread 0x7fffde7fc700 (LWP 5182)]
[New Thread 0x7fffddffb700 (LWP 5183)]
[New Thread 0x7fffdd7fa700 (LWP 5184)]
[New Thread 0x7fffdcff9700 (LWP 5185)]
** Message: AgsRecallFactory creating: ags-delay
** Message: AgsRecallFactory creating: ags-count-beats
** Message: ags_channel_nth:
  nth channel does not exist
  `- stopped @: i = 0; nth = 0

** Message: AgsRecallFactory creating: ags-copy-pattern
** Message: ags_channel_nth:
  nth channel does not exist
  `- stopped @: i = 0; nth = 0

** Message: debug: AGS_IS_COPY_PATTERN_AUDIO_RUN(packable)


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffddffb700 (LWP 5183)]
ags_task_thread_append_task_queue (thread=0x97a010)
at ./src/ags/thread/ags_task_thread.c:264
264   task_thread = append-task_thread;




(gdb) make ags
gcc -DHAVE_CONFIG_H -I.  -I./src/  -I/usr/include/uuid
-I/usr/include/alsa-I/usr/include/libxml2
-I/usr/include/libinstpatch-1.0 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -pthread
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
-pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12
-I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libdrm
-pthread -I/usr/include/gtk-2.0
-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/
-I/usr/include/freetype2 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/harfbuzz
-g -O2 -MT ags-ags_returnable_thread.o -MD -MP
-MF .deps/ags-ags_returnable_thread.Tpo -c -o
ags-ags_returnable_thread.o `test -f
'./src/ags/thread/ags_returnable_thread.c' || echo
'./'`./src/ags/thread/ags_returnable_thread.c
In file included
from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
 from /usr/include/glib-2.0/glib/gtypes.h:34,
 from /usr/include/glib-2.0/glib/galloca.h:34,
 from /usr/include/glib-2.0/glib.h:32,
 from ./src/ags/thread/ags_returnable_thread.h:22,
 from ./src/ags/thread/ags_returnable_thread.c:19:
./src/ags/thread/ags_returnable_thread.c: In function
'ags_returnable_thread_init':
/usr/include/glib-2.0/glib/gmacros.h:181:53: error: size of array
'_GStaticAssertCompileTimeAssertion_1' is negative
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE
(_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
G_GNUC_UNUSED
 ^
/usr/include/glib-2.0/glib/gmacros.h:178:47: note: in definition of
macro 'G_PASTE_ARGS'
 #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ##
identifier2
   ^
/usr/include/glib-2.0/glib/gmacros.h:181:44: note: in expansion of macro
'G_PASTE'
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE
(_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gatomic.h:154:5: note: in expansion of macro
'G_STATIC_ASSERT'
 G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));
\
 ^
./src/ags/thread/ags_returnable_thread.c:108:3: note: in expansion of
macro 'g_atomic_pointer_set'
   g_atomic_pointer_set((returnable_thread-safe_data),
   ^
./src/ags/thread/ags_returnable_thread.c:108:3: error: invalid use of
void expression
In file included from /usr/include/glib-2.0/glib/gthread.h:34:0,
 from /usr/include/glib-2.0/glib/gasyncqueue.h:34,
 from /usr/include/glib-2.0

Re: [Fwd: dereferencing void *]

2014-03-23 Thread Joël Krähemann
On Mon, 2014-03-24 at 00:22 +0100, Joël Krähemann wrote:
 On Mon, 2014-03-24 at 00:20 +0100, Joël Krähemann wrote:
  https://sourceforge.net/p/ags/code/1515/tree/src/ags/thread/ags_returnable_thread.c
  
  ___
  gtk-app-devel-list mailing list
  gtk-app-devel-list@gnome.org
  https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
 
 Hi, I'd like to use g_atomic_pointer_set and g_atomic_pointer_get but
 obtaining compile error. First the struct containing void *
 
 
 struct _AgsReturnableThread
 {
   AgsThread thread;
 
   volatile guint flags;
 
   volatile void *safe_data;
 };
 
 
 (gdb) r
 Starting program: /home/joel/ags-code/ags 
 warning: Could not load shared library symbols for linux-vdso.so.1.
 Do you need set solib-search-path or set sysroot?
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library
 /lib/x86_64-linux-gnu/libthread_db.so.1.
 [New Thread 0x7fffe630a700 (LWP 5175)]
 [New Thread 0x7fffe5aa9700 (LWP 5176)]
 [New Thread 0x7fffe52a8700 (LWP 5177)]
 [New Thread 0x7fffe4aa7700 (LWP 5178)]
 [New Thread 0x7fffd700 (LWP 5179)]
 [New Thread 0x7fffdf7fe700 (LWP 5180)]
 [New Thread 0x7fffdeffd700 (LWP 5181)]
 [New Thread 0x7fffde7fc700 (LWP 5182)]
 [New Thread 0x7fffddffb700 (LWP 5183)]
 [New Thread 0x7fffdd7fa700 (LWP 5184)]
 [New Thread 0x7fffdcff9700 (LWP 5185)]
 ** Message: AgsRecallFactory creating: ags-delay
 ** Message: AgsRecallFactory creating: ags-count-beats
 ** Message: ags_channel_nth:
   nth channel does not exist
   `- stopped @: i = 0; nth = 0
 
 ** Message: AgsRecallFactory creating: ags-copy-pattern
 ** Message: ags_channel_nth:
   nth channel does not exist
   `- stopped @: i = 0; nth = 0
 
 ** Message: debug: AGS_IS_COPY_PATTERN_AUDIO_RUN(packable)
 
 
 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 0x7fffddffb700 (LWP 5183)]
 ags_task_thread_append_task_queue (thread=0x97a010)
 at ./src/ags/thread/ags_task_thread.c:264
 264   task_thread = append-task_thread;
 
 
 
 
 (gdb) make ags
 gcc -DHAVE_CONFIG_H -I.  -I./src/  -I/usr/include/uuid
 -I/usr/include/alsa-I/usr/include/libxml2
 -I/usr/include/libinstpatch-1.0 -I/usr/include/glib-2.0
 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include   -pthread
 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
 -pthread -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0
 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libpng12
 -I/usr/include/cairo -I/usr/include/glib-2.0
 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libdrm
 -pthread -I/usr/include/gtk-2.0
 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0
 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0
 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/
 -I/usr/include/freetype2 -I/usr/include/glib-2.0
 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/harfbuzz
 -g -O2 -MT ags-ags_returnable_thread.o -MD -MP
 -MF .deps/ags-ags_returnable_thread.Tpo -c -o
 ags-ags_returnable_thread.o `test -f
 './src/ags/thread/ags_returnable_thread.c' || echo
 './'`./src/ags/thread/ags_returnable_thread.c
 In file included
 from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
  from /usr/include/glib-2.0/glib/gtypes.h:34,
  from /usr/include/glib-2.0/glib/galloca.h:34,
  from /usr/include/glib-2.0/glib.h:32,
  from ./src/ags/thread/ags_returnable_thread.h:22,
  from ./src/ags/thread/ags_returnable_thread.c:19:
 ./src/ags/thread/ags_returnable_thread.c: In function
 'ags_returnable_thread_init':
 /usr/include/glib-2.0/glib/gmacros.h:181:53: error: size of array
 '_GStaticAssertCompileTimeAssertion_1' is negative
  #define G_STATIC_ASSERT(expr) typedef char G_PASTE
 (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
 G_GNUC_UNUSED
  ^
 /usr/include/glib-2.0/glib/gmacros.h:178:47: note: in definition of
 macro 'G_PASTE_ARGS'
  #define G_PASTE_ARGS(identifier1,identifier2) identifier1 ##
 identifier2
^
 /usr/include/glib-2.0/glib/gmacros.h:181:44: note: in expansion of macro
 'G_PASTE'
  #define G_STATIC_ASSERT(expr) typedef char G_PASTE
 (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
 G_GNUC_UNUSED
 ^
 /usr/include/glib-2.0/glib/gatomic.h:154:5: note: in expansion of macro
 'G_STATIC_ASSERT'
  G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer));
 \
  ^
 ./src/ags/thread/ags_returnable_thread.c:108:3: note: in expansion of
 macro 'g_atomic_pointer_set'
g_atomic_pointer_set((returnable_thread-safe_data),
^
 ./src/ags/thread/ags_returnable_thread.c:108:3: error: invalid use of
 void

Re: [Fwd: dereferencing void *]

2014-03-24 Thread Joël Krähemann
On Mon, 2014-03-24 at 02:43 +0100, Colomban Wendling wrote:
 Le 24/03/2014 01:36, Joël Krähemann a écrit :
  [...]
  
  The following will compile but is it still correct?
  
g_atomic_pointer_set((returnable_thread-safe_data),
 NULL);
 
 Yes, as the atomic_int* functions expect a pointer to the integer to
 atomically set, the atomic_pointer* ones expect a pointer to the pointer
 to atomically set.
 
 Cheers,
 Colomban
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Thank you very much but g_atomic_pointer_set doesn't help me in this
case. It still crashes with:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffddffb700 (LWP 25872)]
ags_task_thread_append_task_queue (thread=0x97a010)
at ./src/ags/thread/ags_task_thread.c:266
266   task_thread = append-task_thread;
(gdb) bt
#0  ags_task_thread_append_task_queue (thread=0x97a010)
at ./src/ags/thread/ags_task_thread.c:266
#1  0x74bca2df in ?? ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#2  0x74be2df8 in g_signal_emit_valist ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#3  0x74be3a52 in g_signal_emit ()
from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#4  0x004aec46 in ags_thread_run (thread=0x97a010)
at ./src/ags/thread/ags_thread.c:1718
#5  0x004aefd7 in ags_thread_loop (ptr=optimized out)
at ./src/ags/thread/ags_thread.c:1641
#6  0x7377a062 in start_thread (arg=0x7fffddffb700) at
pthread_create.c:312
#7  0x734aea3d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111


Here's what it does any idea why?


void
ags_task_thread_append_tasks_queue(AgsThread *thread)
{
  AgsTask *task;
  AgsTaskThread *task_thread;
  AgsTaskThreadAppend *append;
  GList *list;
  gboolean initial_wait;
  int ret;

  append = (AgsTaskThreadAppend *)
g_atomic_pointer_get((AGS_RETURNABLE_THREAD(thread)-safe_data));

  task_thread = append-task_thread;
  list = (GList *) append-data;

  free(append);

  /* lock */
  pthread_mutex_lock((task_thread-read_mutex));

  /* append to queue */
  task_thread-queued += g_list_length(list);

  task_thread-queue = g_list_concat(task_thread-queue, list);

  /*  */
  pthread_mutex_unlock((task_thread-read_mutex));

  /* give back to pool */
  ags_thread_stop(thread);
}


void
ags_task_thread_append_tasks(AgsTaskThread *task_thread, GList *list)
{
  AgsTaskThreadAppend *append;
  AgsThread *thread;

  g_message(tasks\0);

  append = (AgsTaskThreadAppend *) malloc(sizeof(AgsTaskThreadAppend));

  append-task_thread = task_thread;
  append-data = list;

  thread = ags_thread_pool_pull(task_thread-thread_pool);

  g_atomic_pointer_set((AGS_RETURNABLE_THREAD(thread)-safe_data),
   append);

  ags_thread_lock(thread);
  AGS_THREAD_GET_CLASS(thread)-run =
ags_task_thread_append_tasks_queue;
  ags_thread_lock(thread);

  ags_thread_start(thread);
}


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


concurrent GList

2014-03-27 Thread Joël Krähemann
Hi, is there a concurrent GList around? It should use of atomic
operations. My project probably has need for it.

Due to concurrency problems. I believe I get those errors cause of
unfinished operations. Since I'm working on performance.

Please visit my project:
http://sf.net/p/ags


regards
Joël


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


corrupted strings of GtkFileChooser by outputting with libxml2

2014-05-08 Thread Joël Krähemann
Why do I get corrupted strings of GtkFileChooser when using it with
libxml2.

please take a look at sf.net/p/ags

 ==22743== 1 errors in context 1 of 15:
 ==22743== Invalid read of size 8
 ==22743==at 0x3EE9E89DEF: __GI_mempcpy (in /usr/lib64/libc-2.17.so)
 ==22743==by 0x3EE9E79408: _IO_default_xsputn (in /usr/lib64/libc-2.17.so)
 ==22743==by 0x3EE9E48DB1: vfprintf (in /usr/lib64/libc-2.17.so)
 ==22743==by 0x3EE9F0D024: __vasprintf_chk (in /usr/lib64/libc-2.17.so)
 ==22743==by 0x3EEBE8694B: g_vasprintf (in 
 /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EEBE64C6F: g_strdup_vprintf (in 
 /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EEBE64D0B: g_strdup_printf (in 
 /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x443A5D: ags_file_write_file_link (ags_file_util.c:1240)
 ==22743==by 0x445CD0: ags_file_write_input (ags_file_sound.c:1526)
 ==22743==by 0x44C8A1: ags_file_write_channel (ags_file_sound.c:1352)
 ==22743==by 0x44CF9D: ags_file_write_audio (ags_file_sound.c:904)
 ==22743==by 0x44D10F: ags_file_write_audio_list (ags_file_sound.c:1030)
 ==22743==  Address 0x1d208340 is 32 bytes inside a block of size 64 free'd
 ==22743==at 0x4A074C4: free (in 
 /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 ==22743==by 0x3EEBE4D93E: g_free (in /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EED6D9B2D: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
 ==22743==by 0x3EF9AFA024: ??? (in /usr/lib64/libgtk-x11-2.0.so.0.2400.22)
 ==22743==by 0x3EED6492C6: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
 ==22743==by 0x3EED6778BA: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
 ==22743==by 0x3EED6778D8: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
 ==22743==by 0x3EEBE47DC5: g_main_context_dispatch (in 
 /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EEBE48117: ??? (in /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EEBE48519: g_main_loop_run (in 
 /usr/lib64/libglib-2.0.so.0.3600.4)
 ==22743==by 0x3EF9ABF58D: gtk_dialog_run (in 
 /usr/lib64/libgtk-x11-2.0.so.0.2400.22)
 ==22743==by 0x498043: ags_menu_bar_save_as_callback 
 (ags_menu_bar_callbacks.c:162)

regards


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


Re: GtkPaned: visible handle?

2014-05-08 Thread Joël Krähemann
May be theme dependend? Try another one.

Am Mittwoch, den 02.04.2014, 12:13 +0200 schrieb Roland Koebler:
 Hi,
 
 according to the documentation (and the image on
 https://developer.gnome.org/gtk3/stable/GtkPaned.html),
 GtkPaned-widgets have a visible handle (e.g. 4 dots)
 to show that the user can drag this handle.
 
 Unfortunately, these handles are invisible here -- both
 in Glade and in the running program. Is there any way
 to make them visible?
 
 thanks,
 Roland
 ___
 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: corrupted strings of GtkFileChooser by outputting with libxml2

2014-05-09 Thread Joël Krähemann
As I'm trying to use gtk_file_chooser_get_filenames_utf8 instead of
gtk_file_chooser_get_filenames getting the linker error during compile
time. This could be the root cause.
 
Am Freitag, den 09.05.2014, 07:11 +0200 schrieb Joël Krähemann:
 Why do I get corrupted strings of GtkFileChooser when using it with
 libxml2.
 
 please take a look at sf.net/p/ags
 
  ==22743== 1 errors in context 1 of 15:
  ==22743== Invalid read of size 8
  ==22743==at 0x3EE9E89DEF: __GI_mempcpy (in /usr/lib64/libc-2.17.so)
  ==22743==by 0x3EE9E79408: _IO_default_xsputn (in 
  /usr/lib64/libc-2.17.so)
  ==22743==by 0x3EE9E48DB1: vfprintf (in /usr/lib64/libc-2.17.so)
  ==22743==by 0x3EE9F0D024: __vasprintf_chk (in /usr/lib64/libc-2.17.so)
  ==22743==by 0x3EEBE8694B: g_vasprintf (in 
  /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EEBE64C6F: g_strdup_vprintf (in 
  /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EEBE64D0B: g_strdup_printf (in 
  /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x443A5D: ags_file_write_file_link (ags_file_util.c:1240)
  ==22743==by 0x445CD0: ags_file_write_input (ags_file_sound.c:1526)
  ==22743==by 0x44C8A1: ags_file_write_channel (ags_file_sound.c:1352)
  ==22743==by 0x44CF9D: ags_file_write_audio (ags_file_sound.c:904)
  ==22743==by 0x44D10F: ags_file_write_audio_list (ags_file_sound.c:1030)
  ==22743==  Address 0x1d208340 is 32 bytes inside a block of size 64 free'd
  ==22743==at 0x4A074C4: free (in 
  /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==22743==by 0x3EEBE4D93E: g_free (in /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EED6D9B2D: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
  ==22743==by 0x3EF9AFA024: ??? (in 
  /usr/lib64/libgtk-x11-2.0.so.0.2400.22)
  ==22743==by 0x3EED6492C6: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
  ==22743==by 0x3EED6778BA: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
  ==22743==by 0x3EED6778D8: ??? (in /usr/lib64/libgio-2.0.so.0.3600.4)
  ==22743==by 0x3EEBE47DC5: g_main_context_dispatch (in 
  /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EEBE48117: ??? (in /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EEBE48519: g_main_loop_run (in 
  /usr/lib64/libglib-2.0.so.0.3600.4)
  ==22743==by 0x3EF9ABF58D: gtk_dialog_run (in 
  /usr/lib64/libgtk-x11-2.0.so.0.2400.22)
  ==22743==by 0x498043: ags_menu_bar_save_as_callback 
  (ags_menu_bar_callbacks.c:162)
 
 regards
 
 
 ___
 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

Unexpected error during malloc

2014-08-16 Thread Joël Krähemann
Hi, what could cause the following error:

GLib (gthread-posix.c): Unexpected error from C library during 'malloc':
Resource temporarily unavailable.  Aborting.
Abgebrochen

please take a look at http://sf.net/p/ags
You have to checkout from subversion in order to get error message. This
doesn't happen as running by root.


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


Re: GTK application scene drawing

2014-08-16 Thread Joël Krähemann
This example does off-screen rendering:

http://doc-weedlight.rhcloud.com/tutorial/c-programming/book.html#idm248419471440


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


RE: Unexpected error during malloc

2014-08-17 Thread Joël Krähemann
Seems to be debian specific and as uncommenting some lines in main
function it runs as expected.

best regards
Joël


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

no-digest

2014-09-18 Thread Joël Krähemann


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


volume meter widget causes crash

2014-09-20 Thread Joël Krähemann
Why do I get the following error:

**
Gdk:ERROR:/tmp/buildd/gtk
+2.0-2.24.10/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed:
(y1  y2)
Abgebrochen

please take a look at:
https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/audio/recall/ags_peak_channel.c
https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/widget/ags_vindicator.c



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


Re: volume meter widget causes crash

2014-09-21 Thread Joël Krähemann
Am Samstag, den 20.09.2014, 14:54 +0200 schrieb Joël Krähemann:
 Why do I get the following error:
 
 **
 Gdk:ERROR:/tmp/buildd/gtk
 +2.0-2.24.10/gdk/gdkregion-generic.c:1110:miUnionNonO: assertion failed:
 (y1  y2)
 Abgebrochen
 
 please take a look at:
 https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/audio/recall/ags_peak_channel.c
 https://sourceforge.net/p/ags/code/HEAD/tree/src/ags/widget/ags_vindicator.c
 
 
 

Excuse me for waisting your time but I really believe it's caused by
concurrent access.

Joël


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

Gtk+-2.0 leaks memory

2014-10-24 Thread Joël Krähemann
Hi

Gtk+-2.0 leaks memory, please take a look at: http://ags.sourceforge.net

Is Gtk+-2.0 still maintained? Or is migrating to Gtk+-3.0 the only
choice? Or may someone could explain me what's wrong about:

AgsAudioLoop *audio_loop;
AgsGuiThread *gui_thread;

auto void ags_gui_thread_do_gtk_iteration();

void ags_gui_thread_do_gtk_iteration(){
  if(!g_main_context_acquire(main_context)){
gboolean got_ownership = FALSE;

while(!got_ownership){
  got_ownership = g_main_context_wait(main_context,
  (gui_thread-cond),
  (gui_thread-mutex));
}
  }

  /*  */
  gdk_threads_enter();
  gdk_threads_leave();

  g_main_context_iteration(main_context, FALSE);
  g_main_context_release(main_context);
}

gui_thread = AGS_GUI_THREAD(thread);

/*  */
main_context = g_main_context_default();

ags_gui_thread_do_gtk_iteration();


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


Re: Gtk+-2.0 leaks memory

2014-10-25 Thread Joël Krähemann
Am Freitag, den 24.10.2014, 23:16 +0200 schrieb Marcus Karlsson:
 On Fri, Oct 24, 2014 at 04:02:01PM +0200, Joël Krähemann wrote:
  Hi
 
 Hi.
 
  Gtk+-2.0 leaks memory, please take a look at: http://ags.sourceforge.net
  
  Is Gtk+-2.0 still maintained?
 
 Yes it is. The latest point release happened just two weeks ago.
 
  Or is migrating to Gtk+-3.0 the only choice? Or may someone could
  explain me what's wrong about:
  
  AgsAudioLoop *audio_loop;
  AgsGuiThread *gui_thread;
  
  auto void ags_gui_thread_do_gtk_iteration();
  
  void ags_gui_thread_do_gtk_iteration(){
if(!g_main_context_acquire(main_context)){
  gboolean got_ownership = FALSE;
  
  while(!got_ownership){
got_ownership = g_main_context_wait(main_context,
(gui_thread-cond),
(gui_thread-mutex));
  }
}
  
/*  */
gdk_threads_enter();
gdk_threads_leave();
  
g_main_context_iteration(main_context, FALSE);
g_main_context_release(main_context);
  }
  
  gui_thread = AGS_GUI_THREAD(thread);
  
  /*  */
  main_context = g_main_context_default();
  
  ags_gui_thread_do_gtk_iteration();
 
 Can you explain what the problem is and why you think that GTK+ leaks
 memory? It's not apparent from the code snippet alone what you're having
 problem with.
 
   Marcus

Hi, the problematic part of my application is probably there's no
GMainLoop ...
How ever recent subversion tree uses GMainLoop and AgsGuiThread has a
GThread. 

But I get the following errors:

Gdk:ERROR:/tmp/buildd/gtk
+2.0-2.24.10/gdk/gdkregion-generic.c:1306:miSubtractNonO1: assertion
failed: (y1y2)

or

Gdk:ERROR:/tmp/buildd/gtk
+2.0-2.24.10/gdk/gdkregion-generic.c:1189:miUnionO: assertion failed:
(pNextRect[-1].x1pNextRect[-1].x2)

or something like:

*** glibc detected *** ./ags: invalid fastbin entry (free):
0x02872350 ***
=== Backtrace: =
/lib/x86_64-linux-gnu/libc.so.6(+0x76a16)[0x7f230b3e5a16]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f230b3ea7bc]
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_region_destroy
+0x1b)[0x7f230cfdac5b]
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3f9b8)[0x7f230cfe49b8]
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3fc83)[0x7f230cfe4c83]
/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0xccf99)[0x7f230d324f99]
/usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x20327)[0x7f230cfc5327]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch
+0x135)[0x7f230e408355]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4a688)[0x7f230e408688]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run
+0x72)[0x7f230e408a82]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x118db)[0x7f230e92e8db]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
+0x6f6)[0x7f230e947006]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
+0x82)[0x7f230e947852]
./ags(ags_thread_start+0x86)[0x4dfac6]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x119a7)[0x7f230e92e9a7]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
+0x6f6)[0x7f230e947006]
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
+0x82)[0x7f230e947852]
./ags(ags_thread_start+0x86)[0x4dfac6]
./ags(main+0x396)[0x44ea56]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f230b38dead]
./ags[0x44eca9]


regards
Joël


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

Re: Gtk+-2.0 leaks memory

2014-10-25 Thread Joël Krähemann
Am Samstag, den 25.10.2014, 11:07 +0200 schrieb Joël Krähemann:
 Am Freitag, den 24.10.2014, 23:16 +0200 schrieb Marcus Karlsson:
  On Fri, Oct 24, 2014 at 04:02:01PM +0200, Joël Krähemann wrote:
   Hi
  
  Hi.
  
   Gtk+-2.0 leaks memory, please take a look at: http://ags.sourceforge.net
   
   Is Gtk+-2.0 still maintained?
  
  Yes it is. The latest point release happened just two weeks ago.
  
   Or is migrating to Gtk+-3.0 the only choice? Or may someone could
   explain me what's wrong about:
   
   AgsAudioLoop *audio_loop;
   AgsGuiThread *gui_thread;
   
   auto void ags_gui_thread_do_gtk_iteration();
   
   void ags_gui_thread_do_gtk_iteration(){
 if(!g_main_context_acquire(main_context)){
   gboolean got_ownership = FALSE;
   
   while(!got_ownership){
 got_ownership = g_main_context_wait(main_context,
 (gui_thread-cond),
 (gui_thread-mutex));
   }
 }
   
 /*  */
 gdk_threads_enter();
 gdk_threads_leave();
   
 g_main_context_iteration(main_context, FALSE);
 g_main_context_release(main_context);
   }
   
   gui_thread = AGS_GUI_THREAD(thread);
   
   /*  */
   main_context = g_main_context_default();
   
   ags_gui_thread_do_gtk_iteration();
  
  Can you explain what the problem is and why you think that GTK+ leaks
  memory? It's not apparent from the code snippet alone what you're having
  problem with.
  
  Marcus
 
 Hi, the problematic part of my application is probably there's no
 GMainLoop ...
 How ever recent subversion tree uses GMainLoop and AgsGuiThread has a
 GThread. 
 
 But I get the following errors:
 
 Gdk:ERROR:/tmp/buildd/gtk
 +2.0-2.24.10/gdk/gdkregion-generic.c:1306:miSubtractNonO1: assertion
 failed: (y1y2)
 
 or
 
 Gdk:ERROR:/tmp/buildd/gtk
 +2.0-2.24.10/gdk/gdkregion-generic.c:1189:miUnionO: assertion failed:
 (pNextRect[-1].x1pNextRect[-1].x2)
 
 or something like:
 
 *** glibc detected *** ./ags: invalid fastbin entry (free):
 0x02872350 ***
 === Backtrace: =
 /lib/x86_64-linux-gnu/libc.so.6(+0x76a16)[0x7f230b3e5a16]
 /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f230b3ea7bc]
 /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_region_destroy
 +0x1b)[0x7f230cfdac5b]
 /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3f9b8)[0x7f230cfe49b8]
 /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3fc83)[0x7f230cfe4c83]
 /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0xccf99)[0x7f230d324f99]
 /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x20327)[0x7f230cfc5327]
 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch
 +0x135)[0x7f230e408355]
 /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4a688)[0x7f230e408688]
 /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run
 +0x72)[0x7f230e408a82]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x118db)[0x7f230e92e8db]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
 +0x6f6)[0x7f230e947006]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
 +0x82)[0x7f230e947852]
 ./ags(ags_thread_start+0x86)[0x4dfac6]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x119a7)[0x7f230e92e9a7]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
 +0x6f6)[0x7f230e947006]
 /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
 +0x82)[0x7f230e947852]
 ./ags(ags_thread_start+0x86)[0x4dfac6]
 ./ags(main+0x396)[0x44ea56]
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f230b38dead]
 ./ags[0x44eca9]
 
 
 regards
 Joël
 
 

Someone implementing g_main_context_get_owner() would be great.


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

Re: Gtk+-2.0 leaks memory

2014-10-25 Thread Joël Krähemann
Am Samstag, den 25.10.2014, 11:40 +0200 schrieb Joël Krähemann:
 Am Samstag, den 25.10.2014, 11:07 +0200 schrieb Joël Krähemann:
  Am Freitag, den 24.10.2014, 23:16 +0200 schrieb Marcus Karlsson:
   On Fri, Oct 24, 2014 at 04:02:01PM +0200, Joël Krähemann wrote:
Hi
   
   Hi.
   
Gtk+-2.0 leaks memory, please take a look at: http://ags.sourceforge.net

Is Gtk+-2.0 still maintained?
   
   Yes it is. The latest point release happened just two weeks ago.
   
Or is migrating to Gtk+-3.0 the only choice? Or may someone could
explain me what's wrong about:

AgsAudioLoop *audio_loop;
AgsGuiThread *gui_thread;

auto void ags_gui_thread_do_gtk_iteration();

void ags_gui_thread_do_gtk_iteration(){
  if(!g_main_context_acquire(main_context)){
gboolean got_ownership = FALSE;

while(!got_ownership){
  got_ownership = g_main_context_wait(main_context,
  (gui_thread-cond),
  (gui_thread-mutex));
}
  }

  /*  */
  gdk_threads_enter();
  gdk_threads_leave();

  g_main_context_iteration(main_context, FALSE);
  g_main_context_release(main_context);
}

gui_thread = AGS_GUI_THREAD(thread);

/*  */
main_context = g_main_context_default();

ags_gui_thread_do_gtk_iteration();
   
   Can you explain what the problem is and why you think that GTK+ leaks
   memory? It's not apparent from the code snippet alone what you're having
   problem with.
   
 Marcus
  
  Hi, the problematic part of my application is probably there's no
  GMainLoop ...
  How ever recent subversion tree uses GMainLoop and AgsGuiThread has a
  GThread. 
  
  But I get the following errors:
  
  Gdk:ERROR:/tmp/buildd/gtk
  +2.0-2.24.10/gdk/gdkregion-generic.c:1306:miSubtractNonO1: assertion
  failed: (y1y2)
  
  or
  
  Gdk:ERROR:/tmp/buildd/gtk
  +2.0-2.24.10/gdk/gdkregion-generic.c:1189:miUnionO: assertion failed:
  (pNextRect[-1].x1pNextRect[-1].x2)
  
  or something like:
  
  *** glibc detected *** ./ags: invalid fastbin entry (free):
  0x02872350 ***
  === Backtrace: =
  /lib/x86_64-linux-gnu/libc.so.6(+0x76a16)[0x7f230b3e5a16]
  /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f230b3ea7bc]
  /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(gdk_region_destroy
  +0x1b)[0x7f230cfdac5b]
  /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3f9b8)[0x7f230cfe49b8]
  /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x3fc83)[0x7f230cfe4c83]
  /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0(+0xccf99)[0x7f230d324f99]
  /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0(+0x20327)[0x7f230cfc5327]
  /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch
  +0x135)[0x7f230e408355]
  /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4a688)[0x7f230e408688]
  /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run
  +0x72)[0x7f230e408a82]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x118db)[0x7f230e92e8db]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
  +0x6f6)[0x7f230e947006]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
  +0x82)[0x7f230e947852]
  ./ags(ags_thread_start+0x86)[0x4dfac6]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(+0x119a7)[0x7f230e92e9a7]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist
  +0x6f6)[0x7f230e947006]
  /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit
  +0x82)[0x7f230e947852]
  ./ags(ags_thread_start+0x86)[0x4dfac6]
  ./ags(main+0x396)[0x44ea56]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f230b38dead]
  ./ags[0x44eca9]
  
  
  regards
  Joël
  
  
 
 Someone implementing g_main_context_get_owner() would be great.
 

No need for it ...

I'm just freeing stack pointer of AgsReturnableThread further there was
a leak while calculating ags-peak. For now all was fixed but you may
experience GNU/Linux hanging up.




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

Advanced Gtk+ Sequencer 0.4.2-34

2015-01-17 Thread Joël Krähemann
Hi all

This probably the highest moment in my life, me just have to say you're
great! And thank you very much for your passion. It's definitively a
collaboration success, even me coded most myself ...

Some code was adopted by gimp further this mailing list helped me and
strengthen my motivation, please have a look at:

http://ags.sf.net

Especially the API documentation needs to be updated, I would look
forward to get help on you in testing and hardening the API

best regards
Joël


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

undefined reference to interface

2015-03-26 Thread Joël Krähemann
hi, me just did a new Makefile.am and organizing code into libraries.

now me get a lot of following messages especially related to interfaces:

...
/home/minos/ags-code/src/ags/audio/recall/ags_volume_recycling.c:101:
undefined reference to `ags_dynamic_connectable_get_type'
libags_audio.a(libags_audio_a-ags_buffer_audio_signal.o): In function
`ags_buffer_audio_signal_get_type':
/home/minos/ags-code/src/ags/audio/recall/ags_buffer_audio_signal.c:110:
undefined reference to `ags_dynamic_connectable_get_type'
libags_audio.a(libags_audio_a-ags_copy_audio_signal.o): In function
`ags_copy_audio_signal_get_type':
/home/minos/ags-code/src/ags/audio/recall/ags_copy_audio_signal.c:112:
undefined reference to `ags_dynamic_connectable_get_type'
libags_audio.a(libags_audio_a-ags_volume_audio_signal.o): In function
`ags_volume_audio_signal_get_type':
/home/minos/ags-code/src/ags/audio/recall/ags_volume_audio_signal.c:114:
undefined reference to `ags_dynamic_connectable_get_type'

The interface was compiled but somehow linker can't find appropriate
interface's get_type

Visit my project on: http://ags.sf.net

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

Re: undefined reference to interface

2015-03-26 Thread Joël Krähemann
Hello again, me fixed it by using different ordering, for now is:

gsequencer_LDADD = libags_audio.a libags_gui.a libags_thread.a libags.a

instead of:

gsequencer_LDADD = libags.a libags_thread.a libags_audio.a libags_gui.a


bests
Joël


On Thu, Mar 26, 2015 at 4:29 PM, Joël Krähemann weedli...@gmail.com wrote:
 hi, me just did a new Makefile.am and organizing code into libraries.

 now me get a lot of following messages especially related to interfaces:

 ...
 /home/minos/ags-code/src/ags/audio/recall/ags_volume_recycling.c:101:
 undefined reference to `ags_dynamic_connectable_get_type'
 libags_audio.a(libags_audio_a-ags_buffer_audio_signal.o): In function
 `ags_buffer_audio_signal_get_type':
 /home/minos/ags-code/src/ags/audio/recall/ags_buffer_audio_signal.c:110:
 undefined reference to `ags_dynamic_connectable_get_type'
 libags_audio.a(libags_audio_a-ags_copy_audio_signal.o): In function
 `ags_copy_audio_signal_get_type':
 /home/minos/ags-code/src/ags/audio/recall/ags_copy_audio_signal.c:112:
 undefined reference to `ags_dynamic_connectable_get_type'
 libags_audio.a(libags_audio_a-ags_volume_audio_signal.o): In function
 `ags_volume_audio_signal_get_type':
 /home/minos/ags-code/src/ags/audio/recall/ags_volume_audio_signal.c:114:
 undefined reference to `ags_dynamic_connectable_get_type'

 The interface was compiled but somehow linker can't find appropriate
 interface's get_type

 Visit my project on: http://ags.sf.net

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

Re: gtk-app-devel-list Digest, Vol 140, Issue 4

2015-12-11 Thread Joël Krähemann
Hi Friedrich

Doesn't the property work for you?

g_object_set(var_sheet, "activate-on-single-click", TRUE, NULL);

cheers,
Joël

On Fri, Dec 11, 2015 at 9:29 PM, Friedrich Beckmann
<friedrich.beckm...@gmx.de> wrote:
> Hi Joel,
>
> thanks for the answer. I guess this is not a race condition. What I want to
> achieve
> is to edit cells as in a spreadsheet. That means
>
> A single click starts the editing mode
>
> With gtktreeview I need a first click to select the cell and a second click
> to start editing. Do you
> maybe imagine a way how the editing could be started with a single click?
> The code is here:
>
> http://git.savannah.gnu.org/cgit/pspp.git/tree/src/ui/gui/psppire-var-sheet.c?h=treeview
>
> Friedrich
>
>
> Am 11.12.2015 um 18:26 schrieb Joël Krähemann <weedli...@gmail.com>:
>
> Hi Friedrich, try to stay on objectives. Do you use an IPC mechanism,
> or is it a separate thread?
> A callback is called by g_main_context_iteration() of gtk_main() it's
> polled some how.
> More code would be great and better information about it.
>
> If it's a multi-threaded issue you might want to take a look at GMutex
> and GCond.
> With g_mutex_lock() and g_mutex_unlock() you're normally well served.
>
> Bests,
> Joël Krähemann
>
>
>
>
>
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk-app-devel-list Digest, Vol 140, Issue 4

2015-12-11 Thread Joël Krähemann
Hi Friedrich, try to stay on objectives. Do you use an IPC mechanism,
or is it a separate thread?
A callback is called by g_main_context_iteration() of gtk_main() it's
polled some how.
More code would be great and better information about it.

If it's a multi-threaded issue you might want to take a look at GMutex
and GCond.
With g_mutex_lock() and g_mutex_unlock() you're normally well served.

Bests,
Joël Krähemann


On Thu, Dec 10, 2015 at 1:00 PM,  <gtk-app-devel-list-requ...@gnome.org> wrote:
> Send gtk-app-devel-list mailing list submissions to
> gtk-app-devel-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> or, via email, send a message with subject or body 'help' to
> gtk-app-devel-list-requ...@gnome.org
>
> You can reach the person managing the list at
> gtk-app-devel-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtk-app-devel-list digest..."
>
>
> Today's Topics:
>
>1. GtkTreeView - Conflict between one click editing and
>   selection (Friedrich Beckmann)
>
>
> --
>
> Message: 1
> Date: Wed, 9 Dec 2015 22:22:50 +0100
> From: Friedrich Beckmann <friedrich.beckm...@gmx.de>
> To: gtk-app-devel-list@gnome.org
> Subject: GtkTreeView - Conflict between one click editing and
> selection
> Message-ID: <f0d47fdf-5a6b-4372-9936-2da306f0a...@gmx.de>
> Content-Type: text/plain;   charset=us-ascii
>
> Hi,
>
> i am working on an application which uses GtkTreeView. I tried to start 
> editing the cells with one click by setting the focus of the cell in the 
> row-activated callback like this:
>
> static void
> on_row_activated (GtkTreeView *treeview,
>   GtkTreePath *path,
>   GtkTreeViewColumn *column,
>   PsppireVarSheet *var_sheet)
> {
> gtk_tree_view_set_cursor (treeview, path, column, TRUE);
> }
>
> However, this interferes with the selection process because the row-activated 
> is signalled which will start the editing mode when I start the rubber band. 
> Is there a way to start editing in a spreadsheet like way with just one click 
> without interfering with the selection process? A video of the application 
> without single click as mentioned above is here: https://youtu.be/4xS0Beb0Gdo
>
> Friedrich
>
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> --
>
> End of gtk-app-devel-list Digest, Vol 140, Issue 4
> **
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

gtkdoc-scan make interfaces public

2016-06-01 Thread Joël Krähemann
Hi

I want to generate an API reference of my libraries. How to tell
gtkdoc-scan to make interfaces public? Currently interfaces don't have
cross references. I figured out how I can modify gtkdoc-scan to do
include it but isn't a satisfiable solution.

https://github.com/gsequencer/gsequencer

Bests,
Joël Krähemann
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk-app-devel-list Digest, Vol 148, Issue 7

2016-08-14 Thread Joël Krähemann
Hi

Why don't you inherit GtkApplication and override its functions? You
could interfaces to get what object you need.

Bests,
Joël


On Sun, Aug 14, 2016 at 12:00 PM,   wrote:
> Send gtk-app-devel-list mailing list submissions to
> gtk-app-devel-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> or, via email, send a message with subject or body 'help' to
> gtk-app-devel-list-requ...@gnome.org
>
> You can reach the person managing the list at
> gtk-app-devel-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtk-app-devel-list digest..."
>
>
> Today's Topics:
>
>1. Re: GtkApplication with different ApplicationWindows
>   (Victor Aur?lio Santos)
>2. Re: GtkApplication with different ApplicationWindows
>   (zahlenm...@gmx.de)
>
>
> --
>
> Message: 1
> Date: Sat, 13 Aug 2016 09:14:46 -0300
> From: Victor Aur?lio Santos 
> To: zahlenm...@gmx.de
> Cc: gtk-app-devel-list list 
> Subject: Re: GtkApplication with different ApplicationWindows
> Message-ID:
> 

Re: How to reactivate (focus?) the main window,

2016-09-05 Thread Joël Krähemann
Hi

you might want to look at:

* gtk_widget_set_can_focus ()¨
* gtk_widget_set_events()


g_object_set(window,
   "can-focus\0", TRUE,
   NULL);
gtk_widget_set_events((GtkWidget *) window,
  GDK_CONTROL_MASK
  | GDK_KEY_PRESS_MASK
  | GDK_KEY_RELEASE_MASK)

...

g_signal_connect_after(G_OBJECT(window), "focus_in_event\0",

G_CALLBACK(your_window_box_focus_in_callback), (gpointer) window);

g_signal_connect_after(G_OBJECT(window), "focus_out_event\0",

G_CALLBACK(your_window_box_focus_out_callback), (gpointer) window);

...

gtk_widget_set_state((GtkWidget *) window,
 GTK_STATE_ACTIVE);

That's it.

bests,
Joël

On Mon, Sep 5, 2016 at 2:57 PM, Paulo Silva  wrote:
> I don't now if I understood correctly your problem.
> Maybe this:
>
> gtk_window_present( GTK_WINDOW(ptr_to_your_window) );
>
> José Paulo
>
>
> 2016-09-04 13:58 GMT-03:00 dmg :
>
>> On Sun, Sep 4, 2016 at 9:57 AM, dmg  wrote:
>>
>> >
>> > I have tried using   gtk_window_set_focus(winMain); but this does not
>> work.
>> >
>>
>> My mistake. I have used:
>>
>> gtk_widget_grab_focus(winMain);
>>
>> and it does not work.
>>
>>
>>
>>
>> --
>> --dmg
>>
>> ---
>> Daniel M. German
>> http://turingmachine.org
>> ___
>> 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
___
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 get objecttype

2016-09-11 Thread Joël Krähemann
Hi

You might want to use G_OBJECT_TYPE() or G_OBJECT_TYPE_NAME() take care
that the appriopriate get_type() function is called else the type
won't be found.

GType button_type;

gtk_button_get_type()
button_type = g_type_from_name("GtkButton");

g_object_new(button_type,
 "label", "my button",
  NULL);

Bests,
Joël


On Sun, Sep 11, 2016 at 3:30 PM, Richard Shann  wrote:
>
>> On Fri, Sep 9, 2016 at 9:14 AM Thomas R?nshof  wrote:
>>
>> > Hi,
>> >
>> > We are converting some OLD COBOL applications to GTK.
>> > The XML is created dynamically from SCREEN SECTIONS and we then use
>> > gtk_builder to get the objects into the program.
>> >
>> > Is there a way to get the objecttype ?
>> > If it's a gtk-combo we do this, if it's a gtk-entry we do that in the
>> > program and so on...
>
> In GNU-Denemo I use
>
>  g_type_name (G_TYPE_FROM_INSTANCE (widget))
>
> Richard Shann
>
>
> ___
> 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 reactivate (focus?) the main window,

2016-09-08 Thread Joël Krähemann
Hi

If your application should get being accepted you should consider ATK

https://developer.gnome.org/atk/

else forget the focus handling

cheers,
Joël Krähemann

On Mon, Sep 5, 2016 at 3:25 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi
>
> you might want to look at:
>
> * gtk_widget_set_can_focus ()¨
> * gtk_widget_set_events()
>
>
> g_object_set(window,
>"can-focus\0", TRUE,
>NULL);
> gtk_widget_set_events((GtkWidget *) window,
>   GDK_CONTROL_MASK
>   | GDK_KEY_PRESS_MASK
>   | GDK_KEY_RELEASE_MASK)
>
> ...
>
> g_signal_connect_after(G_OBJECT(window), "focus_in_event\0",
>
> G_CALLBACK(your_window_box_focus_in_callback), (gpointer) window);
>
> g_signal_connect_after(G_OBJECT(window), "focus_out_event\0",
>
> G_CALLBACK(your_window_box_focus_out_callback), (gpointer) window);
>
> ...
>
> gtk_widget_set_state((GtkWidget *) window,
>  GTK_STATE_ACTIVE);
>
> That's it.
>
> bests,
> Joël
>
> On Mon, Sep 5, 2016 at 2:57 PM, Paulo Silva <pa...@sistemasolar.com.br> wrote:
>> I don't now if I understood correctly your problem.
>> Maybe this:
>>
>> gtk_window_present( GTK_WINDOW(ptr_to_your_window) );
>>
>> José Paulo
>>
>>
>> 2016-09-04 13:58 GMT-03:00 dmg <d...@uvic.ca>:
>>
>>> On Sun, Sep 4, 2016 at 9:57 AM, dmg <d...@uvic.ca> wrote:
>>>
>>> >
>>> > I have tried using   gtk_window_set_focus(winMain); but this does not
>>> work.
>>> >
>>>
>>> My mistake. I have used:
>>>
>>> gtk_widget_grab_focus(winMain);
>>>
>>> and it does not work.
>>>
>>>
>>>
>>>
>>> --
>>> --dmg
>>>
>>> ---
>>> Daniel M. German
>>> http://turingmachine.org
>>> ___
>>> 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
___
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 Joël Krähemann
Hi

You can't do that without implementing your own widget because of
thread-safety issues. To do your own
GtkFlowBox implement GtkWidget:size-allocate and
GtkWidget:size-request the rest is up to you.

Don't forget doing mutices or use g_timeout_add() but this is single
threaded and is invoked by
g_main_context_iteration().

For a simple example consider this:

http://git.savannah.gnu.org/cgit/gsequencer.git/tree/ags/X/editor/ags_notebook.c?h=0.7.x#n167

It is a scrolled window containing buttons doing a scrollable area.

You have to use gdk_threads_enter() and gdk_threads_leave(). Might be
you have even to acquire
the GMainContext.

Bests,
Joël



On Mon, Sep 12, 2016 at 5:03 PM, Gergely Polonkai  wrote:
> 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
___
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 Joël Krähemann
Hi

Since I know Javax/Swing I can tell you there is no synchronize
keyword doing your magic.

Please take a look at pthread_mutex_lock(), pthread_cond_wait(),
pthread_cond_signal(), pthread_cond_broadcast()
or pthread_barrier_wait().

Bests,
Joël


On Mon, Sep 12, 2016 at 5:17 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi
>
> You can't do that without implementing your own widget because of
> thread-safety issues. To do your own
> GtkFlowBox implement GtkWidget:size-allocate and
> GtkWidget:size-request the rest is up to you.
>
> Don't forget doing mutices or use g_timeout_add() but this is single
> threaded and is invoked by
> g_main_context_iteration().
>
> For a simple example consider this:
>
> http://git.savannah.gnu.org/cgit/gsequencer.git/tree/ags/X/editor/ags_notebook.c?h=0.7.x#n167
>
> It is a scrolled window containing buttons doing a scrollable area.
>
> You have to use gdk_threads_enter() and gdk_threads_leave(). Might be
> you have even to acquire
> the GMainContext.
>
> Bests,
> Joël
>
>
>
> On Mon, Sep 12, 2016 at 5:03 PM, Gergely Polonkai <gerg...@polonkai.eu> wrote:
>> 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. <danielhi...@gmail.com> 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
___
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 Joël Krähemann
Hi again

Don't mess synchronized with a mutex. The closest thing to
synchronized would be ags_task_thread_append_task()
and run things exclusively

http://git.savannah.gnu.org/cgit/gsequencer.git/tree/ags/thread/ags_task_thread.h?h=0.7.x

bests,
Joël



On Mon, Sep 12, 2016 at 5:50 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi
>
> Since I know Javax/Swing I can tell you there is no synchronize
> keyword doing your magic.
>
> Please take a look at pthread_mutex_lock(), pthread_cond_wait(),
> pthread_cond_signal(), pthread_cond_broadcast()
> or pthread_barrier_wait().
>
> Bests,
> Joël
>
>
> On Mon, Sep 12, 2016 at 5:17 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
>> Hi
>>
>> You can't do that without implementing your own widget because of
>> thread-safety issues. To do your own
>> GtkFlowBox implement GtkWidget:size-allocate and
>> GtkWidget:size-request the rest is up to you.
>>
>> Don't forget doing mutices or use g_timeout_add() but this is single
>> threaded and is invoked by
>> g_main_context_iteration().
>>
>> For a simple example consider this:
>>
>> http://git.savannah.gnu.org/cgit/gsequencer.git/tree/ags/X/editor/ags_notebook.c?h=0.7.x#n167
>>
>> It is a scrolled window containing buttons doing a scrollable area.
>>
>> You have to use gdk_threads_enter() and gdk_threads_leave(). Might be
>> you have even to acquire
>> the GMainContext.
>>
>> Bests,
>> Joël
>>
>>
>>
>> On Mon, Sep 12, 2016 at 5:03 PM, Gergely Polonkai <gerg...@polonkai.eu> 
>> wrote:
>>> 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. <danielhi...@gmail.com> 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
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtkdoc-scan make interfaces public

2016-10-28 Thread Joël Krähemann
Hi all


I just substituted in libags-sections.txt the SUBSECTION from Standard to
Public and it gives me the desired result.


ags_applicable
AgsApplicable
AgsApplicableInterface
ags_applicable_set_update
ags_applicable_apply
ags_applicable_reset

AGS_TYPE_APPLICABLE
ags_applicable_get_type


Cheers,
Joël


On Mon, Sep 26, 2016 at 1:50 PM, Matthias Clasen <matthias.cla...@gmail.com>
wrote:

> On Wed, Jun 1, 2016 at 3:40 AM, Joël Krähemann <jkraehem...@gmail.com>
> wrote:
> > Hi
> >
> > I want to generate an API reference of my libraries. How to tell
> > gtkdoc-scan to make interfaces public? Currently interfaces don't have
> > cross references. I figured out how I can modify gtkdoc-scan to do
> > include it but isn't a satisfiable solution.
>
> What do you mean by cross references ?
>
> What is missing from e.g.
> https://developer.gnome.org/gtk3/stable/GtkAppChooser.html ?
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: g_date_time_format not utf8 under win?

2016-10-13 Thread Joël Krähemann
Hi

you might want to use before gtk_init():

  putenv("LC_ALL=C.UTF-8\0");
  putenv("LANG=C.UTF-8\0");

Bests,
Joël


On Tue, Oct 11, 2016 at 9:11 AM, Andrea Zagli  wrote:

> i use g_date_time_format %A to get the full weekday name
>
> but under win i saw that the function returns not an utf8 string but an
> iso-8859-1 (that i think is my win10 locale)
>
> is that a bug?
> ___
> 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: Why GTK+ ignore, that someone want's to create own widget ?!

2016-12-12 Thread Joël Krähemann
Hi

I think all gtk drawing primitives are deprecated. You should use cairo instead.

bests,
Joël


On Tue, Dec 13, 2016 at 7:37 AM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi Ondrej
>
> What about using GtkStyle?
>
> gtk_widget_get_style()
>
> Bests,
> Joël
>
>
> On Tue, Dec 13, 2016 at 6:33 AM, Ondrej Tuma <konfere...@webjet.cz> wrote:
>> At the moment, i just to get default widget border color. But, the
>> gtk_style_context_get_border_color is deprecated... and i should to use
>> gtk_render_frame. Please tell me how can i use gtk_render_frame to get
>> border color?! How?
>>
>> What GTK do is putting obstacles in the way of creating more complex
>> application. But yes, sometimes, we need special widgets, with special
>> using :-(
>>
>> --
>> Ondřej Tůma <mc...@zeropage.cz>
>> www: http://ipv6.mcbig.cz   jabber: mc...@jabber.cz   twitter: mcbig_cz
>>
>> ___
>> 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: Why GTK+ ignore, that someone want's to create own widget ?!

2016-12-12 Thread Joël Krähemann
Hi Ondrej

What about using GtkStyle?

gtk_widget_get_style()

Bests,
Joël


On Tue, Dec 13, 2016 at 6:33 AM, Ondrej Tuma  wrote:
> At the moment, i just to get default widget border color. But, the
> gtk_style_context_get_border_color is deprecated... and i should to use
> gtk_render_frame. Please tell me how can i use gtk_render_frame to get
> border color?! How?
>
> What GTK do is putting obstacles in the way of creating more complex
> application. But yes, sometimes, we need special widgets, with special
> using :-(
>
> --
> Ondřej Tůma 
> www: http://ipv6.mcbig.cz   jabber: mc...@jabber.cz   twitter: mcbig_cz
>
> ___
> 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: Why GTK+ ignore, that someone want's to create own widget ?!

2016-12-12 Thread Joël Krähemann
...

Further you might want to use GtkReliefStyle as doing borders.

cheers,
Joël


On Tue, Dec 13, 2016 at 7:39 AM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi
>
> I think all gtk drawing primitives are deprecated. You should use cairo 
> instead.
>
> bests,
> Joël
>
>
> On Tue, Dec 13, 2016 at 7:37 AM, Joël Krähemann <jkraehem...@gmail.com> wrote:
>> Hi Ondrej
>>
>> What about using GtkStyle?
>>
>> gtk_widget_get_style()
>>
>> Bests,
>> Joël
>>
>>
>> On Tue, Dec 13, 2016 at 6:33 AM, Ondrej Tuma <konfere...@webjet.cz> wrote:
>>> At the moment, i just to get default widget border color. But, the
>>> gtk_style_context_get_border_color is deprecated... and i should to use
>>> gtk_render_frame. Please tell me how can i use gtk_render_frame to get
>>> border color?! How?
>>>
>>> What GTK do is putting obstacles in the way of creating more complex
>>> application. But yes, sometimes, we need special widgets, with special
>>> using :-(
>>>
>>> --
>>> Ondřej Tůma <mc...@zeropage.cz>
>>> www: http://ipv6.mcbig.cz   jabber: mc...@jabber.cz   twitter: mcbig_cz
>>>
>>> ___
>>> 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: Re-drawing GtkDrawingArea surface on motion-notify-event

2017-03-21 Thread Joël Krähemann
Hi

If you do it using cairo you might be interested in the following function.

cairo_image_surface_get_data()

You get the pixels stored in your picture. It can be restored using memcpy()
what is actually quiet fast.

Bests,
Joël


On Tue, Mar 21, 2017 at 8:26 AM, F.Reiter  wrote:
> Hallo,
> for lightning-fast, xor, rubberbanding, zooming, clipping ..
> why not consider Open-GL ?
> Franz
> (https://github.com/gcad3d/gcad3d)
>
> ___
> 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: Best practise inheritance

2017-03-20 Thread Joël Krähemann
Hello Mr. Jacobi

What I personally like to see is doing events. It makes your OOP extensible.
And is the usual way how things are done in GUI programming.

But it is not limited to GUI. For instance this event is handled by a
GUI callback
to toggle a button.

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/audio/ags_audio.c#n781

Bests,
Joël



On Mon, Mar 20, 2017 at 6:37 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi
>
> You don't have to use myWidget->parent since you dereference the pointer.
> A pointer to a struct always points to the first field of the topmost
> nesting level.
>
> so it would be:
>
> gtk_widget_set_name(myWidget);
>
>
> Bests,
> Joël
>
>
>
> On Mon, Mar 20, 2017 at 6:29 PM, S. Jacobi <sjac...@mailueberfall.de> wrote:
>> On Mon, 20 Mar 2017 18:10:16 +0100
>> Joël Krähemann <jkraehem...@gmail.com> wrote:
>>
>>> Hi
>>>
>>> As Tristan told you. The struct contains the other struct as not using
>>> a pointer.
>>>
>>> struct MyCompositeWidget
>>> {
>>>   GtkAlignment alignment;
>>>
>>>   GtkBox *box;
>>> };
>>>
>> The parent-is-a-pointer mistake was just me not thinking when I wrote
>> the mail. If have seen it being done correctly everywhere. This makes
>> gtk_widget_set_name (myWidget->parent, "myWidget"); syntactically wrong
>> however.
>> ___
>> 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: Best practise inheritance

2017-03-20 Thread Joël Krähemann
Hi

No, you can talk in C of direct inheritance. Or implementing an interface.

As Tristan told you. The struct contains the other struct as not using
a pointer.

struct MyCompositeWidget
{
  GtkAlignment alignment;

  GtkBox *box;
};

The properties are inherited, too. As long you use
g_type_register_static() or alike
passing the parent type. You can peek the parent class.

It might hard to understand for you what has the meaning class. A
class has always
the very same methods. Else you have to subtype and override the class.

The class methods can chained up by using the peeked class.

GTK_WIDGET_CLASS(my_composite_widget_parent_class)->show(my_instance)

Note GLib-Object interfaces are limited to one nesting level of GTypeInterface.

So there is no interface inheritance.

I think it's a good point to do object orientated programming with C
because you have to
know what's going on.

Bests,
Joël


On Mon, Mar 20, 2017 at 5:15 PM, Tristan Van Berkom
 wrote:
> On Mon, 2017-03-20 at 16:36 +0100, S. Jacobi wrote:
>> First of all, inheritance may be the wrong word here in plain c, but
>> I
>> don't know how else to name it.
>
> Sorry replied to this from my phone and missed some things...
>
>> In different projects I see different approaches how to derive custom
>> widgets from existing ones. I can roughly group them into 2 to 3.
>>
>> 1) The header only has a typedef to make the struct opaque. All
>> variables needed are put into the struct in the .c file.
>>
>> myType.h
>> typedef struct _MyTypeMyType;
>>
>> myType.c
>> struct _MyType
>> {
>>   GtkWidget   *parent;
>>   /* additions */
>>   guinti;
>>   ...
>> };
>
> Note also that this approach imposes that absolutely nothing can derive
> from MyType later, because MyType becomes anonymous.
>
>>
>> 2a) The header defines a private struct, and all variables needed are
>> put into this private struct.
>>
>> myType.h
>> typedef struct _MyTypePriv MyTypePriv;
>> typedef struct _MyType   MyType;
>>
>> myType.c
>> struct _MyTypePriv
>> {
>>   GtkWidget   *parent;
>>   /* additions */
>>   guinti;
>> };
>>
>> struct _MyType
>> {
>>   MyTypePriv  *priv;
>> };
>
> Actually this approach (2a) I've never seen before, not a good idea,
> but possibly works (except for the other detail below)...
>
>
>> 2b) Similar to 2a, but the parent is put in the "main" struct, not
>> the
>> private part.
>>
>> myType.h
>> typedef struct _MyTypePriv MyTypePriv;
>> typedef struct _MyType   MyType;
>>
>> myType.c
>> struct _MyTypePriv
>> {
>>   /* additions */
>>   guinti;
>> };
>>
>> struct _MyType
>> {
>>   GtkWidget   *parent
>>   MyTypePriv  *priv;
>> };
>
> So in all of these cases, you have missed an important detail:
>
> struct _MyType {
> GtkWidget *parent_instance;
>
> ... anything else...
> }
>
> Is wrong, as it will only reserve one pointer size for the parent
> structure, what you have been seeing is always in fact:
>
> struct _MyType {
> GtkWidget parent_instance
>
> ... anything else ...
> }
>
> The parent instance must be known and not anonymous, you need to
> include the struct itself as the first member of your derived type, not
> merely a pointer to that.
>
> Cheers,
> -Tristan
>
> ___
> 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: Best practise inheritance

2017-03-20 Thread Joël Krähemann
Hi

You don't have to use myWidget->parent since you dereference the pointer.
A pointer to a struct always points to the first field of the topmost
nesting level.

so it would be:

gtk_widget_set_name(myWidget);


Bests,
Joël



On Mon, Mar 20, 2017 at 6:29 PM, S. Jacobi <sjac...@mailueberfall.de> wrote:
> On Mon, 20 Mar 2017 18:10:16 +0100
> Joël Krähemann <jkraehem...@gmail.com> wrote:
>
>> Hi
>>
>> As Tristan told you. The struct contains the other struct as not using
>> a pointer.
>>
>> struct MyCompositeWidget
>> {
>>   GtkAlignment alignment;
>>
>>   GtkBox *box;
>> };
>>
> The parent-is-a-pointer mistake was just me not thinking when I wrote
> the mail. If have seen it being done correctly everywhere. This makes
> gtk_widget_set_name (myWidget->parent, "myWidget"); syntactically wrong
> however.
> ___
> 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+2 Textview, (editor) compiled on Windows and 'i' interpreted as 'ctrl+i' (indent)?

2017-06-21 Thread Joël Krähemann
Hi

Probably different locales. On linux you probably have an ASCII compatible
character coding or just UTF-8.

Note on windows iso8859-15 is available, at most for old versions.

I assume that you are running a windows codepage like 1252.

Bests,
Joël


On Wed, Jun 21, 2017 at 11:11 AM, David C. Rankin
 wrote:
> All,
>
>   This is a bizarre issue. I have a small editor written in gtk+2 (with
> optional build w/gktsourceview) It builds and runs without issue on Linux.
> I've built it on windows (and it builds without issue), but when running the
> editor, if I type and 'i' in the text view window, it 'indents' the paragraph
> as if `ctrl+i` were pressed. Strangely, if I inter 'I' (shift+i), the
> paragraph unindents. In either case no 'i' or 'I" ever makes it to the
> textview buffer. Huh?
>
>   The menu accelerator is set to use 'ctrl+i` for indent and 'ctrl+shift+i` to
> unindent. The menu and accelerator (in gtk_menu.c) is as follows:
>
> /* define tools menu */
> toolsMi = gtk_menu_item_new_with_mnemonic ("_Tools");
> sep = gtk_separator_menu_item_new ();
> indentMi = gtk_image_menu_item_new_from_stock (GTK_STOCK_INDENT,
>   NULL);
> gtk_menu_item_set_label (GTK_MENU_ITEM (indentMi), "Incr_ease Indent");
> unindentMi = gtk_image_menu_item_new_from_stock (GTK_STOCK_UNINDENT,
>   NULL);
> ...
> /* create entries under 'Tools' then add to menubar */
> gtk_menu_item_set_submenu (GTK_MENU_ITEM (toolsMi), toolsMenu);
> gtk_menu_shell_append (GTK_MENU_SHELL (toolsMenu), sep);
> gtk_menu_shell_append (GTK_MENU_SHELL (toolsMenu), indentMi);
> gtk_menu_shell_append (GTK_MENU_SHELL (toolsMenu), unindentMi);
> gtk_menu_shell_append (GTK_MENU_SHELL (toolsMenu),
>gtk_separator_menu_item_new());
> ...
> gtk_widget_add_accelerator (indentMi, "activate", mainaccel,
> GDK_KEY_i, GDK_CONTROL_MASK, 
> GTK_ACCEL_VISIBLE);
> gtk_widget_add_accelerator (unindentMi, "activate", mainaccel,
> GDK_KEY_i, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
> GTK_ACCEL_VISIBLE);
>
>   There is no other keypress_handler intercepting keys other than the default
> handler. I can't for the life of my figure out what in the menu accelerator
> could be causing every 'i' to be interpreted as 'ctrl+i'. Has anyone seen
> similar behavior? The gtk windows binaries are from gnome.org/downloads, e.g.
>
>
> https://download.gnome.org/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip
>
> https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-2.10.0.zip
>
> https://download.gnome.org/binaries/win32/gtksourceview/2.10/gtksourceview-dev-2.10.0.zip
>   http://xmlsoft.org/sources/win32/libxml2-2.7.8.win32.zip
>
>   compiled with MinGW gcc and the above.
>
>   Any ideas? Let me know if I can send any additional information.
>
>
> --
> David C. Rankin, J.D.,P.E.
> ___
> 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: Pause and resume GtkApplication

2018-01-25 Thread Joël Krähemann
Hi,
You do some async work? Read about:

g_timeout_add_full();

and

g_main_context_iteration();

You, can callback the to the UI forwarded event. I do something similar
as reading a file from a different thread:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/X/file/ags_simple_file.c?h=1.4.x#n1957

FYI: the UI thread shall run always by gtk_main().

Bests,
Joël

On Thu, Jan 25, 2018 at 11:10 PM, Alexander Koeppe
 wrote:
> Thanks Lucky,
>
> Good idea to create the widget right away and hide it until it's time.
>
> However, just by accident, I got back the app-menu in the window.
>
> Try this with the code below:
>
> 1. After I selected "Restart" simulating the pause and resume, the
> app-menu disappeared.
> 2. Then I double-clicked the header-bar to maximise the window and the
> app-menu reappeared.
> 3. Again double-clicked the header-bar to restore the original geometry
> the app-menu is still there.
>
> This is what I want. Question is, what happens when I double click the
> header-bar and can I emulate this event in code?
>
> I feel being just 1 grain off my goal
>
> Thanks
>
>-Alex
>
>
> Am 23.01.2018 um 22:37 schrieb Lucky B.C:
>> Wow, I see your problem is that you did not understand what GtkBuilder
>> and Gtk are doing, Because If I'm not wrong, each choice (entry) is a
>> function to start something you want to do after the user/you clicked
>> to the button called "restart". Here's my solution, it's maybe help
>> you.
>>
>> *) You can use gtk_widget_hide (target) function to hide any widget,
>> in this case it's the main window. Then you can do your low-level
>> functions what the other can see at the time after the signal
>> "clicked" activated.
>>
>> Note: Some programs I saw the program did not exit when it's called to
>> restart, there's only the changed/related data must be reload to
>> buffer/ram, and the program must stop rendering/running at the time,
>> after the reloading's done the program continues to render/display the
>> new data in the screen. The reloading can be done in a new thread too,
>> after used you can delete it too.
>>
>> On Wed, Jan 24, 2018 at 2:52 AM, Alexander Koeppe
>>  wrote:
>>> I know about the possiblity to fire the low-level functions using an button
>>> callback. However this would draw an exception for other UI choices the
>>> application has: e.g. text, deamon.
>>>
>>> Therefore I'm looking for a way to keep the application structure for all
>>> UIs the same.
>>>
>>> There is the test app I'm playing with:
>>>
>>>
>>> #include 
>>>
>>> GtkApplication *app;
>>> GtkWidget *window;
>>> int initialized = 0;
>>>
>>> void quit_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>> {
>>>g_print("quit!\n");
>>>g_object_unref(app);
>>>exit(0);
>>> }
>>>
>>> void restart_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>> {
>>>g_print("restart!\n");
>>>g_application_quit(G_APPLICATION(app));
>>> }
>>>
>>> void test_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>> {
>>>   GtkWidget *dialog;
>>>   GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
>>>
>>>
>>>   dialog = gtk_message_dialog_new(GTK_WINDOW(window),
>>>   flags,
>>>   GTK_MESSAGE_ERROR,
>>>   GTK_BUTTONS_CLOSE,
>>>   "TEst Message");
>>>   g_signal_connect_swapped(dialog, "response",
>>>G_CALLBACK(gtk_widget_destroy),
>>>dialog);
>>>   gtk_dialog_run(GTK_DIALOG(dialog));
>>> }
>>>
>>> static void shutdown(GtkApplication *app, gpointer data)
>>> {
>>>initialized = 1;
>>> }
>>>
>>> static void
>>> activate (GtkApplication *app,
>>>   gpointeruser_data)
>>> {
>>>   GtkWidget *header, *menubutton, *frame, *overlay, *combo, *box;
>>>   GtkBuilder *builder;
>>>
>>>   GActionEntry actions[] = {
>>>   {"test_action", test_cb, NULL, NULL, NULL,{}},
>>>   {"restart", restart_cb, NULL, NULL, NULL, {}},
>>>   {"quit", quit_cb, NULL, NULL, NULL, {}}
>>>   };
>>>
>>>
>>>   g_action_map_add_action_entries(G_ACTION_MAP(app), actions,
>>>   G_N_ELEMENTS(actions), app);
>>>
>>>
>>>
>>>   if (initialized == 0) {
>>>  window = gtk_application_window_new (app);
>>>  gtk_window_set_default_size (GTK_WINDOW (window), 500, 300);
>>>   }
>>>   else {
>>>  gtk_application_add_window(app, GTK_WINDOW(window));
>>>   }
>>>   gtk_window_set_title (GTK_WINDOW (window), "buildertest");
>>>
>>>   /* Header Bar */
>>>   header = gtk_header_bar_new();
>>>   gtk_header_bar_set_title(GTK_HEADER_BAR(header), "Yeah");
>>>   gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header), TRUE);
>>>   gtk_window_set_titlebar(GTK_WINDOW(window), header);
>>>
>>>   /* Menu Button */
>>>   menubutton = gtk_menu_button_new();
>>>
>>>   /* Menu for Menubutton */
>>>   builder = gtk_builder_new();
>>>   

Re: Pause and resume GtkApplication

2018-01-25 Thread Joël Krähemann
Hi,

Well there was some redundant code. This actually fixes it:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/X/file/ags_simple_file.c?h=1.5.x#n1904

Bests,
Joël


On Thu, Jan 25, 2018 at 11:16 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi,
> You do some async work? Read about:
>
> g_timeout_add_full();
>
> and
>
> g_main_context_iteration();
>
> You, can callback the to the UI forwarded event. I do something similar
> as reading a file from a different thread:
>
> http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/X/file/ags_simple_file.c?h=1.4.x#n1957
>
> FYI: the UI thread shall run always by gtk_main().
>
> Bests,
> Joël
>
> On Thu, Jan 25, 2018 at 11:10 PM, Alexander Koeppe
> <alexander@koeppe.rocks> wrote:
>> Thanks Lucky,
>>
>> Good idea to create the widget right away and hide it until it's time.
>>
>> However, just by accident, I got back the app-menu in the window.
>>
>> Try this with the code below:
>>
>> 1. After I selected "Restart" simulating the pause and resume, the
>> app-menu disappeared.
>> 2. Then I double-clicked the header-bar to maximise the window and the
>> app-menu reappeared.
>> 3. Again double-clicked the header-bar to restore the original geometry
>> the app-menu is still there.
>>
>> This is what I want. Question is, what happens when I double click the
>> header-bar and can I emulate this event in code?
>>
>> I feel being just 1 grain off my goal
>>
>> Thanks
>>
>>-Alex
>>
>>
>> Am 23.01.2018 um 22:37 schrieb Lucky B.C:
>>> Wow, I see your problem is that you did not understand what GtkBuilder
>>> and Gtk are doing, Because If I'm not wrong, each choice (entry) is a
>>> function to start something you want to do after the user/you clicked
>>> to the button called "restart". Here's my solution, it's maybe help
>>> you.
>>>
>>> *) You can use gtk_widget_hide (target) function to hide any widget,
>>> in this case it's the main window. Then you can do your low-level
>>> functions what the other can see at the time after the signal
>>> "clicked" activated.
>>>
>>> Note: Some programs I saw the program did not exit when it's called to
>>> restart, there's only the changed/related data must be reload to
>>> buffer/ram, and the program must stop rendering/running at the time,
>>> after the reloading's done the program continues to render/display the
>>> new data in the screen. The reloading can be done in a new thread too,
>>> after used you can delete it too.
>>>
>>> On Wed, Jan 24, 2018 at 2:52 AM, Alexander Koeppe
>>> <alexander@koeppe.rocks> wrote:
>>>> I know about the possiblity to fire the low-level functions using an button
>>>> callback. However this would draw an exception for other UI choices the
>>>> application has: e.g. text, deamon.
>>>>
>>>> Therefore I'm looking for a way to keep the application structure for all
>>>> UIs the same.
>>>>
>>>> There is the test app I'm playing with:
>>>>
>>>>
>>>> #include 
>>>>
>>>> GtkApplication *app;
>>>> GtkWidget *window;
>>>> int initialized = 0;
>>>>
>>>> void quit_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>>> {
>>>>g_print("quit!\n");
>>>>g_object_unref(app);
>>>>exit(0);
>>>> }
>>>>
>>>> void restart_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>>> {
>>>>g_print("restart!\n");
>>>>g_application_quit(G_APPLICATION(app));
>>>> }
>>>>
>>>> void test_cb(GSimpleAction *action, GVariant *value, gpointer data)
>>>> {
>>>>   GtkWidget *dialog;
>>>>   GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
>>>>
>>>>
>>>>   dialog = gtk_message_dialog_new(GTK_WINDOW(window),
>>>>   flags,
>>>>   GTK_MESSAGE_ERROR,
>>>>   GTK_BUTTONS_CLOSE,
>>>>   "TEst Message");
>>>>   g_signal_connect_swapped(dialog, "response",
>>>>G_CALLBACK(gtk_widget_destroy),
>>>>dialog);
>

Re: Pause and resume GtkApplication

2018-01-25 Thread Joël Krähemann
Hi

Just some explanation. Your timeout is is dispatched by gtk_main(). As
doing your call to the backend,
you have to listen on message and then forward the event to the UI.

AgsAudio::set-pads() actually is part of my backend. Sends the message.

Here you need some async non-blocking call to your backend, at your
own taste. E.g. this call
invokes ags_audio_set_pads().

The timeout function polls your messages and forwards the event:

AgsMachine::resize-pads() is part of the UI. You listen to this event within UI.

Connect as usual, note the callback does modify is_available to TRUE:

do_wait = TRUE;
is_available = FALSE;

g_signal_connect_after(machine, "resize-pads",
   G_CALLBACK(pads_resized_callback),
_available);

Meanwhile you pause execution of UI by calling within gtk_main().

while((do_wait && !is_available[0])){
usleep(100 / 30);
g_main_context_iteration(NULL,
FALSE);
}

Your source is dispatched but gtk_main() is still within the loop shown above.

Bests,
Joël

On Thu, Jan 25, 2018 at 11:54 PM, Joël Krähemann <jkraehem...@gmail.com> wrote:
> Hi,
>
> Well there was some redundant code. This actually fixes it:
>
> http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/X/file/ags_simple_file.c?h=1.5.x#n1904
>
> Bests,
> Joël
>
>
> On Thu, Jan 25, 2018 at 11:16 PM, Joël Krähemann <jkraehem...@gmail.com> 
> wrote:
>> Hi,
>> You do some async work? Read about:
>>
>> g_timeout_add_full();
>>
>> and
>>
>> g_main_context_iteration();
>>
>> You, can callback the to the UI forwarded event. I do something similar
>> as reading a file from a different thread:
>>
>> http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/X/file/ags_simple_file.c?h=1.4.x#n1957
>>
>> FYI: the UI thread shall run always by gtk_main().
>>
>> Bests,
>> Joël
>>
>> On Thu, Jan 25, 2018 at 11:10 PM, Alexander Koeppe
>> <alexander@koeppe.rocks> wrote:
>>> Thanks Lucky,
>>>
>>> Good idea to create the widget right away and hide it until it's time.
>>>
>>> However, just by accident, I got back the app-menu in the window.
>>>
>>> Try this with the code below:
>>>
>>> 1. After I selected "Restart" simulating the pause and resume, the
>>> app-menu disappeared.
>>> 2. Then I double-clicked the header-bar to maximise the window and the
>>> app-menu reappeared.
>>> 3. Again double-clicked the header-bar to restore the original geometry
>>> the app-menu is still there.
>>>
>>> This is what I want. Question is, what happens when I double click the
>>> header-bar and can I emulate this event in code?
>>>
>>> I feel being just 1 grain off my goal
>>>
>>> Thanks
>>>
>>>-Alex
>>>
>>>
>>> Am 23.01.2018 um 22:37 schrieb Lucky B.C:
>>>> Wow, I see your problem is that you did not understand what GtkBuilder
>>>> and Gtk are doing, Because If I'm not wrong, each choice (entry) is a
>>>> function to start something you want to do after the user/you clicked
>>>> to the button called "restart". Here's my solution, it's maybe help
>>>> you.
>>>>
>>>> *) You can use gtk_widget_hide (target) function to hide any widget,
>>>> in this case it's the main window. Then you can do your low-level
>>>> functions what the other can see at the time after the signal
>>>> "clicked" activated.
>>>>
>>>> Note: Some programs I saw the program did not exit when it's called to
>>>> restart, there's only the changed/related data must be reload to
>>>> buffer/ram, and the program must stop rendering/running at the time,
>>>> after the reloading's done the program continues to render/display the
>>>> new data in the screen. The reloading can be done in a new thread too,
>>>> after used you can delete it too.
>>>>
>>>> On Wed, Jan 24, 2018 at 2:52 AM, Alexander Koeppe
>>>> <alexander@koeppe.rocks> wrote:
>>>>> I know about the possiblity to fire the low-level functions using an 
>>>>> button
>>>>> callback. However this would draw an exception for other UI choices the
>>>>> application has: e.g. text, deamon.
>>>>>
>>>>> Therefore I'm looking for a way to keep the application structure for all
>>>>> UIs the same.
>>>>>
>>>>> There is the test

Re: Pause and resume GtkApplication

2018-01-25 Thread Joël Krähemann
Well, do a context menu and forget about it. In opensuse it is a
special package you install for Gnome3 :/

On Fri, Jan 26, 2018 at 12:30 AM, Alexander Koeppe
 wrote:
> It's not really because of async execution.
> I just tried various gtk_window functions that trigger the
> "window-state-change" event. But not all of them provide the desired effect.
> e.g.
> gtk_window_maximize() reappears the app-menu.
> gtk_window_iconfify() not
>
> So I wonder what is the default callback function of that signal which
> in case of maximization does a little thing that brings back the
> app-menu to my window.
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Gtk+-2.0 stylish coding

2018-04-19 Thread Joël Krähemann
Hi,

I do Gtk+-2.0 stylish coding. Any suggestions on changes on code are
appreciated?

I would love to get feedback for following code style:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/audio/ags_audio.c?h=2.0.x
http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/audio/ags_channel.c?h=2.0.x

My intension is to provide thread-safe properties and objects. Further reading:
https://savannah.nongnu.org/forum/forum.php?forum_id=9145

Bests,
Joël
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GTK on Mac OS X

2018-03-26 Thread Joël Krähemann
Hi Wojciech,

Some useful links:

https://wiki.gnome.org/Projects/GTK+/OSX/Building
https://github.com/jralls/gtk-mac-integration

Bests,
Joël


On Mon, Mar 26, 2018 at 12:50 PM, Wojciech Puchar
 wrote:
> how to link (or otherwise do other things) to disable opening terminal when
> starting my gtk program under mac os x.
>
> on windows it's a link time option -mwindows (no console) or -mconsole (with
> console).
>
>
> 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

Fwd: question about gtk_dialog (gtk2)

2018-06-22 Thread Joël Krähemann via gtk-app-devel-list
-- Forwarded message -
From: Joël Krähemann 
Date: Thu, Jun 21, 2018 at 1:11 PM
Subject: Re: question about gtk_dialog (gtk2)
To: Wojciech Puchar 


Hi Wojciech,

What about:

dialog = g_object_new(GTK_TYPE_DIALOG,
 "window-position", GTK_WIN_POS_CENTER,
 NULL);

bests,
Joël


On Fri, Jun 15, 2018 at 1:43 PM, Wojciech Puchar
 wrote:
> how to make dialogs appear on center of screen not on left corner. tried
> multiple things no results. For normal windows gtk_window_set_position works
>
> for dialog it doesn't
>
> below is example routine to ask a yes/no question from my program.
>
>
> i've tried
> gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);
>
> but it doesn't work
>
>
> nt pytanie(const char *txt) {
>  GtkWidget *dialog,*lab;
>  int odpowiedz;
>
> dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT,
>  TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
>  lab=new_label(txt);
>  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG
> (dialog))), lab);
>  odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
>  gtk_widget_destroy(dialog);
>  return (odpowiedz==GTK_RESPONSE_ACCEPT);
> }
>
> ___
> 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

Fwd: question about gtk_dialog (gtk2)

2018-06-22 Thread Joël Krähemann via gtk-app-devel-list
-- Forwarded message -
From: Joël Krähemann 
Date: Thu, Jun 21, 2018 at 1:31 PM
Subject: Re: question about gtk_dialog (gtk2)
To: Wojciech Puchar 


Hi,

Alternatively, you could inherit GTK_TYPE_DIALOG and do your very own
object. During ::map() and ::realize() you are able to modify the
GdkWindow. Just query parent and child elements for their dimensions.

Just implement:

GtkWidget::map()
GtkWidget::realize()
GtkWidget::size-allocate()
GtkWidget::size-request()

Bests,
Joël


On Thu, Jun 21, 2018 at 1:21 PM, Joël Krähemann  wrote:
> Hi,
>
> FYI some properties are only valid as constructor.
>
> cheers,
> Joël
>
>
> On Thu, Jun 21, 2018 at 1:11 PM, Joël Krähemann  wrote:
>> Hi Wojciech,
>>
>> What about:
>>
>> dialog = g_object_new(GTK_TYPE_DIALOG,
>>  "window-position", GTK_WIN_POS_CENTER,
>>  NULL);
>>
>> bests,
>> Joël
>>
>>
>> On Fri, Jun 15, 2018 at 1:43 PM, Wojciech Puchar
>>  wrote:
>>> how to make dialogs appear on center of screen not on left corner. tried
>>> multiple things no results. For normal windows gtk_window_set_position works
>>>
>>> for dialog it doesn't
>>>
>>> below is example routine to ask a yes/no question from my program.
>>>
>>>
>>> i've tried
>>> gtk_window_set_position(GTK_WINDOW(dialog),GTK_WIN_POS_CENTER_ALWAYS);
>>>
>>> but it doesn't work
>>>
>>>
>>> nt pytanie(const char *txt) {
>>>  GtkWidget *dialog,*lab;
>>>  int odpowiedz;
>>>
>>> dialog=gtk_dialog_new_with_buttons(TEXT_QUESTION,NULL,GTK_DIALOG_DESTROY_WITH_PARENT,
>>>  TEXT_TAK,GTK_RESPONSE_ACCEPT,TEXT_NIE,GTK_RESPONSE_NONE,NULL);
>>>  lab=new_label(txt);
>>>  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG
>>> (dialog))), lab);
>>>  odpowiedz=gtk_dialog_run(GTK_DIALOG(dialog));
>>>  gtk_widget_destroy(dialog);
>>>  return (odpowiedz==GTK_RESPONSE_ACCEPT);
>>> }
>>>
>>> ___
>>> 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: Working with embedded images with GResource, GdkPixbuf and GtkWidget

2018-11-11 Thread Joël Krähemann via gtk-app-devel-list
Hi,

First you create a GdkPixbuf:

https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-data

then set the property of about dialog:

https://developer.gnome.org/gtk2/stable/GtkAboutDialog.html#GtkAboutDialog--logo

g_object_set(your_about_dialog,
  "logo", your_pixbuf,
  NULL);

Why don't you use just following?

https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-file

Bests,
Joël

On Sun, Nov 11, 2018 at 6:23 PM Alessandro Francesconi
 wrote:
>
> Hello,
>
>
>
> I need to show some images inside my GTK+ 2.32 application so I decided to 
> embed them using GResource compiler.
>
> I’ve prepared an XML file like this:
>
>
>
> 
>
> 
>
>   
>
> logo.png
><…..>
>
>   
>
> 
>
>
>
> And after “glib-compile-resources.exe --target=icons.c --generate icons.xml”, 
> I correctly have a .c file with images encoded inside.
>
>
>
> Problem here: i need that images to be shown in About dialog 
> (gtk_show_about_dialog) and buttons (gtk_button_set_image). As far as I know, 
> to accomplish this I have to create GdkPixbuf (for gtk_about_dialog_set_logo) 
> and GtkWidget (for gtk_button_set_image). I tried with this code but got some 
> issues (see the comments):
>
>
>
> ---
>
> GResource* icons = icons_get_resource();
>
> GBytes* data = g_resource_lookup_data(icons, path, 
> G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
>
> gsite size = g_bytes_get_size(data); // <-- this works since I have no 
> errors and the size is > 0, so I expect data to be ok
>
>
>
> // now I need to create a GdkPixbuf, is that the correct way?
>
> GError* e = NULL;
>
> GdkPixbuf* pixbuf;
>
> pixbuf = gdk_pixbuf_new_from_inline(g_bytes_get_size(data), data, FALSE, 
> );
> // error here! Message is “Image header corrupt”
>
>
>
> // if worked… I’d continue by also getting the GtkWidget image with:
> GtkWidget* image;
>
> image = gtk_image_new_from_pixbuf(pixbuf);
>
> ---
>
>
>
> I can’t really understand how Pixbuf expects from the GResource data… also i 
> read in the docs that “gdk_pixbuf_new_from_inline has been deprecated since 
> version 2.32 and should not be used in newly-written code. Use GResource 
> instead.”… so what’s the correct way to create Pixbuf for About boxes and 
> GdkWidgets for image button?
>
>
>
> Thanks for the support
>
> Alessandro
>
>
>
> ___
> 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: is there a signal for typing at bottom of window?

2018-09-25 Thread Joël Krähemann via gtk-app-devel-list
Hi,

g_object_get(your_text_view,
  "buffer", _text_buffer,
  NULL);
g_signal_connect(your_text_buffer, "changed",
  G_CALLBACK(your_text_buffer_changed_callback), your_data);

void your_text_buffer_changed_callback(GtkTextBuffer
*your_text_buffer, gpointer your_data)
{
  gint line_count;

  line_count = gtk_text_buffer_get_line_count(your_text_buffer);

  if(line_count > YOUR_DATA(your_data)->line_count){
gchar *your_text;

g_object_get(your_text_buffer,
  "text", _text,
  NULL);

if(your_text[strlen(your_text) - 1] == '\n' &&
YOUR_DATA(your_data)->last_newline_position <
&(your_text[strlen(your_text) - 1]) - your_text){
  //TODO:DMC: implement me
}
  }
}

by,
Joël

On Wed, Sep 26, 2018 at 6:49 AM Doug McCasland  wrote:
>
> Eric, thanks for the ideas!
>
> I tried a bunch of things to distinguish the callbacks, but it got too
> complicated.  Checking for a different line number is a clever idea, but
> PgUp and PgDown also move the cursor which changes the line number.
>  Similar problems for tracking the char offset in the line (for simply
> typing at the end of the last visible line, not creating a new line/para).
>
> So, it would be nice if there was a simple signal for this case, where the
> window scrolls because of keyboard input in the last visible line.
>
> The reason I want this is, is so my app can scroll the window
> automatically, so that the cursor insert point becomes centered
> vertically.  In other words, when I'm typing a long paragraph, and it's the
> last visible line, I want it to scroll up, so I'm now typing in the middle
> of the window (vs. continuing to type on the last visible line).
>
> I suppose this is a bit esoteric.
>
> I did create a kbd shortcut to do that scroll manually:
>
> gtk_text_view_scroll_to_iter(..., 0.0, TRUE, 1.0, 0.5)
>
> so I have that to use.
>
>
> On Tue, Sep 25, 2018 at 2:34 PM  wrote:
>
> >
> > Not sure how to go about this myself. I see the extra callbacks and it
> > would be a good thing to limit them. For filtering maybe check if the
> > cursor has changed lines along with the adjustment value change. Suspect
> > there is a better solution for this.
> >
> > static void value_changed(GtkAdjustment *v_adjust, gpointer textview)
> >   {
> > static gint s_line=0;
> > GtkTextIter iter;
> > GtkTextBuffer
> > *buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
> > GtkTextMark *mark=gtk_text_buffer_get_mark(buffer, "insert");
> > gtk_text_buffer_get_iter_at_mark(buffer, , mark);
> > gint line=gtk_text_iter_get_line();
> > if(s_line!=line)
> >   {
> > g_print("Scroll Line\n");
> > s_line=line;
> >   }
> >   }
> >
> > Eric
> >
> >
> > -Original Message-
> > From: Doug McCasland 
> > To: cecashon 
> > Sent: Tue, Sep 25, 2018 2:10 pm
> > Subject: Re: is there a signal for typing at bottom of window?
> >
> > Actually I get 11 signals with a different setting of:
> > gtk_text_view_set_pixels_inside_wrap()
> >
> > So it's one signal per vertical pixel perhaps?   I can code for that.
> >
> > But I also I get those signals during any scrolling (scrollbar or
> > mousewheel).  How can I distinguish between automatic scrolling at bottom
> > and user-commanded scrolling?
> >
> > thanks
> >
> >
> >
> >
> >
> > On Tue, Sep 25, 2018 at 1:47 PM Doug McCasland 
> > wrote:
> >
> > Woo-hoo, that works!
> >
> > BUT, I get 12 signals for each line that is auto-scrolled.  I can code for
> > this, but why 12?  Will it always be 12?
> >
> >
> > On Tue, Sep 25, 2018 at 11:46 AM  wrote:
> >
> >
> > Hi Doug,
> >
> > Try getting the vertical adjustment of the scrolled window and connect to
> > "value-changed". See if that will work. Something like
> >
> > ...
> > static void value_changed(GtkAdjustment *v_adjust, gpointer user_data)
> >   {
> >   }
> > ...
> > GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);
> > GtkAdjustment
> > *v_adjust=gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll));
> > g_signal_connect(v_adjust, "value-changed", G_CALLBACK(value_changed),
> > NULL);
> > ...
> >
> > Eric
> >
> >
> >
> >
> >
> > --
> > Doug McCasland   
> >
> >
> >
> > --
> > Doug McCasland   
> >
>
>
> --
> Doug McCasland   
> ___
> 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: is there a signal for typing at bottom of window?

2018-09-25 Thread Joël Krähemann via gtk-app-devel-list
Hi again,

For sure you should probably use:

g_signal_connect_after(your_text_buffer, "changed",
  G_CALLBACK(your_text_buffer_changed_callback), your_data);

and YOUR_DATA(your_data) just casts to your pointer to a struct or
object containing some information:

struct _YourData{
  gint last_newline_position;
};

Well this is it.

Bests,
Joël



On Wed, Sep 26, 2018 at 7:12 AM Joël Krähemann  wrote:
>
> Hi,
>
> g_object_get(your_text_view,
>   "buffer", _text_buffer,
>   NULL);
> g_signal_connect(your_text_buffer, "changed",
>   G_CALLBACK(your_text_buffer_changed_callback), your_data);
>
> void your_text_buffer_changed_callback(GtkTextBuffer
> *your_text_buffer, gpointer your_data)
> {
>   gint line_count;
>
>   line_count = gtk_text_buffer_get_line_count(your_text_buffer);
>
>   if(line_count > YOUR_DATA(your_data)->line_count){
> gchar *your_text;
>
> g_object_get(your_text_buffer,
>   "text", _text,
>   NULL);
>
> if(your_text[strlen(your_text) - 1] == '\n' &&
> YOUR_DATA(your_data)->last_newline_position <
> &(your_text[strlen(your_text) - 1]) - your_text){
>   //TODO:DMC: implement me
> }
>   }
> }
>
> by,
> Joël
>
> On Wed, Sep 26, 2018 at 6:49 AM Doug McCasland  wrote:
> >
> > Eric, thanks for the ideas!
> >
> > I tried a bunch of things to distinguish the callbacks, but it got too
> > complicated.  Checking for a different line number is a clever idea, but
> > PgUp and PgDown also move the cursor which changes the line number.
> >  Similar problems for tracking the char offset in the line (for simply
> > typing at the end of the last visible line, not creating a new line/para).
> >
> > So, it would be nice if there was a simple signal for this case, where the
> > window scrolls because of keyboard input in the last visible line.
> >
> > The reason I want this is, is so my app can scroll the window
> > automatically, so that the cursor insert point becomes centered
> > vertically.  In other words, when I'm typing a long paragraph, and it's the
> > last visible line, I want it to scroll up, so I'm now typing in the middle
> > of the window (vs. continuing to type on the last visible line).
> >
> > I suppose this is a bit esoteric.
> >
> > I did create a kbd shortcut to do that scroll manually:
> >
> > gtk_text_view_scroll_to_iter(..., 0.0, TRUE, 1.0, 0.5)
> >
> > so I have that to use.
> >
> >
> > On Tue, Sep 25, 2018 at 2:34 PM  wrote:
> >
> > >
> > > Not sure how to go about this myself. I see the extra callbacks and it
> > > would be a good thing to limit them. For filtering maybe check if the
> > > cursor has changed lines along with the adjustment value change. Suspect
> > > there is a better solution for this.
> > >
> > > static void value_changed(GtkAdjustment *v_adjust, gpointer textview)
> > >   {
> > > static gint s_line=0;
> > > GtkTextIter iter;
> > > GtkTextBuffer
> > > *buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
> > > GtkTextMark *mark=gtk_text_buffer_get_mark(buffer, "insert");
> > > gtk_text_buffer_get_iter_at_mark(buffer, , mark);
> > > gint line=gtk_text_iter_get_line();
> > > if(s_line!=line)
> > >   {
> > > g_print("Scroll Line\n");
> > > s_line=line;
> > >   }
> > >   }
> > >
> > > Eric
> > >
> > >
> > > -Original Message-
> > > From: Doug McCasland 
> > > To: cecashon 
> > > Sent: Tue, Sep 25, 2018 2:10 pm
> > > Subject: Re: is there a signal for typing at bottom of window?
> > >
> > > Actually I get 11 signals with a different setting of:
> > > gtk_text_view_set_pixels_inside_wrap()
> > >
> > > So it's one signal per vertical pixel perhaps?   I can code for that.
> > >
> > > But I also I get those signals during any scrolling (scrollbar or
> > > mousewheel).  How can I distinguish between automatic scrolling at bottom
> > > and user-commanded scrolling?
> > >
> > > thanks
> > >
> > >
> > >
> > >
> > >
> > > On Tue, Sep 25, 2018 at 1:47 PM Doug McCasland 
> > > wrote:
> > >
> > > Woo-hoo, that works!
> > >
> > > BUT, I get 12 signals for each line that is auto-scrolled.  I can code for
> > > this, but why 12?  Will it always be 12?
> > >
&

Re: string interpolation

2018-12-21 Thread Joël Krähemann via gtk-app-devel-list
Hi,
As you set a string property of a Gtk+ widget, the string is usually
duplicated. However don't call any Gtk+ function outside the main loop,
i.e. from a different thread.

Bests,
Joël

On Fri, Dec 21, 2018 at 9:49 AM Lutz Lümken  wrote:
>
> Hello,
>
> does GTK have some kind of string interpolation or can I safely display
> user input strings in the widgets without anything unexpected (code
> injection, formatting etc.) to happen?
>
> Best regards,
> Lutz Lümken
> --
> Lutz Lümkenluem...@pre-sense.de
> PRESENSE Technologies GmbHSachsenstr. 5, D-20097 HH
> Geschäftsführer/Managing Directors   AG Hamburg, HRB 107844
> Till Dörges, Jürgen Sander   USt-IdNr.: DE263765024
>
> ___
> 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: GObject properties and g_value_set_string()

2019-02-06 Thread Joël Krähemann via gtk-app-devel-list
Hi again,

Yes, g_value_set_string() does call g_strdup().

bests,
Joël

On Thu, Feb 7, 2019 at 5:20 AM Joël Krähemann  wrote:
>
> Hi all,
>
> Currently, I do my properties like following:
>
> http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/lib/ags_turtle.c?h=2.1.x#n175
> http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/lib/ags_turtle.c?h=2.1.x#n218
>
> Is it ok to do g_strdup() and pass it to g_value_set_string()?
> Or does g_value_set_string() duplicate the string for me?
>
> Does the following make any sense?
>
> g_value_set_string(value, g_strdup(turtle->filename));
>
> This sample code is from GLib-2.0 API Reference Manual:
>
> 
>
> gint intval;
> gchar *strval;
> GObject *objval;
>
> g_object_get (my_object,
>   "int-property", ,
>   "str-property", ,
>   "obj-property", ,
>   NULL);
>
> // Do something with intval, strval, objval
>
> g_free (strval);
> g_object_unref (objval);
>
> 
>
> Since I have to free the string, I just wonder if I need to g_strdup() it.
>
> bests,
> Joël
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

GObject properties and g_value_set_string()

2019-02-06 Thread Joël Krähemann via gtk-app-devel-list
Hi all,

Currently, I do my properties like following:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/lib/ags_turtle.c?h=2.1.x#n175
http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/lib/ags_turtle.c?h=2.1.x#n218

Is it ok to do g_strdup() and pass it to g_value_set_string()?
Or does g_value_set_string() duplicate the string for me?

Does the following make any sense?

g_value_set_string(value, g_strdup(turtle->filename));

This sample code is from GLib-2.0 API Reference Manual:



gint intval;
gchar *strval;
GObject *objval;

g_object_get (my_object,
  "int-property", ,
  "str-property", ,
  "obj-property", ,
  NULL);

// Do something with intval, strval, objval

g_free (strval);
g_object_unref (objval);



Since I have to free the string, I just wonder if I need to g_strdup() it.

bests,
Joël
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list