问题
I've developed a gtk2 app (Conky Companion) in C to help users of my conky scripts
Link: http://crunchbanglinux.org/forums/topic/19235/conky-weather-scripts-using-accuweatherwundergroundnwsweathercom/
create their own conkyrcs with relative ease. A screenshot of the main screen is the following:
http://i.imgur.com/jWl88.jpg
The user can drag and drop icons or labels from the right side to the left, move them, resize them, change their size or colour, etc. When happy, he can press the generate button and generate a conkyrc file.
The screen is a top,non resizable window with a table. The 2 sides of the table are frames in which fixed containers have been put.
Whenever someones tries to place an icon or a label at the right or bottom border of the left frame/fixed container, the widget goes off bounds, as you can see from the screen shot above.
I'm now trying to port the app to Gtk3 and I'm facing a bizarre problem.
Whenever a user tries to place or move an object to the right or bottom border of the left frame/fixed container, it resizes itself to accommodate the newly placed widget.
http://i.imgur.com/d1lc4.jpg
If I move the object to the left (or up), the frame goes back to its size defined by gtk_widget_set_size_request.
Is there a way to make a fixed container... fixed? I don't want it to resize.
The code that places the frame and the fixed container in the window is this:
/* LEFT FRAME */
frame1= gtk_frame_new(NULL);
gtk_table_attach(GTK_TABLE(table), frame1, 0,14,0,49,GTK_SHRINK,GTK_SHRINK,0,0);
gtk_widget_set_size_request(frame1, 360,570);
gtk_widget_show(frame1);
/* LEFT FRAME - FIXED CONTAINER */
fixed1 = gtk_fixed_new();
gtk_widget_set_has_window(fixed1,TRUE);
gtk_container_add(GTK_CONTAINER(frame1),fixed1);
gtk_widget_modify_bg (fixed1, GTK_STATE_NORMAL, &color);
gtk_drag_dest_set (
fixed1, GTK_DEST_DEFAULT_ALL,
target_list, 1, GDK_ACTION_COPY|GDK_ACTION_MOVE);
g_signal_connect (fixed1, "drag-drop",G_CALLBACK (dr_data_rec_1d1), (gpointer)fixed1);
gtk_widget_show(fixed1);
I've tried the following things:
1)Fiddling with GTK_EXPAND and GTK_FILL for the placement of the frame. No change.
2)gtk_window_set_geometry_hints for the window, table, frame and fixed container. No change.
3)Replacing gtk_table with gtk_grid. No change.
I'm quite at a loss on what to do or for what to search; I don't even know whether the problem is in the window, the table, the frame, the fixed container or in some obscure drag and drop setting.
Looking forward for any hint and sorry if the solution is easy and/or obvious.
来源:https://stackoverflow.com/questions/11925643/drag-and-drop-on-a-fixed-container-changes-its-size