From 7b4d5abb473cad762dfa04c4e01f0ec8fdde9f29 Mon Sep 17 00:00:00 2001 From: Jussi Kekkonen Date: Wed, 18 Nov 2009 12:48:48 +0000 Subject: [PATCH] Adding option to turn on/off the automove of titlebar tab, automove doesn't work with composite anyway svn path=/trunk/KDE/kdebase/workspace/; revision=1050951 --- clients/b2/b2client.cpp | 24 +++++++++++++++++++----- clients/b2/b2client.h | 6 +++++- clients/b2/config/config.cpp | 16 ++++++++++++++++ clients/b2/config/config.h | 2 ++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp index 451dd64890..829d32d663 100644 --- a/clients/b2/b2client.cpp +++ b/clients/b2/b2client.cpp @@ -8,6 +8,9 @@ improvements, customizable menu double click action and button hover effects are Copyright (c) 2003, 2004, 2006 Luciano Montanaro + + Added option to turn off titlebar autorelocation + Copyright (c) 2009 Jussi Kekkonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -96,7 +99,7 @@ static QPixmap *pixmap[P_NUM_PIXMAPS]; static QPixmap* titleGradient[2] = {0, 0}; -static int thickness = 4; // Frame thickness +static int thickness = 3; // Frame thickness static int buttonSize = 16; enum DblClickOperation { @@ -111,6 +114,7 @@ static DblClickOperation menu_dbl_click_op = NoOp; static bool pixmaps_created = false; static bool colored_frame = false; static bool do_draw_handle = true; +static bool do_amove_tb = true; static bool drawSmallBorders = false; // ===================================== @@ -140,6 +144,7 @@ static void read_config(B2ClientFactory *f) KConfigGroup conf(&_conf, "General"); colored_frame = conf.readEntry("UseTitleBarBorderColors", false); do_draw_handle = conf.readEntry("DrawGrabHandle", true); + do_amove_tb = conf.readEntry("AutoMoveTitleBar", true); drawSmallBorders = !options()->moveResizeMaximizedWindows(); QString opString = conf.readEntry("MenuButtonDoubleClickOperation", "NoOp"); @@ -155,7 +160,7 @@ static void read_config(B2ClientFactory *f) switch (options()->preferredBorderSize(f)) { case KDecoration::BorderTiny: - thickness = 2; + thickness = 1; break; case KDecoration::BorderLarge: thickness = 5; @@ -174,7 +179,7 @@ static void read_config(B2ClientFactory *f) break; case KDecoration::BorderNormal: default: - thickness = 4; + thickness = 3; } } @@ -594,6 +599,12 @@ bool B2Client::mustDrawHandle() const } } +bool B2Client::autoMoveTitlebar() const +{ + return do_amove_tb; +} + + void B2Client::iconChange() { if (button[BtnMenu]) @@ -687,7 +698,7 @@ void B2Client::paintEvent(QPaintEvent* e) p.drawRect(0, t.bottom() - thickness + 1, fWidth, fHeight - bb + thickness); - if (thickness >= 2) { + if (thickness >= 1) { // inner window rect p.drawRect(thickness - 1, t.bottom(), fWidth - 2 * (thickness - 1), fHeight - bDepth + 2); @@ -754,7 +765,7 @@ void B2Client::paintEvent(QPaintEvent* e) we now might have the space available, but the titlebar gets no visibilitinotify events until its state changes, so we just try */ - if (titlebar->isFullyObscured()) { + if (titlebar->isFullyObscured()) { //FIXME this doesn't work in composited X /* We first see, if our repaint contained the titlebar area */ QRegion reg(QRect(0, 0, width(), buttonSize + 4)); reg = reg.intersect(e->region()); @@ -986,6 +997,8 @@ void B2Client::unobscureTitlebar() so we look at all windows above us (stacking_order) merging their masks, intersecting it with our titlebar area, and see if we can find a place not covered by any window */ + if (autoMoveTitlebar()) // I'm not sure if earlier check does it right, so let's make it sure, DO WE AUTOMOVE? + { if (in_unobs) { return; } @@ -1000,6 +1013,7 @@ void B2Client::unobscureTitlebar() titleMoveAbs(reg.boundingRect().x()); } in_unobs = 0; + } // if (autoMoveTitlebar()) } static void redraw_pixmaps() diff --git a/clients/b2/b2client.h b/clients/b2/b2client.h index 337512dc93..00701b207f 100644 --- a/clients/b2/b2client.h +++ b/clients/b2/b2client.h @@ -1,9 +1,12 @@ /********************************************************************* B-II KWin Client - + Changes: Customizable button positions by Karol Szwed Ported to the kde3.2 API by Luciano Montanaro + + Added option to turn off titlebar autorelocation + Copyright (c) 2009 Jussi Kekkonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -152,6 +155,7 @@ private: void positionButtons(); void calcHiddenButtons(); bool mustDrawHandle() const; + bool autoMoveTitlebar() const; enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose, BtnHelp, BtnShade, BtnResize, BtnCount}; diff --git a/clients/b2/config/config.cpp b/clients/b2/config/config.cpp index aa8abfc1fd..c3cd6d9806 100644 --- a/clients/b2/config/config.cpp +++ b/clients/b2/config/config.cpp @@ -6,6 +6,7 @@ http://gallium.n3.net/ Copyright (c) 2007 Luciano Montanaro + Automove titlebar bits Copyright (c) 2009 Jussi Kekkonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,6 +69,14 @@ B2Config::B2Config(KConfig *conf, QWidget *parent) i18n("When selected, decorations are drawn with a \"grab handle\" " "in the bottom right corner of the windows; " "otherwise, no grab handle is drawn.")); + + // Automove Titlebar + autoMoveTitlebarCb = new QCheckBox( + i18n("Automove titlebar"), gb); + autoMoveTitlebarCb->setWhatsThis( + i18n("When selected, Titlebars are automatically relovated " + "to visible place; " + "otherwise, only moved manually.")); // Double click menu option support actionsGB = new QGroupBox(i18n("Actions Settings"), gb); @@ -100,6 +109,8 @@ B2Config::B2Config(KConfig *conf, QWidget *parent) this, SLOT(slotSelectionChanged())); connect(showGrabHandleCb, SIGNAL(clicked()), this, SLOT(slotSelectionChanged())); + connect(autoMoveTitlebarCb, SIGNAL(clicked()), + this, SLOT(slotSelectionChanged())); connect(menuDblClickOp, SIGNAL(activated(int)), this, SLOT(slotSelectionChanged())); // Make the widgets visible in kwindecoration @@ -129,6 +140,9 @@ void B2Config::load(const KConfigGroup & /*conf*/) override = cg.readEntry("DrawGrabHandle", true); showGrabHandleCb->setChecked(override); + override = cg.readEntry( "AutoMoveTitleBar", true ); + autoMoveTitlebarCb->setChecked(override); + QString returnString = cg.readEntry( "MenuButtonDoubleClickOperation", "NoOp"); @@ -167,6 +181,7 @@ void B2Config::save(KConfigGroup & /*conf*/) KConfigGroup cg(b2Config, "General"); cg.writeEntry("UseTitleBarBorderColors", cbColorBorder->isChecked()); cg.writeEntry("DrawGrabHandle", showGrabHandleCb->isChecked()); + cg.writeEntry("AutoMoveTitleBar", autoMoveTitlebarCb->isChecked()); cg.writeEntry("MenuButtonDoubleClickOperation", opToString(menuDblClickOp->currentIndex())); // Ensure others trying to read this config get updated @@ -178,6 +193,7 @@ void B2Config::defaults() { cbColorBorder->setChecked(false); showGrabHandleCb->setChecked(true); + autoMoveTitlebarCb->setChecked(true); menuDblClickOp->setCurrentIndex(0); } diff --git a/clients/b2/config/config.h b/clients/b2/config/config.h index d075a3d71f..c5bc33ce0a 100644 --- a/clients/b2/config/config.h +++ b/clients/b2/config/config.h @@ -6,6 +6,7 @@ http://gallium.n3.net/ Copyright (c) 2007 Luciano Montanaro + Automove titlebar bits Copyright (c) 2009 Jussi Kekkonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,6 +55,7 @@ private: KConfig *b2Config; QCheckBox *cbColorBorder; QCheckBox *showGrabHandleCb; + QCheckBox *autoMoveTitlebarCb; QGroupBox *actionsGB; KComboBox *menuDblClickOp; QWidget *gb;