Community
Participate
Working Groups
This patch omits use of deprecated constants GTK_WIDGET_SET_X and GTK_WIDGET_SET_Y using GtkAllocation instead: http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/commit/?h=gtk_widget_set_xy
Shouldn't we use gtk_widget_size_allocate () instead of gtk_widget_set_allocation () in this patch? The documentation for gtk_widget_set_allocation () says this clearly - "This should not be used directly, but from within a widget's size_allocate method."
(In reply to comment #1) > Shouldn't we use gtk_widget_size_allocate () instead of > gtk_widget_set_allocation () in this patch? The documentation for > gtk_widget_set_allocation () says this clearly - "This should not be used > directly, but from within a widget's size_allocate method." On the one hand, I would say that accessing size_allocate directly is exactly what deprecated constants do, and this function replicates their actions. However, I agree that we should follow documentation and make best practices we can, thus using gtk_widget_size_allocate() is better. Thank you for pointing that out Arun, here is revised patch: http://fedorapeople.org/cgit/aspektor/public_git/eclipse.platform.swt.git/commit/?h=gtk_widget_set_xy_ Regards, Anatoly
Sorry, the first patch is correct. We are not doing a gtk_widget_size_allocate() for performance reasons. I am not sure this is needed anymore, but we should keep this the same for now and open a separate bug to investigate whether the optimization still makes sense.
Ok, if you prefer first patch, please use first patch. Regards, Anatoly
(In reply to comment #3) > Sorry, the first patch is correct. We are not doing a > gtk_widget_size_allocate() for performance reasons. I am not sure this is > needed anymore, but we should keep this the same for now and open a separate > bug to investigate whether the optimization still makes sense. Silenio, to confirm, are you saying that usage of gtk_widget_size_allocate() could cause performance issues but directly invoking gtk_widget_set_allocation() is okay?
Yes. The code path that checks for ZERO_WIDTH/ZERO_HEIGHT was done to avoid gtk_widget_size_allocate(). I do not remember all the details here. I believe the root problem was either performance or support for zero sized widgets which does not work on GTK itself. gtk_widget_size_allocate() would probably print warnings to the console if called with width,height equals 0,0. Take a look at the other code path, forceResize() calls gtk_widget_size_allocate() but sets the size to 1,1 instead of 0,0. We need to check the history of the code to understand all the details. For now, let's just write equivalent code using gtk_widget_set_allocation().
Pushed the patch from comment 0 - http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6207053cbabec2bceac5c0fcadb16091fc8a4c80 and raised bug 386921 for further investigation as suggested in comment 3. Thanks!