- Removing patch by Diego Iastrubini that attempted to fix the bidi issues in

clients by adding an unnecessary 'enable-bidi' checkbox which was never agreed
  upon on the kwin mailing list.

  The use of --reverse is sufficient without needing this checkbox.
  Please discuss largish patches like these first, especially during a feature
  freeze!

  (Everyone also seems to forget the kwin-styles in kdeartwork)

- Make clients look the same with --reverse instead of the broken state they
  were in previously. If the button ordering is not to your liking in reverse
  mode, just change the button positions. (Or send patches for those clients
  that have not got these features yet).

- Clean up popupMenu handling somewhat.

- Remove a global static object in keramik.

svn path=/trunk/kdebase/kwin/; revision=174079
This commit is contained in:
Karol Szwed 2002-08-27 15:12:14 +00:00
parent 8e7f66bc65
commit a33f4313ab
30 changed files with 329 additions and 550 deletions

View file

@ -405,34 +405,19 @@ B2Client::B2Client( Workspace *ws, WId w, QWidget *parent,
titlebar->setMinimumWidth(16);
titlebar->setFixedHeight(20);
QHBoxLayout *titleLayout = new QHBoxLayout(titlebar);
titleLayout->setSpacing(1);
QBoxLayout *titleLayout = new QBoxLayout(titlebar, QBoxLayout::LeftToRight, 0, 1, 0);
titleLayout->addSpacing(3);
if (options->customButtonPositions())
{
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
addButtons( options->titleButtonsRight(), tips, titlebar, titleLayout );
titleLayout->addItem(titlebar->captionSpacer);
addButtons( options->titleButtonsLeft(), tips, titlebar, titleLayout );
}
else{
addButtons( options->titleButtonsLeft(), tips, titlebar, titleLayout );
titleLayout->addItem(titlebar->captionSpacer);
addButtons( options->titleButtonsRight(), tips, titlebar, titleLayout );
}
} else {
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
addButtons( "IAX", tips, titlebar, titleLayout );
titleLayout->addItem(titlebar->captionSpacer);
addButtons( "MSH", tips, titlebar, titleLayout );
}
else{
addButtons( "MSH", tips, titlebar, titleLayout );
titleLayout->addItem(titlebar->captionSpacer);
addButtons( "IAX", tips, titlebar, titleLayout );
}
}
titleLayout->addSpacing(3);
@ -450,15 +435,13 @@ B2Client::B2Client( Workspace *ws, WId w, QWidget *parent,
}
void B2Client::addButtons(const QString& s, const QString tips[],
B2Titlebar* tb, QHBoxLayout* titleLayout)
B2Titlebar* tb, QBoxLayout* titleLayout)
{
int str_len = s.length();
if (str_len <= 0)
if (s.length() <= 0)
return;
for(unsigned int i = 0; i < s.length(); i++) {
switch( (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
? s[str_len-i-1].latin1():s[i].latin1()) {
switch(s[i].latin1()) {
case 'M': // Menu button
if (!button[BtnMenu]) {
button[BtnMenu] = new B2Button(this, tb, tips[BtnMenu]);
@ -794,9 +777,10 @@ void B2Client::activeChange(bool on)
void B2Client::menuButtonPressed()
{
QPoint pos = button[BtnMenu]->mapToGlobal(button[BtnMenu]->
QPoint menupoint = button[BtnMenu]->mapToGlobal(button[BtnMenu]->
rect().bottomLeft());
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( menupoint, this );
button[BtnMenu]->setDown(false);
}
void B2Client::slotReset()

View file

@ -17,7 +17,7 @@
#include "../../kwinbutton.h"
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
class QGridLayout;
namespace KWinInternal {
@ -111,7 +111,7 @@ private slots:
void maxButtonClicked();
private:
void addButtons(const QString& s, const QString tips[],
B2Titlebar* tb, QHBoxLayout* titleLayout);
B2Titlebar* tb, QBoxLayout* titleLayout);
void positionButtons();
void calcHiddenButtons();
enum ButtonType{BtnMenu=0, BtnSticky, BtnIconify, BtnMax, BtnClose,

View file

@ -625,7 +625,8 @@ KDEDefaultClient::KDEDefaultClient( Workspace *ws, WId w, QWidget *parent,
g->addWidget(windowWrapper(), 3, 1);
// without the next line, unshade flickers
g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed,
QSizePolicy::Expanding ) );
g->setRowStretch(3, 10); // Wrapped window
// Determine the size of the lower grab bar
@ -638,35 +639,23 @@ KDEDefaultClient::KDEDefaultClient( Workspace *ws, WId w, QWidget *parent,
g->addColSpacing(2, 4);
// Pack the titlebar HBox with items
hb = new QHBoxLayout();
hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0 );
hb->setResizeMode( QLayout::FreeResize );
g->addLayout ( hb, 1, 1 );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addClientButtons( options->titleButtonsRight() );
else
addClientButtons( options->titleButtonsLeft() );
titlebar = new QSpacerItem( 10, titleHeight, QSizePolicy::Expanding, QSizePolicy::Minimum );
titlebar = new QSpacerItem( 10, titleHeight, QSizePolicy::Expanding,
QSizePolicy::Minimum );
hb->addItem(titlebar);
hb->addSpacing(2);
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addClientButtons( options->titleButtonsLeft(), false );
else
addClientButtons( options->titleButtonsRight(), false );
}
void KDEDefaultClient::addClientButtons( const QString& s, bool isLeft )
{
if (s.length() > 0){
unsigned int i = 0;
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
i = s.length() - 1;
//for( ; (i < s.length()) && (i) ;) { // i>=0
for( ; ( i < s.length()) ;) { // i>=0
if (s.length() > 0)
for(unsigned int i = 0; i < s.length(); i++) {
switch( s[i].latin1() )
{
// Menu button
@ -750,16 +739,8 @@ void KDEDefaultClient::addClientButtons( const QString& s, bool isLeft )
case '_':
if ( !isTool() )
hb->addSpacing(2);
} // switch( ...
// this should be in the for() statment some how....
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
i--;
else
i++;
} // for( ...
} // if (s.length()....
}
}
}
@ -838,7 +819,9 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
QColorGroup g;
int offset;
KPixmap* upperGradient = isActive() ? aUpperGradient : iUpperGradient;
QPainter p(this);
// Obtain widget bounds.
@ -957,16 +940,20 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
QFontMetrics fm(fnt);
int captionWidth = fm.width(caption());
if (caption().isRightToLeft())
p2.drawTiledPixmap( r.x(), 0, r.width()-captionWidth-4, titleHeight+1, *titlePix );
p2.drawTiledPixmap( r.x(), 0, r.width()-captionWidth-4,
titleHeight+1, *titlePix );
else
p2.drawTiledPixmap( r.x()+captionWidth+3, 0, r.width()-captionWidth-4, titleHeight+1, *titlePix );
p2.drawTiledPixmap( r.x()+captionWidth+3, 0, r.width()-captionWidth-4,
titleHeight+1, *titlePix );
}
p2.setPen( options->color(Options::Font, isActive()) );
p2.drawText(r.x(), 1, r.width(), r.height(),
caption().isRightToLeft()?AlignRight:AlignLeft|AlignVCenter, caption() );
p2.drawText(r.x(), 1, r.width()-1, r.height(),
(caption().isRightToLeft() ? AlignRight : AlignLeft) | AlignVCenter,
caption() );
bitBlt( this, 2, 2, titleBuffer );
p2.end();
// Ensure a shaded window has no unpainted areas
@ -1089,8 +1076,8 @@ void KDEDefaultClient::menuButtonPressed()
{
QPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-1,
button[BtnMenu]->rect().bottomLeft().y()+2 );
QPoint pos = button[BtnMenu]->mapToGlobal( menupoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( button[BtnMenu]->mapToGlobal( menupoint ), this );
button[BtnMenu]->setDown(false);
}

View file

@ -22,7 +22,7 @@
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
namespace KWinInternal {
@ -109,7 +109,7 @@ class KDEDefaultClient : public KWinInternal::Client
int lastButtonWidth;
int titleHeight;
bool largeButtons;
QHBoxLayout* hb;
QBoxLayout* hb;
QSpacerItem* titlebar;
};

View file

@ -741,14 +741,11 @@ IceWMClient::IceWMClient( Workspace *ws, WId w, QWidget *parent, const char *nam
grid->addColSpacing(2, borderSizeX);
// Pack the titlebar with spacers and buttons
hb = new QHBoxLayout();
hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode( QLayout::FreeResize );
titleSpacerJ = addPixmapSpacer( titleJ );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()) )
addClientButtons( *titleButtonsRight );
else
addClientButtons( *titleButtonsLeft );
titleSpacerL = addPixmapSpacer( titleL );
@ -762,18 +759,11 @@ IceWMClient::IceWMClient( Workspace *ws, WId w, QWidget *parent, const char *nam
QSizePolicy::Preferred, QSizePolicy::Fixed );
hb->addItem(titlebar);
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()) ){
titleSpacerR = addPixmapSpacer( titleR );
titleSpacerB = addPixmapSpacer( titleB, QSizePolicy::Expanding, 1 );
titleSpacerM = addPixmapSpacer( titleM );
addClientButtons( *titleButtonsLeft );
}
else{
titleSpacerM = addPixmapSpacer( titleM );
titleSpacerB = addPixmapSpacer( titleB, QSizePolicy::Expanding, 1 );
titleSpacerR = addPixmapSpacer( titleR );
addClientButtons( *titleButtonsRight );
}
titleSpacerQ = addPixmapSpacer( titleQ );
@ -798,16 +788,10 @@ IceWMClient::~IceWMClient()
// in the button string 's'
void IceWMClient::addClientButtons( const QString& s )
{
/* QString ss = s;
if (QApplication::reverseLayout())
ss = clientHandler->reverseString( s );*/
int str_len = s.length();
if (str_len > 0)
for(unsigned int i = 0; i < str_len; i++)
if (s.length() > 0)
for(unsigned int i = 0; i < s.length(); i++)
{
switch ( (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))?
s[str_len-i-1].latin1():s[i].latin1() )
switch ( s[i].latin1() )
{
case 's':
// Create the menu icons, and render with the current mini-icon
@ -1370,14 +1354,12 @@ Client::MousePosition IceWMClient::mousePosition( const QPoint& p ) const
// Make sure the menu button follows double click conventions set in kcontrol
void IceWMClient::menuButtonPressed()
{
// Animate the menu button when pressed
if (button[BtnSysMenu])
button[BtnSysMenu]->animateClick();
QPoint menuPoint ( button[BtnSysMenu]->rect().bottomLeft() );
// Move to right if menu on rhs, otherwise on left
// and make this depend on windowWrapper(), not button.
QPoint pos = button[BtnSysMenu]->mapToGlobal( menuPoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( button[BtnSysMenu]->mapToGlobal(menuPoint), this );
button[BtnSysMenu]->setDown(false);
}

View file

@ -49,7 +49,7 @@
#include "../../kwinbutton.h"
class QLabel;
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
class QGridLayout;
namespace KWinInternal {
@ -164,7 +164,7 @@ class IceWMClient : public KWinInternal::Client
QSpacerItem* titleSpacerB;
QSpacerItem* titleSpacerR;
QSpacerItem* titleSpacerQ;
QHBoxLayout* hb;
QBoxLayout* hb;
QGridLayout* grid;
};

View file

@ -257,34 +257,18 @@ StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
button[4] = new ThreeButtonButton( this, 0, i18n("Maximize") );
button[5] = new KWinToolButton( this, 0, i18n("Close") );
QHBoxLayout* hb = new QHBoxLayout;
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
g->addLayout( hb, 0, 1 );
hb->addWidget( button[0] );
hb->addWidget( button[1] );
// hb->addWidget( button[2] );
int fh = fontMetrics().lineSpacing();
titlebar = new QSpacerItem(10, fh, QSizePolicy::Expanding,
QSizePolicy::Minimum );
hb->addItem( titlebar );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
hb->addWidget( button[5] );
hb->addWidget( button[4] );
hb->addWidget( button[3] );
if ( providesContextHelp() ) {
button[6] = new KWinToolButton( this, 0, i18n("Help") );
hb->addWidget( button[6] ); // help button
hb->addItem( new QSpacerItem( 5, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
button[6]->setIconSet( isActive() ? *question_mark_pix : *dis_question_mark_pix);
connect( button[6], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
}
button[6] = 0;
hb->addItem( titlebar );
// hb->addWidget( button[2] );
hb->addWidget( button[1] );
hb->addWidget( button[0] );
}
else{
hb->addWidget( button[0] );
hb->addWidget( button[1] );
// hb->addWidget( button[2] );
hb->addItem( titlebar );
button[6] = 0;
if ( providesContextHelp() ) {
button[6] = new KWinToolButton( this, 0, i18n("Help") );
@ -293,10 +277,10 @@ StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
button[6]->setIconSet( isActive() ? *question_mark_pix : *dis_question_mark_pix);
connect( button[6], SIGNAL( clicked() ), this, ( SLOT( contextHelp() ) ) );
}
hb->addWidget( button[3] );
hb->addWidget( button[4] );
hb->addWidget( button[5] );
}
for ( int i = 0; i < 7; i++) {
if ( !button[i] )
@ -325,8 +309,8 @@ StdClient::StdClient( Workspace *ws, WId w, QWidget *parent, const char *name )
button[5]->setIconSet(isActive() ? *close_pix : *dis_close_pix);
connect( button[5], SIGNAL( clicked() ), this, ( SLOT( closeWindow() ) ) );
// if ( button[6] ) {
// }
if ( button[6] ) {
}
if ( isTransient() ) {
@ -461,12 +445,10 @@ void StdClient::iconChange()
*/
void StdClient::menuButtonPressed()
{
// Animate the click when the menu button is pressed
button[0]->animateClick();
QPoint menupoint ( button[0]->rect().bottomLeft().x()-1,
button[0]->rect().bottomLeft().y()+2 );
QPoint pos = button[0]->mapToGlobal( menupoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( button[0]->mapToGlobal( menupoint ), this );
button[0]->setDown(false);
}

View file

@ -146,6 +146,8 @@ KeramikHandler::KeramikHandler()
settings_cache = NULL;
imageDict = new ImageDict;
// Create the button deco bitmaps
buttonDecos[ Menu ] = new QBitmap( 17, 17, menu_bits, true );
buttonDecos[ Sticky ] = new QBitmap( 17, 17, sticky_on_bits, true );
@ -186,6 +188,9 @@ KeramikHandler::~KeramikHandler()
if ( settings_cache )
delete settings_cache;
if ( imageDict )
delete imageDict;
}
@ -418,7 +423,6 @@ void KeramikHandler::readConfig()
settings_cache->iTitleColor = options->color( Options::TitleBar, false );
settings_cache->iTitleBlend = options->color( Options::TitleBlend, false );
settings_cache->buttonColor = options->color( Options::ButtonBg, true );
settings_cache->reverseBIDIWindows = options->reverseBIDIWindows();
}
delete c;
@ -492,11 +496,11 @@ QPixmap *KeramikHandler::composite( QImage *over, QImage *under )
QImage *KeramikHandler::loadImage( const QString &name, const QColor &col )
{
if ( col.isValid() ) {
QImage *img = new QImage( qembed_findImage(name).copy() );
QImage *img = new QImage( qembed_findImage(name)->copy() );
KIconEffect::colorize( *img, col, 1.0 );
return img;
} else
return new QImage( qembed_findImage(name).copy() );
return new QImage( qembed_findImage(name)->copy() );
}
@ -546,10 +550,6 @@ void KeramikHandler::reset()
needHardReset = true;
}
// bidi is always a mess..
if (settings_cache->reverseBIDIWindows != options->reverseBIDIWindows())
needHardReset = true;
// Update our config cache
settings_cache->aTitleColor = options->color( Options::TitleBar, true );
settings_cache->aTitleBlend = options->color( Options::TitleBlend, true );
@ -558,7 +558,7 @@ void KeramikHandler::reset()
settings_cache->buttonColor = options->color( Options::ButtonBg, true );
settings_cache->buttonsLeft = buttonsLeft;
settings_cache->buttonsRight = buttonsRight;
settings_cache->reverseBIDIWindows = options->reverseBIDIWindows();
// Do we need to recreate the pixmaps?
if ( pixmapsInvalid ) {
@ -721,7 +721,7 @@ KeramikClient::KeramikClient( Workspace *ws, WId w, QWidget *parent, const char
button[i] = NULL;
QVBoxLayout *mainLayout = new QVBoxLayout( this );
QHBoxLayout *titleLayout = new QHBoxLayout();
QBoxLayout *titleLayout = new QBoxLayout( 0, QBoxLayout::LeftToRight, 0, 0, 0 );
QHBoxLayout *windowLayout = new QHBoxLayout();
largeTitlebar = ( !maximizedVertical() && clientHandler->largeCaptionBubbles() );
@ -740,11 +740,6 @@ KeramikClient::KeramikClient( Workspace *ws, WId w, QWidget *parent, const char
titleLayout->setSpacing( buttonSpacing );
titleLayout->addSpacing( buttonMargin ); // Left button margin
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addButtons( titleLayout, options->customButtonPositions() ?
options->titleButtonsRight() : QString(default_left) );
else
addButtons( titleLayout, options->customButtonPositions() ?
options->titleButtonsLeft() : QString(default_left) );
@ -753,14 +748,8 @@ KeramikClient::KeramikClient( Workspace *ws, WId w, QWidget *parent, const char
titleLayout->addItem( titlebar );
titleLayout->addSpacing( buttonSpacing );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addButtons( titleLayout, options->customButtonPositions() ?
options->titleButtonsLeft() : QString(default_right) );
else
addButtons( titleLayout, options->customButtonPositions() ?
options->titleButtonsRight() : QString(default_right) );
titleLayout->addSpacing( buttonMargin - 1 ); // Right button margin
windowLayout->addSpacing( 3 ); // Left border
@ -826,13 +815,10 @@ void KeramikClient::reset()
}
void KeramikClient::addButtons( QHBoxLayout *layout, const QString &s )
void KeramikClient::addButtons( QBoxLayout *layout, const QString &s )
{
for ( uint i=0; i < s.length(); i++ )
{
uint i = 0;
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
i = s.length() - 1;
for( ; ( i < s.length()) ;) { // i>=0
switch ( s[i].latin1() )
{
// Menu button
@ -894,12 +880,6 @@ void KeramikClient::addButtons( QHBoxLayout *layout, const QString &s )
layout->addSpacing( buttonSpacing );
break;
}
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
i--;
else
i++;
}
}
@ -1211,27 +1191,11 @@ void KeramikClient::stickyChange( bool on )
void KeramikClient::menuButtonPressed()
{
static KeramikClient *tc = 0;
if (tc == this)
{
workspace()->clientPopup( this )->hide();
tc = 0;
}
else
{
QPoint menuPoint ( button[MenuButton]->rect().bottomLeft().x() - 6,
button[MenuButton]->rect().bottomLeft().y() + 3 );
workspace()->clientPopup( this )->popup( button[MenuButton]->mapToGlobal( menuPoint ) );
// Post a fake mouse button release event to the menu button
// to ensure that it's redrawn in its unpressed state
QApplication::postEvent( button[MenuButton], new QMouseEvent( QEvent::MouseButtonRelease,
QPoint(0,0), Qt::LeftButton, Qt::LeftButton ) );
tc = this;
}
workspace()->showWindowMenu( button[MenuButton]->mapToGlobal( menuPoint ), this );
button[MenuButton]->setDown(false);
}

View file

@ -30,17 +30,18 @@
#include "../../client.h"
#include "../../kwinbutton.h"
static QDict< QImage > imageDict;
#include "tiles.h"
class QSpacerItem;
using namespace KWinInternal;
namespace Keramik {
typedef QDict<QImage> ImageDict;
static ImageDict* imageDict = 0;
#include "tiles.h"
enum TilePixmap { TitleLeft=0, TitleCenter, TitleRight,
CaptionSmallLeft, CaptionSmallCenter, CaptionSmallRight,
CaptionLargeLeft, CaptionLargeCenter, CaptionLargeRight,
@ -62,7 +63,6 @@ namespace Keramik {
QColor buttonColor;
QString buttonsLeft;
QString buttonsRight;
bool reverseBIDIWindows;
};
class KeramikHandler : public QObject {
@ -152,7 +152,7 @@ namespace Keramik {
~KeramikClient();
private:
void addButtons( QHBoxLayout*, const QString & );
void addButtons( QBoxLayout*, const QString & );
void updateMask();
void updateCaptionBuffer();
void captionChange( const QString& );

View file

@ -616,12 +616,12 @@ static struct EmbedImage {
{ 0, 0, 0, 0, 0, 0, 0, 0 }
};
static const QImage& qembed_findImage( const QString& name )
const QImage* qembed_findImage( const QString& name )
{
QImage* img = imageDict.find(name);
if ( !img ) {
for (int i=0; embed_image_vec[i].data; i++) {
QImage* img = imageDict->find(name);
if ( !img )
{
for (int i=0; embed_image_vec[i].data; i++)
if ( 0==strcmp(embed_image_vec[i].name, name) ) {
img = new QImage((uchar*)embed_image_vec[i].data,
embed_image_vec[i].width,
@ -636,12 +636,7 @@ static const QImage& qembed_findImage( const QString& name )
break;
}
}
if ( !img ) {
static QImage dummy;
return dummy;
}
}
return *img;
return img;
}
#endif

View file

@ -273,7 +273,7 @@ NextClient::NextClient( Workspace *ws, WId w, QWidget *parent,
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QHBoxLayout *titleLayout = new QHBoxLayout();
QBoxLayout *titleLayout = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
QHBoxLayout *windowLayout = new QHBoxLayout();
mainLayout->addLayout(titleLayout);
@ -298,7 +298,7 @@ NextClient::NextClient( Workspace *ws, WId w, QWidget *parent,
button is selected in the current button scheme, or (2) null
otherwise.
*/
void NextClient::initializeButtonsAndTitlebar(QHBoxLayout* titleLayout)
void NextClient::initializeButtonsAndTitlebar(QBoxLayout* titleLayout)
{
// Null the buttons to begin with (they are not guaranteed to be null).
for (int i=0; i<MAX_NUM_BUTTONS; i++) {
@ -336,16 +336,10 @@ void NextClient::initializeButtonsAndTitlebar(QHBoxLayout* titleLayout)
/** Adds the buttons for one side of the title bar, based on the spec
* string; see the KWinInternal::Options class, methods
* titleButtonsLeft and titleBUttonsRight. */
void NextClient::addButtons(QHBoxLayout* titleLayout, const QString& spec)
void NextClient::addButtons(QBoxLayout* titleLayout, const QString& spec)
{
int str_len = spec.length();
if (str_len <= 0)
return;
for (unsigned int i=0; i<spec.length(); i++) {
//switch (spec[i].latin1()) {
switch( (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))?
spec[str_len-i-1].latin1():spec[i].latin1()){
switch (spec[i].latin1()) {
case 'A':
if (isMaximizable()) {
button[MAXIMIZE_IDX] =
@ -417,16 +411,14 @@ void NextClient::addButtons(QHBoxLayout* titleLayout, const QString& spec)
}
}
// Make sure the menu button follows double click conventions set in kcontrol
// (Note: this was almost straight copy and paste from KDEDefaultClient.)
void NextClient::menuButtonPressed()
{
// Probably don't need this null check, but we might as well.
if (button[MENU_IDX]) {
QPoint menupoint ( button[MENU_IDX]->rect().bottomLeft().x()-1,
button[MENU_IDX]->rect().bottomLeft().y()+2 );
QPoint pos = button[MENU_IDX]->mapToGlobal( menupoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu(button[MENU_IDX]->mapToGlobal(menupoint), this);
button[MENU_IDX]->setDown(false);
}
}

View file

@ -58,8 +58,8 @@ protected slots:
void maximizeButtonClicked();
private:
void initializeButtonsAndTitlebar(QHBoxLayout* titleLayout);
void addButtons(QHBoxLayout* titleLayout, const QString& buttons);
void initializeButtonsAndTitlebar(QBoxLayout* titleLayout);
void addButtons(QBoxLayout* titleLayout, const QString& buttons);
QSpacerItem* titlebar;

View file

@ -263,7 +263,7 @@ KWMThemeClient::KWMThemeClient( Workspace *ws, WId w, QWidget *parent,
layout->setRowStretch(2, 10);
layout->setColStretch(1, 10);
QHBoxLayout* hb = new QHBoxLayout;
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
layout->addLayout( hb, 1, 1 );
KConfig *config = KGlobal::config();

View file

@ -230,7 +230,7 @@ LaptopClientButton::LaptopClientButton(int w, int h, Client *parent,
resize(defaultSize);
if(bitmap)
setBitmap(bitmap);
setBackgroundMode(QWidget::NoBackground);
//setBackgroundMode(QWidget::NoBackground);
}
QSize LaptopClientButton::sizeHint() const
@ -347,26 +347,13 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
connect( button[BtnIconify], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) );
connect( button[BtnMax], SIGNAL( clicked() ), this, ( SLOT( slotMaximize() ) ) );
hb = new QHBoxLayout();
hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode(QLayout::FreeResize);
g->addLayout( hb, 1, 1 );
titlebar = new QSpacerItem(10, th, QSizePolicy::Expanding, QSizePolicy::Minimum);
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
hb->addWidget( button[BtnMax]);
hb->addWidget( button[BtnIconify]);
hb->addWidget( button[BtnSticky]);
if(help){
hb->addWidget( button[BtnHelp]);
}
hb->addSpacing(1);
hb->addItem(titlebar);
hb->addSpacing(1);
hb->addWidget( button[BtnClose]);
}
else{
hb->addWidget( button[BtnClose]);
hb->addSpacing(1);
titlebar = new QSpacerItem(10, th, QSizePolicy::Expanding,
QSizePolicy::Minimum);
hb->addItem(titlebar);
hb->addSpacing(1);
if(help){
@ -375,9 +362,6 @@ LaptopClient::LaptopClient( Workspace *ws, WId w, QWidget *parent,
hb->addWidget( button[BtnSticky]);
hb->addWidget( button[BtnIconify]);
hb->addWidget( button[BtnMax]);
}
if ( isTransient() || isTool() )
button[BtnSticky]->hide();

View file

@ -7,7 +7,7 @@
#include "../../kwinbutton.h"
class QLabel;
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
namespace KWinInternal {
@ -74,7 +74,7 @@ private:
int lastButtonWidth;
QSpacerItem* titlebar;
bool hiddenItems;
QHBoxLayout* hb;
QBoxLayout* hb;
KPixmap activeBuffer;
bool bufferDirty;
int lastBufferWidth;

View file

@ -294,6 +294,8 @@ ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent,
const char *name )
: Client( ws, w, parent, name, WResizeNoErase )
{
bool reverse = QApplication::reverseLayout();
connect(options, SIGNAL(resetClients()), this, SLOT(slotReset()));
bool help = providesContextHelp();
@ -302,12 +304,12 @@ ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent,
g->setRowStretch(1, 10);
g->addItem( new QSpacerItem( 0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
g->addColSpacing(0, 2);
g->addColSpacing(2, 2 + handle_width);
g->addColSpacing(0, 2 + (reverse ? handle_width : 0));
g->addColSpacing(2, 2 + (reverse ? 0 : handle_width));
g->addRowSpacing(2, 2 + handle_width);
QHBoxLayout* hb = new QHBoxLayout(0);
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode(QLayout::FreeResize);
titlebar = new QSpacerItem(10, 16, QSizePolicy::Expanding,
QSizePolicy::Minimum);
@ -325,12 +327,7 @@ ModernSys::ModernSys( Workspace *ws, WId w, QWidget *parent,
connect( button[BtnHelp], SIGNAL(clicked()), this, SLOT( contextHelp() ) );
for (int i = 0; i < (int)button_pattern->length();) {
QChar c;
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
c = (*button_pattern)[button_pattern->length()-i++];
else
c = (*button_pattern)[i++];
QChar c = (*button_pattern)[i++];
if (c == '_')
c = '3';

View file

@ -443,22 +443,16 @@ QuartzClient::QuartzClient( Workspace *ws, WId w, QWidget *parent,
g->addColSpacing(2, 4);
// Pack the titlebar HBox with items
hb = new QHBoxLayout();
hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode( QLayout::FreeResize );
g->addLayout ( hb, 1, 1 );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addClientButtons( options->titleButtonsRight() );
else
addClientButtons( options->titleButtonsLeft() );
titlebar = new QSpacerItem( 10, titleHeight, QSizePolicy::Expanding, QSizePolicy::Minimum );
hb->addItem(titlebar);
hb->addSpacing(2);
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
addClientButtons( options->titleButtonsLeft(), false );
else
addClientButtons( options->titleButtonsRight(), false );
hb->addSpacing(2);
@ -467,12 +461,10 @@ QuartzClient::QuartzClient( Workspace *ws, WId w, QWidget *parent,
void QuartzClient::addClientButtons( const QString& s, bool isLeft )
{
int str_len = s.length();
if (str_len > 0)
if (s.length() > 0)
for(unsigned int i = 0; i < s.length(); i++)
{
switch( QApplication::reverseLayout() && (!options->reverseBIDIWindows())?
s[str_len-i-1].latin1():s[i].latin1())
switch( s[i].latin1() )
{
// Menu button
case 'M':
@ -691,9 +683,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
QPainter p2( titleBuffer, this );
int rightoffset = r.x()+r.width()-25-4; // subtract titleBlocks pixmap width and some
/*if (QApplication::reverseLayout() && (!options->reverseBIDIWindows()))
rightoffset = 0;
*/
p2.fillRect( 0, 0, w, r.height(), c1 );
p2.fillRect( rightoffset, 0, w-rightoffset-6, r.height(), c2 );
@ -802,8 +792,8 @@ void QuartzClient::menuButtonPressed()
{
QPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-1,
button[BtnMenu]->rect().bottomLeft().y()+2 );
QPoint pos = button[BtnMenu]->mapToGlobal( menupoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( button[BtnMenu]->mapToGlobal( menupoint ), this );
button[BtnMenu]->setDown(false);
}

View file

@ -24,7 +24,7 @@
#include "../../kwinbutton.h"
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
namespace KWinInternal {
@ -107,7 +107,7 @@ class QuartzClient : public KWinInternal::Client
int lastButtonWidth;
int titleHeight;
bool largeButtons;
QHBoxLayout* hb;
QBoxLayout* hb;
QSpacerItem* titlebar;
};

View file

@ -412,17 +412,14 @@ GalliumClient::GalliumClient( Workspace *ws, WId w, QWidget *parent,
connect( button[BtnMax], SIGNAL( clicked() ), this, SLOT( slotMaximize() ));
connect( options, SIGNAL(resetClients()), this, SLOT( slotReset() ));
// Pack the titleBar hbox with items
hb = new QHBoxLayout();
hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode(QLayout::FreeResize);
g->addLayout( hb, 1, 1 );
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
hb->addWidget( button[BtnClose] );
hb->addSpacing(2);
hb->addWidget( button[BtnMax] );
hb->addWidget( button[BtnIconify] );
hb->addWidget( button[BtnMenu] );
titlebar = new QSpacerItem(10, titleHeight, QSizePolicy::Expanding, QSizePolicy::Minimum);
hb->addItem(titlebar);
hb->addSpacing(2);
if( providesContextHelp() )
@ -435,36 +432,11 @@ GalliumClient::GalliumClient( Workspace *ws, WId w, QWidget *parent,
else
button[BtnHelp] = NULL;
titlebar = new QSpacerItem(10, titleHeight, QSizePolicy::Expanding, QSizePolicy::Minimum);
hb->addItem(titlebar);
hb->addSpacing(2);
hb->addWidget( button[BtnMenu] );
hb->addSpacing(2);
}
else{
hb->addSpacing(2);
hb->addWidget( button[BtnMenu] );
titlebar = new QSpacerItem(10, titleHeight, QSizePolicy::Expanding, QSizePolicy::Minimum);
hb->addItem(titlebar);
hb->addSpacing(2);
if( providesContextHelp() )
{
button[BtnHelp] = new GalliumButton(this, "help", question_bits, false, smallButtons,
i18n("Help"));
hb->addSpacing(2);
connect( button[BtnHelp], SIGNAL( clicked() ), this, SLOT( contextHelp() ));
hb->addWidget( button[BtnHelp] );
}
else
button[BtnHelp] = NULL;
hb->addWidget( button[BtnIconify] );
hb->addWidget( button[BtnMax] );
hb->addSpacing(2);
hb->addWidget( button[BtnClose] );
hb->addSpacing(2);
}
// Hide buttons which are not required
// We can un-hide them if required later
@ -782,11 +754,10 @@ void GalliumClient::calcHiddenButtons()
void GalliumClient::menuButtonPressed()
{
// KS - move the menu left by 3 pixels, and down 2 pixels.
QPoint menupoint ( button[BtnMenu]->rect().bottomLeft().x()-3,
button[BtnMenu]->rect().bottomLeft().y()+2 );
QPoint pos = button[BtnMenu]->mapToGlobal( menupoint );
workspace()->showWindowMenu( pos.x(), pos.y(), this );
workspace()->showWindowMenu( button[BtnMenu]->mapToGlobal( menupoint ), this );
button[BtnMenu]->setDown(false);
}
extern "C"

View file

@ -24,7 +24,7 @@
#include "../../kwinbutton.h"
class QLabel;
class QSpacerItem;
class QHBoxLayout;
class QBoxLayout;
namespace KWinInternal {
@ -90,7 +90,7 @@ class GalliumClient : public KWinInternal::Client
int titleHeight;
QSpacerItem* titlebar;
bool hiddenItems;
QHBoxLayout* hb;
QBoxLayout* hb;
bool smallButtons;
};

View file

@ -596,16 +596,12 @@ Manager::createTitle()
QPtrList<Button> *buttonList = &leftButtonList_;
unsigned int str_len = buttons.length();
for (unsigned int i = 0; i < str_len; ++i)
for (unsigned int i = 0; i < buttons.length(); ++i)
{
Button * tb = 0;
switch ((QApplication::reverseLayout() && (!options->reverseBIDIWindows()))?
buttons[str_len-i-1].latin1():
buttons[i].latin1()
)
//switch (buttons[i].latin1())
switch (buttons[i].latin1())
{
case 'S': // Sticky
tb = createButton(Button::Sticky, this);
@ -636,15 +632,9 @@ Manager::createTitle()
buttonList->append(tb);
}
for (QPtrListIterator<Button>
// it(QApplication::reverseLayout()?rightButtonList_:leftButtonList_);
it(leftButtonList_);
it.current(); ++it)
for (QPtrListIterator<Button> it(leftButtonList_); it.current(); ++it)
{
// it.current()->setAlignment(Button::Left);
it.current()->setAlignment(
QApplication::reverseLayout() && (!options->reverseBIDIWindows())?
Button::Right:Button::Left);
it.current()->setAlignment(Button::Left);
titleLayout_->addWidget(it.current());
}
@ -659,14 +649,9 @@ Manager::createTitle()
titleLayout_->addItem(titleSpacer_);
for (QPtrListIterator<Button>
// it(QApplication::reverseLayout()?leftButtonList_:rightButtonList_);
it(rightButtonList_);
it.current(); ++it)
for (QPtrListIterator<Button> it(rightButtonList_); it.current(); ++it)
{
it.current()->setAlignment(
QApplication::reverseLayout() && (!options->reverseBIDIWindows())?
Button::Left:Button::Right);
it.current()->setAlignment(Button::Right);
titleLayout_->addWidget(it.current());
}
}
@ -741,12 +726,12 @@ Manager::resetLayout()
topLayout_ = new QVBoxLayout(this, 0, 0);
topLayout_->setResizeMode(QLayout::FreeResize);
titleLayout_ = new QHBoxLayout(topLayout_);
titleLayout_ = new QBoxLayout(topLayout_, QBoxLayout::LeftToRight, 0, 0);
titleLayout_->setResizeMode(QLayout::FreeResize);
createTitle();
QHBoxLayout * midLayout = new QHBoxLayout(topLayout_);
QBoxLayout * midLayout = new QBoxLayout(topLayout_, QBoxLayout::LeftToRight, 0, 0);
midLayout->setResizeMode(QLayout::FreeResize);
midLayout->addSpacing(1);
midLayout->addWidget(windowWrapper());

View file

@ -29,7 +29,7 @@
class QSpacerItem;
class QVBoxLayout;
class QHBoxLayout;
class QBoxLayout;
namespace RiscOS
{
@ -101,7 +101,7 @@ class Manager : public KWinInternal::Client
private:
QVBoxLayout * topLayout_;
QHBoxLayout * titleLayout_;
QBoxLayout * titleLayout_;
QSpacerItem * titleSpacer_;
QPixmap titleBuf_;

View file

@ -332,46 +332,38 @@ SystemClient::SystemClient( Workspace *ws, WId w, QWidget *parent,
connect( button[2], SIGNAL( clicked() ), this, ( SLOT( iconify() ) ) );
connect( button[3], SIGNAL( clicked(int) ), this, ( SLOT( maxButtonClicked(int) ) ) );
QHBoxLayout* hb = new QHBoxLayout(0);
QBoxLayout* hb = new QBoxLayout(0, QBoxLayout::LeftToRight, 0, 0, 0);
hb->setResizeMode(QLayout::FreeResize);
g->addLayout( hb, 0, 1 );
titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding, QSizePolicy::Minimum);
if (QApplication::reverseLayout() && (!options->reverseBIDIWindows())){
if (isMaximizable()) { hb->addWidget(button[3]); hb->addSpacing(3); }
else button[3]->hide();
if (isMinimizable()) { hb->addWidget(button[2]); hb->addSpacing(1); }
else button[2]->hide();
hb->addSpacing(1);
hb->addWidget( button[1]);
if(help){ hb->addWidget( button[4]); hb->addSpacing(1); }
hb->addSpacing(3);
hb->addWidget( button[0]);
titlebar = new QSpacerItem(10, 14, QSizePolicy::Expanding,
QSizePolicy::Minimum);
hb->addSpacing(3);
hb->addItem(titlebar);
hb->addSpacing(3);
hb->addWidget( button[0]);
hb->addSpacing(3);
if(help){
hb->addWidget( button[4]);
hb->addSpacing(1);
}
else{
hb->addSpacing(3);
hb->addWidget( button[0]);
hb->addSpacing(3);
hb->addItem(titlebar);
hb->addSpacing(3);
if(help){ hb->addWidget( button[4]); hb->addSpacing(1); }
hb->addWidget( button[1]);
hb->addSpacing(1);
if (isMinimizable()) { hb->addWidget(button[2]); hb->addSpacing(1); }
else button[2]->hide();
if (isMinimizable()) {
hb->addWidget(button[2]);
hb->addSpacing(1);
} else
button[2]->hide();
if (isMaximizable()) { hb->addWidget(button[3]); hb->addSpacing(3); }
else button[3]->hide();
}
if (isMaximizable()) {
hb->addWidget(button[3]);
hb->addSpacing(3);
} else
button[3]->hide();
setBackgroundMode(NoBackground);
recalcTitleBuffer();
}
void SystemClient::resizeEvent( QResizeEvent* )

View file

@ -455,16 +455,10 @@ Web::_resetLayout()
mainLayout_ = new QVBoxLayout(this, 0, 0);
titleSpacer_ =
new QSpacerItem
(
0,
titleHeight,
QSizePolicy::Expanding,
QSizePolicy::Fixed
);
titleSpacer_ = new QSpacerItem ( 0, titleHeight, QSizePolicy::Expanding,
QSizePolicy::Fixed);
QHBoxLayout * topLayout = new QHBoxLayout(mainLayout_, 0, 0);
QBoxLayout * topLayout = new QBoxLayout(mainLayout_, QBoxLayout::LeftToRight, 0, 0);
_createButtons();

View file

@ -82,13 +82,6 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
i18n( "Enabling this checkbox will show window button tooltips. "
"If this checkbox is off, no window button tooltips will be shown."));
cbReverseBIDIWindows = new QCheckBox(
i18n( "&Reverse the window title in BIDI desktops"), checkGroup );
QWhatsThis::add( cbReverseBIDIWindows,
i18n("In BIDI enabled desktops, when you choose this option "
"it will reverse the window client according to the language. "
"If you prefer it to be shown the same as "
"in non-BIDI desktops, leave it off."));
// Save this for later...
// cbUseMiniWindows = new QCheckBox( i18n( "Render mini &titlebars for all windows"), checkGroup );
// QWhatsThis::add( cbUseMiniWindows, i18n( "Note that this option is not available on all styles yet!" ) );
@ -142,7 +135,6 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
connect( cbUseCustomButtonPositions, SIGNAL(toggled(bool)), SLOT(slotEnableButtonTab(bool)) );
connect( cbShowToolTips, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
// connect( cbUseMiniWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
connect( cbReverseBIDIWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
// Allow kwin dcop signal to update our selection list
connectDCOPSignal("kwin", 0, "dcopResetAllClients()", "dcopUpdateClientList()", false);
@ -331,7 +323,6 @@ void KWinDecorationModule::readConfig( KConfig* conf )
tabWidget->setTabEnabled( buttonPage, cbUseCustomButtonPositions->isChecked() );
cbShowToolTips->setChecked( conf->readBoolEntry("ShowToolTips", true ));
// cbUseMiniWindows->setChecked( conf->readBoolEntry("MiniWindowBorders", false));
cbReverseBIDIWindows->setChecked( conf->readBoolEntry("ReverseBIDIWindows", true) );
// Find the corresponding decoration name to that of
// the current plugin library name
@ -381,7 +372,6 @@ void KWinDecorationModule::writeConfig( KConfig* conf )
conf->writeEntry("PluginLib", libName);
conf->writeEntry("CustomButtonPositions", cbUseCustomButtonPositions->isChecked());
conf->writeEntry("ShowToolTips", cbShowToolTips->isChecked());
conf->writeEntry("ReverseBIDIWindows",cbReverseBIDIWindows->isChecked());
// conf->writeEntry("MiniWindowBorders", cbUseMiniWindows->isChecked());
// Button settings

View file

@ -86,7 +86,6 @@ class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface
QCheckBox* cbUseCustomButtonPositions;
// QCheckBox* cbUseMiniWindows;
QCheckBox* cbShowToolTips;
QCheckBox* cbReverseBIDIWindows;
// Page 2
ButtonDropSite* dropSite;

View file

@ -31,7 +31,6 @@ public:
bool animate_tooltips;
int electric_borders;
int electric_border_delay;
bool reverse_BIDI_windows;
};
};
@ -262,7 +261,6 @@ void Options::reload()
// button tooltips
d->show_tooltips = config->readBoolEntry("ShowToolTips", true);
d->reverse_BIDI_windows =config->readBoolEntry("ReverseBIDIWindows", true );
// Read button tooltip animation effect from kdeglobals
// Since we want to allow users to enable window decoration tooltips
@ -362,10 +360,5 @@ int Options::electricBorderDelay()
return d->electric_border_delay;
}
bool Options::reverseBIDIWindows()
{
return d->reverse_BIDI_windows;
}
#include "options.moc"

View file

@ -320,15 +320,6 @@ public:
*/
int electricBorderDelay();
/**
* @returns wheather clients should be reversed in BIDI enabled desktops
* In BIDI enabled desktops, when you choose this option kwin clients should
* display them selves reversed.
* Since QT does that already when QApplication::reversedLayout(), the clients should
* reverse the widgets only when (QApplication::reversedLayout() && !reverseBIDIWindows())
*/
bool reverseBIDIWindows();
void reload();
signals:

View file

@ -210,6 +210,7 @@ public:
* and makes it active if it's not already.
*/
void showWindowMenu( int x, int y, Client* cl );
void showWindowMenu( QPoint pos, Client* cl );
void iconifyOrDeiconifyTransientsOf( Client* );
void setStickyTransientsOf( Client*, bool sticky );
@ -473,6 +474,12 @@ inline const ClientList& Workspace::stackingOrder() const
return stacking_order;
}
inline void Workspace::showWindowMenu(QPoint pos, Client* cl)
{
showWindowMenu(pos.x(), pos.y(), cl);
}
};
#endif