Gtk2: fixed TPageControl page changing. issues #18754 and #21026

git-svn-id: trunk@35125 -
This commit is contained in:
zeljko 2012-02-04 16:17:32 +00:00
parent 3f31fe6afc
commit e96f8fdf7b

View File

@ -490,6 +490,7 @@ procedure TGtkDeviceContext.SetWidget(AWidget: PGtkWidget; AWindow: PGdkWindow;
var
ClientWidget: PGtkWidget;
W: PGtkWidget;
begin
if FWidget <> nil then
RaiseWidgetAlreadySet;
@ -521,8 +522,16 @@ begin
AWindow := GetControlWindow(ClientWidget);
if AWindow = nil then
begin
//force creation
gtk_widget_realize(ClientWidget);
W := gtk_widget_get_parent(AWidget);
//we are forcing window creation but not for GtkNotebook
//see issue #18754 and #20126
//Zeljko:This part should be NOT BE REMOVED since TToolbar, TFrame
//TGroupBox etc...depend on this. eg.TToolbar will lock
//mouse without realizing clientWidget.Also if THintWindow is
//visible it crashes sometimes. SO JUST NOTEBOOK !
if (W <> nil) and not GTK_IS_NOTEBOOK(W) then
gtk_widget_realize(ClientWidget);
AWindow := GetControlWindow(ClientWidget);
// Don't raise an exception. Not all operations needs drawable. For example font metrics:
// http://bugs.freepascal.org/view.php?id=14035