Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 09-20-2013, 09:54 AM   #1
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Exclamation gtkcolorbutton GtkColorSelection gtk_window_set_transient_for () seems incorrect

As I understand it:

I invoke a https://developer.gnome.org/gtk2/2.2...lorButton.html GtkColorButton

clicking this creates for me a GtkColorSelection dialog

Which automatically sets the gtk_window_set_transient_for () as the parent that invoked the dialog.

this works great when there is only ONE window in the mix.


But...

invoke two windows:

one from the other... then put the button on the second page... and the gtk_window_set_transient_for () will always put the dialog BEHIND the second window...


test.c
Code:
#include <gtk/gtk.h>

static gboolean delete_event( GtkWidget *widget,
                              GdkEvent  *event,
                              gpointer   data )
{   g_print ("delete event occurred\n");
    return TRUE;
}

/* Another callback */
static void destroy( GtkWidget *widget,
                     gpointer   data )
{
    gtk_main_quit ();
}

/* return us a window */

GtkWidget* create_simple_window (GtkWidget *thewindow)
{
	GtkWidget *window;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	gtk_window_set_title(GTK_WINDOW(window), "L:A_N:application_ID:twobob.second.layer_PC:N");

	gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_modal (GTK_WINDOW (window), TRUE);
	gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (thewindow));

	return window;
}


int main( int   argc,
          char *argv[] )
{

    GtkWidget *window;
           GtkWidget *window2;
            GtkWidget *button;

    gtk_init (&argc, &argv);
    
    /* create a new window on the application layer */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	gtk_window_set_title (GTK_WINDOW (window), "L:A_N:application_ID:twobob.osmo_PC:N");

    g_signal_connect (window, "delete-event",
		      G_CALLBACK (delete_event), NULL);

    g_signal_connect (window, "destroy",
		      G_CALLBACK (destroy), NULL);
    
    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
    
    button = gtk_color_button_new();
    gtk_color_button_set_title(GTK_COLOR_BUTTON(button), "L:D_ID:twobob.color");

  /* create a new window  ALSO on the application layer */
    window2 = create_simple_window(window);

    gtk_container_add (GTK_CONTAINER (window2), button);

    gtk_widget_show (window);

    gtk_widget_show (button);
    
    /* and the second window - WITH THE BUTTON */
   gtk_widget_show (window2);

    gtk_main ();
    
    return 0;
}
press the button? nothing appears.
(well it does but on the wrong layer)

swap
gtk_container_add (GTK_CONTAINER (window2), button);

for
gtk_container_add (GTK_CONTAINER (window), button);


and elide
gtk_widget_show (window2);

like
// gtk_widget_show (window2);


and it all works as expected...

so... am I going to have to derive a widget from GtkColorSelection ???

or is this as a result of using the awesome layers????

Any clues?

I was trying to port "osmo" but this has me stumped.
and short of rewriting the entire "PREFERENCES" gtknotebook layout... I am out of ideas.

Hence the simple to test "THIS DONT WORK" example I have made here...
twobob is offline   Reply With Quote
Old 09-20-2013, 09:56 AM   #2
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
can be compiled like

gcc test.c -o test `pkg-config --cflags --libs gtk+-2.0 `
twobob is offline   Reply With Quote
Advert
Old 09-20-2013, 11:56 AM   #3
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
I'll test it in a Xephyr...

EDIT: ANNNNNNNNNOYING.... of course it works perfectly in a xephyr. Sigh...
twobob is offline   Reply With Quote
Old 09-20-2013, 12:52 PM   #4
baf
Evangelist
baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.
 
Posts: 404
Karma: 2200000
Join Date: May 2012
Device: kt
Try setting new window on dialog layer. Then it should open in front of main window.
Code:
gtk_window_set_title (GTK_WINDOW (window2), "L:D_N:application_ID:twobob.osmo_PC:N");
baf is offline   Reply With Quote
Old 09-20-2013, 01:33 PM   #5
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
err.. okay.

will do! Thanks - trying this right now!
twobob is offline   Reply With Quote
Advert
Old 09-20-2013, 01:38 PM   #6
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Quote:
Originally Posted by baf View Post
Try setting new window on dialog layer. Then it should open in front of main window.
Code:
gtk_window_set_title (GTK_WINDOW (window2), "L:D_N:application_ID:twobob.osmo_PC:N");
hmm...

So.. The colorChooser will open in front of the new window?

not seeing this...
twobob is offline   Reply With Quote
Old 09-20-2013, 01:42 PM   #7
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Code:
GtkWidget* create_simple_window (GtkWidget *thewindow)
{
	GtkWidget *window;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(thewindow), "L:D_N:application_ID:twobob.layer2");

.... BLAH


}

actually shows nothing at all?
not even the window...

sigh.
twobob is offline   Reply With Quote
Old 09-20-2013, 01:47 PM   #8
baf
Evangelist
baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.baf ought to be getting tired of karma fortunes by now.
 
Posts: 404
Karma: 2200000
Join Date: May 2012
Device: kt
Quote:
Originally Posted by twobob View Post
Code:
GtkWidget* create_simple_window (GtkWidget *thewindow)
{
	GtkWidget *window;

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(thewindow), "L:D_N:application_ID:twobob.layer2");

.... BLAH


}

actually shows nothing at all?
not even the window...

sigh.
That was just a wild guess. Kindle awesome layers are tricky.
But I meant window here. Is it a typo?
baf is offline   Reply With Quote
Old 09-20-2013, 03:11 PM   #9
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
hmm. checking.

EDIT: Neither way works.

This is a problem for porting apps... Sigh. this effectively means we can't invoke any dialogs on secondary level windows.

Huge hit on the "likely apps to work" list...

Last edited by twobob; 09-20-2013 at 03:15 PM.
twobob is offline   Reply With Quote
Old 09-20-2013, 03:40 PM   #10
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
edit... hmm or does it?

Code:
    /* create a new window */
    window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (window2), "L:D_N:application_ID:twobob.osmo_PC:N");
  	gtk_window_set_default_size (GTK_WINDOW (window2), 800, 600);
	gtk_window_set_position (GTK_WINDOW (window2), GTK_WIN_POS_CENTER_ON_PARENT);
actually does work...

Have to look at that function again and completely rethink the port of osmo then...
if it works... This could be very helpful...

Thanks baf. will dig harder.
twobob is offline   Reply With Quote
Old 09-20-2013, 04:03 PM   #11
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
okay. got it.

Foolishly the method was being called and seemingly setting
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (appGUI->main_window));
does something odd when dealing with a dialog layer window.

simply removing this (duh?) and using the D layer (as you so wisely suggested) has indeed got me back the pop overs when using the D layer for them...

YAY. Time to go hack.
Superstar baf.

as ever.
twobob is offline   Reply With Quote
Reply

Tags
gtk, gtkcolorbutton, gtkcolorselection, kindle, twobob


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect conversion nilla Conversion 1 06-16-2013 11:59 AM
Incorrect date on device fyberoptyx Calibre 1 10-26-2012 10:11 PM
incorrect import of html vangop Calibre 5 10-05-2012 10:55 AM
Incorrect Format somkk Conversion 6 07-07-2012 01:42 AM
Incorrect Date on kindle 3 yogibare143 Amazon Kindle 5 12-05-2010 05:43 PM


All times are GMT -4. The time now is 08:08 PM.


MobileRead.com is a privately owned, operated and funded community.