Re: detaching a notebook tab

2015-07-07 Thread Emmanuele Bassi
Hi;

On 7 July 2015 at 01:32, Cottrell, Allin cottr...@wfu.edu wrote:

 Thanks, Jim. I guess this means that the problem was introduced after gtk
 3.10. I wonder if 3.12 and 3.14 are OK too.

 I've now checked gtk 3.10.9, 3.12.2 and 3.14.13 here. The first two are OK, 
 but
 3.14.13 segfaults (see the code in my first message).

Does this happen on master as well?

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: detaching a notebook tab

2015-07-07 Thread Cottrell, Allin
On Tue, Jul 7, 2015 at 8:53 AM, Allin Cottrell cottr...@wfu.edu wrote:
 On Tue, 7 Jul 2015, Emmanuele Bassi wrote:

 Hi;

 On 7 July 2015 at 01:32, Cottrell, Allin cottr...@wfu.edu wrote:

 Thanks, Jim. I guess this means that the problem was introduced after
 gtk 3.10. I wonder if 3.12 and 3.14 are OK too.


 I've now checked gtk 3.10.9, 3.12.2 and 3.14.13 here. The first two are
 OK, but 3.14.13 segfaults (see the code in my first message).


 Does this happen on master as well?

 I can check that this evening.

Er, sorry, building gtk master requires more unstable dependencies
than I can handle. But it should be easy enough to test for anyone with
master to hand. I'm attaching a slightly streamlined version of my little
test case.

-- 
Allin Cottrell
Department of Economics
Wake Forest University
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: detaching a notebook tab

2015-07-07 Thread Cottrell, Allin
On Tue, Jul 7, 2015 at 4:07 PM, Cottrell, Allin cottr...@wfu.edu wrote:
 On Tue, Jul 7, 2015 at 8:53 AM, Allin Cottrell cottr...@wfu.edu wrote:
 On Tue, 7 Jul 2015, Emmanuele Bassi wrote:

 Hi;

 On 7 July 2015 at 01:32, Cottrell, Allin cottr...@wfu.edu wrote:

 Thanks, Jim. I guess this means that the problem was introduced after
 gtk 3.10. I wonder if 3.12 and 3.14 are OK too.


 I've now checked gtk 3.10.9, 3.12.2 and 3.14.13 here. The first two are
 OK, but 3.14.13 segfaults (see the code in my first message).


 Does this happen on master as well?

 I can check that this evening.

 Er, sorry, building gtk master requires more unstable dependencies
 than I can handle [...]

OK, not really: only pango needed updating beyond stable to build gtk
master. What I find is that the situation is the same as in gtk 3.16.4: if I
use the new (in 3.16) special function gtk_notebook_detach_tab() then
my test case runs OK; otherwise (using gtk_container_remove() for the
outgoing notebook tab) it segfaults, as in gtk 3.14 and 3.16 (but not
3.12 or earlier).

-- 
Allin Cottrell
Department of Economics
Wake Forest University
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: detaching a notebook tab

2015-07-07 Thread Allin Cottrell

On Tue, 7 Jul 2015, Emmanuele Bassi wrote:


Hi;

On 7 July 2015 at 01:32, Cottrell, Allin cottr...@wfu.edu wrote:


Thanks, Jim. I guess this means that the problem was introduced after gtk
3.10. I wonder if 3.12 and 3.14 are OK too.


I've now checked gtk 3.10.9, 3.12.2 and 3.14.13 here. The first two are OK, but
3.14.13 segfaults (see the code in my first message).


Does this happen on master as well?


I can check that this evening.

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


Re: detaching a notebook tab

2015-07-06 Thread Allin Cottrell

On Mon, 6 Jul 2015, Jim Charlton wrote:

It works fine for me on gtk3.  I am running on linux and the version 
of gtk3 is the most recent in the repository, I believe 
(3.10.8-0ubuntu1.5). [...]


I saw your other message ... but I just used the code from your first message 
and got the libs and cflags from `pkg-config gtk+-3.0 --libs` `pkg-config 
gtk+-3.0 --cflags`.


Thanks, Jim. I guess this means that the problem was introduced after 
gtk 3.10. I wonder if 3.12 and 3.14 are OK too.


--
Allin Cottrell
Department of Economics
Wake Forest University, NC
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: detaching a notebook tab

2015-07-06 Thread Jim Charlton
It works fine for me on gtk3.  I am running on linux and the version of 
gtk3 is the most recent in the repository, I believe (3.10.8-0ubuntu1.5).
Depends: libgtk-3-common (= 3.10.8), libatk-bridge2.0-0 (= 2.5.3), 
libatk1.0-0 (= 2.7.5), libc6 (= 2.14), libcairo-gobject2 (= 1.10.0),
 libcairo2 (= 1.13.0~20140204), libcolord1 (= 0.1.10), 
libcups2 (= 1.6.2), libfontconfig1 (= 2.9.0), libgdk-pixbuf2.0-0 (=
 2.27.1), libglib2.0-0 (= 2.39.4), libpango-1.0-0 (= 1.32.4), 
libpangocairo-1.0-0 (= 1.32.4), libpangoft2-1.0-0 (= 1.32.4),
 libwayland-client0 (= 1.3.92), libwayland-cursor0 (= 1.2.0), 
libx11-6 (= 2:1.4.99.1), libxcomposite1 (= 1:0.3-1), libxcursor1
 ( 1.1.2), libxdamage1 (= 1:1.1), libxext6, libxfixes3, 
libxi6 (= 2:1.2.99.4), libxinerama1, libxkbcommon0 (= 0.2.0-0ubuntu3~),

 libxrandr2 (= 2:1.2.99.3), shared-mime-info

I saw your other message ... but I just used the code from your first 
message and got the libs and cflags from `pkg-config gtk+-3.0 --libs` 
`pkg-config gtk+-3.0 --cflags`.


jim...


On 15-07-06 08:36 AM, Allin Cottrell wrote:

Hello all,

My app has a collection of objects which can be viewed either 
individually or in a tabbed viewer based on GtkNotebook. When objects 
are being viewed in the latter way, the user is supposed to be able to 
drag an object out of the tabbed viewer, with the effect of giving it 
its own window.


This works fine with gtk 2.24.28, but I'm getting a segfault with the 
same code on gtk 3.16.4. This looks like a gtk bug, but maybe I'm 
doing something wrong and before I file a report I'd be grateful if 
anyone could take a look at minimal test case below.


The idea is to start the program, switch to the second page in the 
notebook, and try dragging the tab onto the root window. With gtk3

I get a crash, preceded by the message

Gtk-CRITICAL **: gtk_widget_get_frame_clock: assertion 'GTK_IS_WIDGET 
(widget)' failed


Here's the minimal code:

#include gtk/gtk.h

/* Minimal test case for dragging a tab out of a
   notebook onto the root window

   Allin Cottrell cottr...@wfu.edu, 2015-07-06
*/

static GtkNotebook *detach_tab_callback (GtkNotebook *book,
 GtkWidget *page,
 gint x, gint y,
 gpointer data)
{
GtkWidget *window;
gint pgnum;

g_object_ref(page);
pgnum = gtk_notebook_page_num(GTK_NOTEBOOK(book), page);
gtk_notebook_remove_page(GTK_NOTEBOOK(book), pgnum);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(GTK_CONTAINER(window), page);
g_object_unref(page);

gtk_widget_show_all(window);

/* return NULL since we're not adding the detached
   tab to another GtkNotebook */

return NULL;
}

int main (int argc, char **argv)
{
GtkWidget *window, *notebook, *child;

gtk_init(argc, argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), destroy,
 gtk_main_quit, NULL);

notebook = gtk_notebook_new();
g_signal_connect(G_OBJECT(notebook), create-window,
 G_CALLBACK(detach_tab_callback), NULL);

child = gtk_label_new(Content of first page);
gtk_widget_set_size_request(child, -1, 100);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child, NULL);

child = gtk_label_new(Content of second page);
gtk_widget_set_size_request(child, -1, 100);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), child, NULL);
gtk_notebook_set_tab_detachable(GTK_NOTEBOOK(notebook),
child, TRUE);

gtk_container_add(GTK_CONTAINER(window), notebook);
gtk_widget_show_all(window);

gtk_main();

return 0;
}



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


Re: detaching a notebook tab

2015-07-06 Thread Allin Cottrell

On Mon, 6 Jul 2015, Allin Cottrell wrote:

My app has a collection of objects which can be viewed either 
individually or in a tabbed viewer based on GtkNotebook. When 
objects are being viewed in the latter way, the user is supposed to 
be able to drag an object out of the tabbed viewer, with the effect 
of giving it its own window.


This works fine with gtk 2.24.28, but I'm getting a segfault with 
the same code on gtk 3.16.4. [...]


Sorry to self-reply, but I now see that if I use the special function 
gtk_notebook_detach_tab() to pull the tab out of the notebook, instead 
of gtk_notebook_remove_page() or gtk_container_remove(), then the drag 
to root window works OK on current gtk 3. But that special function is 
new in 3.16, so the question arises: Is there a workaround to 
prevent a crash on gtk 3  3.16?


--
Allin Cottrell
Department of Economics
Wake Forest University, NC

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