Re: gtk_widget_size_allocate(): attempt to allocate widget with width -19 and height 1
Thanks Eric. I tried swapping the margin for border width and now I get a warning for every item I add to the grid. Plus I don't want a wide border all around the widget, I just want to add some space on the left. I see that margin-left has been replaced by margin-start but I don't see that in the version of Glade I'm using and I'm not convinced that it would behave any differently. The solution is to pack the grid into an alignment widget and set the left padding. Cheers, On Mon, 2017-12-04 at 13:55 -0500, cecas...@aol.com wrote: > Hi Franco, > > > I see "margin-left" is deprecated since version 3.12. > > This might work. If you set the container margin of the grid and then > individually place your widgets in the locations that you want them,,, > hopefully no warnings. I don't get any warnings on GTK3.18. Will something > like this work? > > Eric > > /* >gcc -Wall expander1.c -o expander1 `pkg-config --cflags --libs gtk+-3.0` >Tested with GTK3.18 on Ubuntu16.04 > */ > #include > > int main(int argc, char *argv[]) > { > gtk_init (, ); > > GtkWidget *window=gtk_window_new (GTK_WINDOW_TOPLEVEL); > gtk_window_set_title(GTK_WINDOW(window), "Expander"); > gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); > gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); > g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); > > GtkWidget *check1=gtk_check_button_new_with_label("Check1"); > gtk_widget_set_hexpand(check1, TRUE); > gtk_widget_set_vexpand(check1, TRUE); > > GtkWidget *check2=gtk_check_button_new_with_label("Check2"); > gtk_widget_set_hexpand(check2, TRUE); > gtk_widget_set_vexpand(check2, TRUE); > gtk_widget_set_halign(check2, GTK_ALIGN_CENTER); > > GtkWidget *label=gtk_label_new("Label"); > gtk_widget_set_hexpand(label, TRUE); > gtk_widget_set_vexpand(label, TRUE); > > GtkWidget *grid=gtk_grid_new(); > gtk_container_set_border_width(GTK_CONTAINER(grid), 20); > gtk_grid_attach(GTK_GRID(grid), check1, 0, 0, 1, 1); > gtk_grid_attach(GTK_GRID(grid), check2, 0, 1, 1, 1); > gtk_grid_attach(GTK_GRID(grid), label, 0, 2, 1, 1); > > GtkWidget *expander=gtk_expander_new("Expander"); > gtk_container_add(GTK_CONTAINER(expander), grid); > > gtk_container_add(GTK_CONTAINER(window), expander); > > 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
gtk_widget_size_allocate(): attempt to allocate widget with width -19 and height 1
Hi I have an application built using Glade which has a grid inside an expander, when I expand the expander I get a Gtk-WARNING even though everything works as expected. Through trial and error I traced the problem to the left margin set on the grid widget, if it's zero I don't get a warning. I tried putting the grid inside a box but setting a margin on the box has the same problem. Any ideas how to make the warning go away? It must be grid widget related because I use expanders a lot but this is the only one with a grid inside it. I'm using Gtk 3.14 and here is a snippet of the Glade XML if it helps True True True True False start start 20 immediate 4 20 Not a show stopper but annoying. Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Scroll position problem (gtk2)
"Other than the value field" Signal Details The “changed” signal void user_function (GtkAdjustment *adjustment, gpointer user_data) Emitted when one or more of the GtkAdjustment fields have been changed, other than the value field. You might want to try using https://developer.gnome.org/gtk2/stable/GtkAdjustment.html#gtk-adjustment-clamp-page On Sat, 2017-08-26 at 22:23 -0400, Matthew A. Postiff wrote: > I have a GtkWidget *A that contains another GtkWidget *B. The web > content of B changes from B_1 to B_2 when the user clicks a link inside > of it. When I click the "Back" button in B_2, I want it to return to B_1 > at the last known scroll position. This is the code that I thought would > do it--by remembering the former vertical adjustment and then setting it > once the old content re-appears: > > webkit_web_view_load_string (WEBKIT_WEB_VIEW (B), > htmlwriter.html.c_str(), NULL, NULL, NULL); > // Scroll to the position that was stored while this url was last active. > GtkAdjustment * adjustment = gtk_scrolled_window_get_vadjustment > (GTK_SCROLLED_WINDOW (A)); > gtk_adjustment_set_value (adjustment, scrolling_position[active_url]); > <<=== This line doesn't do anything > > > scrolling_position[active_url] returns a value, say 1000, and the > gtk_adjustment_set doesn't seem to have any effect. > Any pointers on how to fix this? > Thank you, > Matt > ___ > 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
GtkTreeView and selected column
Hi I have a bunch of toggles in a TreeView with their state bound to entries in a model, what's the best way to find out which model column to modify in my toggled callback? I'm passing the TreeViewColumn in the userdata but can't find a way to get back the attribute that binds the toggle state to the model. Any help much appreciated. Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: disabling mouse scroll on GtkComboBox and spin buttons
I sent a post about this in January. My solution retains the scrolling feature but disables it when scrolling the parent window. Note that each combobox is inside an event box and hence the gtk_bin_get_child in combobox_scroll_fix. static gboolean _block_scroll = TRUE; static void combobox_no_scroll(GtkWidget *combo, gpointer data){ if(_block_scroll) g_signal_stop_emission_by_name(combo, "scroll-event"); } static void combobox_focus_in(GtkWidget *combo, gpointer data){ _block_scroll = TRUE; } static void combobox_motion_notify(GtkWidget *combo, gpointer data){ _block_scroll = FALSE; } static void combobox_scroll_fix(GtkWidget *w){ g_signal_connect(w, "enter-notify-event", G_CALLBACK(combobox_focus_in), NULL); g_signal_connect(w, "motion-notify-event", G_CALLBACK(combobox_motion_notify), NULL); g_signal_connect(gtk_bin_get_child(GTK_BIN(w)), "scroll-event", G_CALLBACK(combobox_no_scroll), NULL); } On Sun, 2016-05-22 at 23:38 +0530, Lokesh Chakka wrote: > thanks guys > > I am using like this: > > g_signal_connect( spin_button, "scroll-event", G_CALLBACK(gtk_true), NULL ); > g_signal_connect( combo_box, "scroll-event", G_CALLBACK(gtk_true), NULL ); > > issue resolved.. > > Thanks & Regards > -- > Lokesh Chakka, > Mobile: 9731023458 > > On Sun, May 22, 2016 at 8:48 PM, Ben Iofelwrote: > > > There's a utility function for just returning true: gtk_true > > > > On Sun, May 22, 2016, 6:53 AM wrote: > > > > > On 22 May 2016 at 10:57, Florian Pelz > > wrote: > > > > On 05/22/2016 11:54 AM, jcup...@gmail.com wrote: > > > >> x = gtk_combo_box_new_text(); > > > >> g_signal_connect(x, "scroll-event", G_CALLBACK(true_cb), NULL); > > > >> ... > > > > > > > > Ah yes, this is a much better way. > > > > > > I'm not sure it'd work for spin buttons though :-( > > > > > > Something like your event masks, Florian, would probably be necessary for > > > that. > > > > > > John > > > ___ > > > 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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Confused about radio menu items and signals
I'm no expert.., but seems like maybe your radio group isn't the same for your 3 gtk_radio_menu_item_new_with_mnemonic calls, otherwise Gtk handles toggling of the radio buttons for you. Note, to prevent your callback being triggered when you call gtk_check_menu_item_set_active, you can use g_signal_handlers_block_by_func or one of its variants. On Mon, 2016-05-09 at 22:34 -0400, Matt Postiff wrote: > Hi, > > Still learning with gtk2. I have a menu with a submenu. That submenu > contains items for three mutually exclusive states in my program: A, B, and > C. > Each menu item is created with code like: > A_menu_item = gtk_radio_menu_item_new_with_mnemonic(group, "label") > > In the constructor, my program does > gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (A_menu_item), > true); // default > to set the checkmark next to A to start things. > > Then if the user clicks on Menu | Submenu | B, it was my understanding > that B would get the checkmark/true, and A's checkmark would be auto > erased/false and I could process what is necessary when B becomes true. > > I have a shared handler for activate signal on these menu items, and > when B is clicked, I see a situation where both A and B are true. What > am I missing? > > I thought OK, maybe gtk leaves it to me to figure out which radio item > needs to be turned on, and turn the rest off. But this has me call > gtk_check_menu_item_set_active(menuitem, false); > for each of the menuitems that shouldn't be on. This generates more > signals to my signal handler, and I end up with a mess of nested calls > to the signal handler and my program gets totally confused, not to > mention its author. > > Thanks for any guidance. You all have been helpful to me before :-) > > Matt > > ___ > 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
Toolbar overflow arrow
Hi In my application when the toolbar is wider than the application window it shows the arrow but always appears to reserve enough space to the right of the arrow to allow for the widest item in the drop down menu. Is there some property that controls this behaviour? I'm running Gtk version 3.14. Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Inadvertently changing spin/combobox values while scrolling
Hi I'm sure most people have encountered this problem at some point, you are scrolling a window which contains spinboxes or comboboxes and you accidentally change a value or setting. I find Glade especially bad in this respect. In my own application I tried blocking the scroll-events from the comboboxes and while this does solve the problem, it removes a nice usability feature. It occurred to me that scrolling on a combobox requires that you point to it first, ie a pointer motion, so in an enter-notify callback I block scrolling but a pointer-motion callback enables it again. This works surprising well, you can whiz up and down and the cursor just passes over the comboboxes without them changing values but if you stop and scroll on a combobox it changes. Any thoughts? BTW, I had to use an event box to get the events for the combobox, is this correct or should I have been able to get them directly from the combobox? Cheers, Franco ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Place window at bottom left
On Tue, 2016-01-05 at 12:24 +0100, rastersoft wrote: > And other window managers? That's the problem... Sorry, misunderstood your post, I thought you wanted to place the window above the taskbar. > > El 05/01/16 a las 03:06, Franco Broi escribió: > > I find that the window manager (I'm using Cinnamon) will move the window > > if the bottom overlaps a taskbar. > > > > On Tue, 2016-01-05 at 00:25 +0100, rastersoft wrote: > >> Hi all: > >> > >> I want to place a window at the bottom-left part of the screen. The > >> first idea is to get the screen resolution and substract the window > >> size; unfortunately, desktops can have taskbars, so the desktop size is > >> always smaller than the physical resolution. > >> > >> How can I do that? How can I get the desktop size, after removing the > >> space used by taskbars? > >> > >> Thanks. > >> > > > > > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Place window at bottom left
I find that the window manager (I'm using Cinnamon) will move the window if the bottom overlaps a taskbar. On Tue, 2016-01-05 at 00:25 +0100, rastersoft wrote: > Hi all: > > I want to place a window at the bottom-left part of the screen. The > first idea is to get the screen resolution and substract the window > size; unfortunately, desktops can have taskbars, so the desktop size is > always smaller than the physical resolution. > > How can I do that? How can I get the desktop size, after removing the > space used by taskbars? > > Thanks. > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Widgets not updating until you move the cursor
I'm building using Gtk 3.14 and have tested on 3.18 and see the same sort of thing. As I said, not a show stopper but sometimes in my application the user can be fooled into to thinking they are looking at an updated display when in fact nothing has changed. On Fri, 2016-01-01 at 12:57 +0100, rastersoft wrote: > > El 01/01/16 a las 12:38, Enno Borgsteede escribió: > > Op 01-01-16 om 12:01 schreef rastersoft: > >> Hi: > >> > >> I noticed a similar effect with the "open file" widget/window, where > >> some entries doesn't show the icon until I move the cursor over them, or > >> do a scroll with the mouse wheel. > > Right. That's where I see this in Gramps too. As promised, here's the > > Gtk version reported by Gramps: > > > > gtk++ : 3.10.8 > > > > On Linux some entries means less that 10 %. My nVidia driver version > > is 352.63. Card type is GT 740M. > > I have the same effect with an ATI graphics card and the RadeonSI free > driver. > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Widgets not updating until you move the cursor
On Thu, 2015-12-31 at 16:35 -0500, Rena wrote: > On Wed, Dec 30, 2015 at 7:32 PM, Franco Broi <fra...@bordernet.com.au> > wrote: > > > > > Is it just me or has anyone else noticed peculiar behaviour with Gtk 3 > > generally with respect to updates only happening after the cursor is > > moved? I've seen it a lot in my applications but also in stock apps such > > as Evolution and Rhythmbox - the most obvious example is in the shuffle > > option of Rhythmbox where rows in the play-queue only update as the > > cursor passes over them. > > > > It's been bugging me for a while so I thought I would ask. > > > > Cheers and best wishes for the new year! > > > > ___ > > gtk-app-devel-list mailing list > > gtk-app-devel-list@gnome.org > > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > > > > I wonder if this is the same issue I have with two out of my three > Raspberry Pi systems (all running Arch), where no GTK widgets will redraw > when the cursor *is* over them or their descendants. > Doesn't really seem like the same sort of thing but could be related if there's a systemic problem somewhere I suppose. I've also seen strange scrolling artefacts, like in Yelp when scrolling to the bottom of a page, if the cursor is moved in the window the page jerks down moving the bottom few lines out of view. And in Glade where some of the components at the bottom of the sidebar scroll out of view when you try to select them - this seems eerily similar to a focus issue I had a few days ago. This all seems like a pretty bad bug but it's been around for quite a long time (to my knowledge) and I've never found any reference in searches I've done about it so either people know about it and have been ignoring it, ie not a show stopper just annoying, or else it only effects a limited number of people, which is why I asked the question. Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Widgets not updating until you move the cursor
Is it just me or has anyone else noticed peculiar behaviour with Gtk 3 generally with respect to updates only happening after the cursor is moved? I've seen it a lot in my applications but also in stock apps such as Evolution and Rhythmbox - the most obvious example is in the shuffle option of Rhythmbox where rows in the play-queue only update as the cursor passes over them. It's been bugging me for a while so I thought I would ask. Cheers and best wishes for the new year! ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
gtk_widget_grab_focus sets scrollbar adjustments to 0
Hi I have a drawingarea inside a scrolled window for which I'd like to grab the focus so the user can use keyboard inputs but I want to do it without changing the scrolled window position. What I'm finding is the gtk_widget_grab_focus call on the drawable results in the scrolled window adjustments being set to zero. This is the traceback: #4 0x00386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0 #5 0x7757686a in gtk_adjustment_value_changed () at /lib64/libgtk-3.so.0 #6 0x775d22c8 in gtk_container_real_set_focus_child () at /lib64/libgtk-3.so.0 #7 0x00386a01301b in g_cclosure_marshal_VOID__OBJECTv () at /lib64/libgobject-2.0.so.0 #8 0x00386a00ff64 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0 #9 0x00386a029b60 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0 #10 0x00386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0 #11 0x777b2138 in gtk_widget_real_grab_focus () at /lib64/libgtk-3.so.0 #12 0x00386a00ff64 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0 #13 0x00386a029b60 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0 #14 0x00386a02a3af in g_signal_emit () at /lib64/libgobject-2.0.so.0 #15 0x777b09da in gtk_widget_grab_focus () at /lib64/libgtk-3.so.0 I can see the code in gtk_container_real_set_focus_child calling gtk_adjustment_clamp_page but don't understand why and I don't see any way to stop it from doing it. My workaround for the moment is to get the adjustment values before the grab and set them again after but this is seems a bit of a hack. Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: gtk_widget_grab_focus sets scrollbar adjustments to 0
On Mon, 2015-12-28 at 19:26 +0900, Tristan Van Berkom wrote: > On Mon, 2015-12-28 at 18:01 +0800, Franco Broi wrote: > > Hi > > > > I have a drawingarea inside a scrolled window for which I'd like to > > grab > > the focus so the user can use keyboard inputs but I want to do it > > without changing the scrolled window position. What I'm finding is > > the > > gtk_widget_grab_focus call on the drawable results in the scrolled > > window adjustments being set to zero. > > > [...] > > > I can see the code in gtk_container_real_set_focus_child calling > > gtk_adjustment_clamp_page but don't understand why and I don't see > > any > > way to stop it from doing it. > [...] > > Hi, >the reasoning is that usually focus is not given to the direct child > of a scrolled window, but to another grandchild. > > This usually makes sense so that when using keynav and tabbing from > widget to widget inside a scrolled area, the scrolled window will > automatically adjust itself to reveal the new button/entry/widget which > may otherwise be hidden (so the user doesnt end up having to manually > move the scrollbars to see what widget is focused). > > For your case, you should be able to opt out by simply clearing the > focus adjustments with the gtk_container_set_focus_[v/h]adjustment() > APIs. Thanks for the quick reply Tristan. Had me flummoxed for a while until I worked out that it is the adjustments of the scrolledwindow's child that need to be cleared - the viewport?? gtk_container_set_focus_vadjustment(GTK_CONTAINER(gtk_bin_get_child(GTK_BIN(sw))), NULL); Cheers, ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
GtkFileChooser preview widget
Hi I'm trying to add a preview widget that is a drawing area for cairo to my file chooser but have encountered a couple of problems. I have attached a configure-event signal to the drawing-area to redraw when the widget resizes but this is causing problems on initialisation, I get the following error: Gtk-WARNING **: GtkDrawingArea 0x1700340 is mapped but visible=1 child_visible=1 parent GtkBox 0x1c1eba0 mapped=0 I believe this is coming from a call to gtk_file_chooser_set_preview_widget_active(w, FALSE) which is required to prevent the file chooser from displaying an empty box for the preview widget when the file chooser first starts. After the initial error, the file chooser behaves correctly. Below are the configure-event and update-preview callbacks. Any idea what I'm doing wrong? Cheers, Franco static cairo_surface_t *colour_scheme_preview_surface; static gboolean colour_scheme_update_preview_cb(GtkWidget *widget, gpointer data) { gboolean preview = FALSE; char *filename = gtk_file_chooser_get_preview_filename(GTK_FILE_CHOOSER(widget)); if(filename){ if(pegasus_colour_bar_init(DS_PREVIEW, colour_scheme_preview_surface, filename)){ preview = TRUE; gtk_widget_queue_draw(GTK_WIDGET(data)); } free(filename); } gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(widget), preview); return FALSE; } static gboolean colour_scheme_configure_event_cb(GtkWidget *widget, GdkEventConfigure *event, gpointer data) { if(colour_scheme_preview_surface) cairo_surface_destroy(colour_scheme_preview_surface); gint width, height; width = gtk_widget_get_allocated_width(widget); height = gtk_widget_get_allocated_height(widget); colour_scheme_preview_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); colour_scheme_update_preview_cb(GTK_WIDGET(data), widget); return FALSE; } ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list