From d3f6aca4ee8c2671f518a133ca3b1690b6c67ba1 Mon Sep 17 00:00:00 2001 From: Hugo Pereira Da Costa Date: Mon, 19 Oct 2009 22:51:31 +0000 Subject: [PATCH] re-enabled sizeGrip in preview mode, with correct handling of parent windowID svn path=/trunk/KDE/kdebase/workspace/; revision=1037767 --- clients/oxygen/oxygenclient.cpp | 2 +- clients/oxygen/oxygensizegrip.cpp | 44 ++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index 2a5d5eb24c..af4efe638b 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -838,7 +838,7 @@ namespace Oxygen if( configuration_.drawSizeGrip() ) { - if( !( hasSizeGrip() || isPreview() ) ) createSizeGrip(); + if( !hasSizeGrip() ) createSizeGrip(); } else if( hasSizeGrip() ) deleteSizeGrip(); diff --git a/clients/oxygen/oxygensizegrip.cpp b/clients/oxygen/oxygensizegrip.cpp index a28be4eb58..21dbf6196d 100644 --- a/clients/oxygen/oxygensizegrip.cpp +++ b/clients/oxygen/oxygensizegrip.cpp @@ -43,7 +43,7 @@ namespace Oxygen //_____________________________________________ OxygenSizeGrip::OxygenSizeGrip( OxygenClient* client ): - QWidget( 0 ), + QWidget(0), client_( client ) { @@ -76,6 +76,7 @@ namespace Oxygen show(); } + //_____________________________________________ OxygenSizeGrip::~OxygenSizeGrip( void ) {} @@ -89,22 +90,34 @@ namespace Oxygen { WId window_id = client().windowId(); - assert( window_id ); + if( client().isPreview() ) { + + kDebug(1212) << "Using kcommondecoration::widget()" << endl; + setParent( client().widget() ); + + } else if( window_id ) { + + kDebug(1212) << "Using Window ID" << endl; + WId current = window_id; + while( true ) + { + WId root, parent = 0; + WId *children = 0L; + uint child_count = 0; + XQueryTree(QX11Info::display(), current, &root, &parent, &children, &child_count); + if( parent && parent != root && parent != current ) current = parent; + else break; + } + + // reparent + XReparentWindow( QX11Info::display(), winId(), current, 0, 0 ); + } else { + + kDebug(1212) << "Unable to find valid parent. Hiding" << endl; + hide(); - WId current = window_id; - while( true ) - { - WId root, parent = 0; - WId *children = 0L; - uint child_count = 0; - XQueryTree(QX11Info::display(), current, &root, &parent, &children, &child_count); - if( parent && parent != root && parent != current ) current = parent; - else break; } - // reparent - XReparentWindow( QX11Info::display(), winId(), current, 0, 0 ); - } //_____________________________________________ @@ -181,7 +194,8 @@ namespace Oxygen // check client window id if( !client().windowId() ) break; client().widget()->setFocus(); - client().decoration()->performWindowOperation( KDecorationDefines::ResizeOp ); + if( client().decoration() ) + { client().decoration()->performWindowOperation( KDecorationDefines::ResizeOp ); } } break;