GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Sep 03, 2014 4:46 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: GtkSocket won't show in a GtkFixed
PostPosted: Thu Mar 29, 2012 7:52 pm 
Offline

Joined: Thu Mar 29, 2012 7:49 pm
Posts: 4
Ubuntu 10.04 filesys, on a Marvell ARM CPU. kernel is 2.6.32.9.

With this code, I can't show a socket inside a fixed widget. The fixed widget method works on desktop ubuntu.
GtkWidget *fixed = gtk_fixed_new ();
gtk_widget_show( fixed );
socket = gtk_socket_new();
#if 1
// this line lets the code work
gtk_container_add( GTK_CONTAINER( window ), socket );
#else
// with this line, it fails to show the contents of the socket
gtk_fixed_put( GTK_FIXED( fixed ), socket, 0, 0 );
#endif
gtk_widget_show( socket );

I need to use the (non-working) gtk_fixed_put scheme, since I need to add multiple widgets to the window. I am getting a gtk critical error from the gtk_fixed_put li\
ne: assertion GTK_IS_ANCHORED (socket) failed.

Can anyone tell me why gtk_fixed_put is failing, when gtk_container_add works?

I'd appreciate any ideas for solving this issue...


Top
 Profile  
 
 Post subject: Re: GtkSocket won't show in a GtkFixed
PostPosted: Thu Mar 29, 2012 8:22 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
please give all information available about your problem. What version of gtk are you using, Post more context for your code, e.g. anchored means there's a hierarchy to the top level. Is your window top level? I don't see any code where you actually put the fixed in the window. This is most likely the problem.

Unless you really really have to it is best not to use gtkfixed. Forcing a widget to be at a certain position can run into troubles with window resizing, small screen devices etc. Best to let gtk and the window manager handle how things fit with a few hints along the way. Try using other layout widgets: vbox, hbox, table etc.

By the way plug/socket aren't as cross-platform as the rest of gtk: Have you checked they work on ARM? Most likely do else you'd probably be seeing other errors.


Top
 Profile  
 
 Post subject: Re: GtkSocket won't show in a GtkFixed
PostPosted: Tue Apr 17, 2012 1:55 am 
Offline

Joined: Thu Mar 29, 2012 7:49 pm
Posts: 4
(sorry about the time lapse)

I couldn't find a gtk call to get the version. In gtk-2.0/gtk/gtkversion.h there is GTK_MAJOR|MINOR|MICRO_VERSION of 2.20.0. I can't check out whether the fixed is in the window until I get to my development system tomorrow morning.

Tell me a bit more about why not to use gtkfixed. In the system I'm building, there is no mouse and no window manager. The machine simply displays programmed conent on an hdmi screen. Portions of the screen (determined by specification, and fixed throughout the product life cycle) contain different portions of the content. Given that situation, should I still be avoiding
gtkfixed?

Thanks,
Michael


Top
 Profile  
 
 Post subject: Re: GtkSocket won't show in a GtkFixed
PostPosted: Tue Apr 17, 2012 4:45 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
ok given your situation I imagine fixed should work fine, and will likely be more efficient.
The bit I ask about more code is that in your if then else condition you have:
1. socket -> window
2. socket -> fixed window
with no anchoring of the fixed within the window for the second case (unless this is done elsewhere) which is a likely cause of your error.


Top
 Profile  
 
 Post subject: Re: GtkSocket won't show in a GtkFixed
PostPosted: Thu Apr 19, 2012 9:12 pm 
Offline

Joined: Thu Mar 29, 2012 7:49 pm
Posts: 4
I've attached a complete source file to this post. If USE_FIXED is defined, I do:
gtk_fixed _new() // around line 191
gtk_container_add( GTK_CONTAINER( window ), fixed );
gtk_widget_show( fixed );

And around line 286:
gtk_fixed_put( GTK_FIXED( fixed ), socket, 0, 0 );

The code with USE_FIXED shows an X window of the correct size, but it's blank. The output from the library rendering into the socket (libflashplayer) is not getting displayed.

I think the socket is anchored since I put the fixed widget into the window at line 192, and the socket into the fixed widget at line 286 (even though flash rendering hasn't started yet).

When I undefine USE_FIXED, I do (around line 289):
gtk_container_add( GTK_CONTAINER( window ), socket );

This does show the libflashplayer output playing correctly.

When the code runs, no GTK errors are displayed in either case.

I am trying to figure out a way for the socket output to show in the fixed widget.

-Michael


Attachments:
fhost.zip [5.52 KiB]
Downloaded 71 times
Top
 Profile  
 
 Post subject: Re: GtkSocket won't show in a GtkFixed
PostPosted: Wed Apr 25, 2012 6:52 pm 
Offline

Joined: Thu Mar 29, 2012 7:49 pm
Posts: 4
In the gtk_widget_show( window ) call, the fixed widget allocation was getting increased to the window size, but the socket allocation (inside the fixed) was not. Doing a gtk_widget_set_size_request on the socket to the window size fixed things.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group