Commit b464518b authored by Stephan Kulow's avatar Stephan Kulow
Browse files

svn merge svn+ssh://coolo@svn.kde.org/home/kde/trunk/KDE/kdebase@438057

          svn+ssh://coolo@svn.kde.org/home/kde/branches/work/kde4/kdebase
          .

I couldn't resolve one kicker conflict that results from different
development directions, so I rely on Aaron to sort it out - the file
is commited with conflicts

svn path=/trunk/KDE/kdebase/kwin/; revision=439627
parent 89d0f65e
......@@ -144,7 +144,7 @@ for which it has been shown. This is solved in kcookiejar by including
the window id in the DCOP call. When the cookie dialog is shown, its
WM_TRANSIENT_FOR property is manually set using the XSetTransientForHint()
call (see kdelibs/kioslave/http/kcookiejar/kcookiewin.cpp). The arguments
to XSetTransientForHint() call are the X display (i.e. qt_xdisplay()),
to XSetTransientForHint() call are the X display (i.e. QX11Info::display()),
the window id on which the WM_TRANSIENT_FOR property is to be set
(i.e. use QWidget::winId()), and the window id of the mainwindow.
......@@ -159,7 +159,7 @@ prevention. The DCOP call should be changed to
myMainWindow->winId() as the second argument. In the daemon, before
the dialog is shown, a call to XSetTransientHint() should be added:
XSetTransientForHint( qt_xdisplay(), dialog->winId(), id_of_mainwindow );
XSetTransientForHint( QX11Info::display(), dialog->winId(), id_of_mainwindow );
That's it.
......
......@@ -20,7 +20,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h"
#include <fixx11h.h>
#include <qpopupmenu.h>
#include <kxerrorhandler.h>
#include <kstartupinfo.h>
#include <kstringhandler.h>
......@@ -30,8 +29,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "atoms.h"
#include "group.h"
#include "rules.h"
extern Time qt_x_time;
#include <QX11Info>
namespace KWinInternal
{
......@@ -408,19 +406,17 @@ bool Workspace::activateNextClient( Client* c )
// if 'c' is transient, transfer focus to the first suitable mainwindow
Client* get_focus = NULL;
const ClientList mainwindows = ( c != NULL ? c->mainClients() : ClientList());
for( ClientList::ConstIterator it = focus_chain.fromLast();
it != focus_chain.end();
--it )
for ( int i = focus_chain.size() - 1; i >= 0; --i )
{
if( !(*it)->isShown( false ) || !(*it)->isOnCurrentDesktop())
if( !focus_chain.at( i )->isShown( false ) || !focus_chain.at( i )->isOnCurrentDesktop())
continue;
if( mainwindows.contains( *it ))
if( mainwindows.contains( focus_chain.at( i ) ))
{
get_focus = *it;
get_focus = focus_chain.at( i );
break;
}
if( get_focus == NULL )
get_focus = *it;
get_focus = focus_chain.at( i );
}
if( get_focus == NULL )
get_focus = findDesktop( true, currentDesktop());
......@@ -628,7 +624,7 @@ void Workspace::unfakeActivity( Client* c )
void Client::updateUserTime( Time time )
{ // copied in Group::updateUserTime
if( time == CurrentTime )
time = qt_x_time;
time = QX11Info::appTime();
if( time != -1U
&& ( user_time == CurrentTime
|| timestampCompare( time, user_time ) > 0 )) // time > user_time
......@@ -644,7 +640,7 @@ Time Client::readUserCreationTime() const
unsigned long extra = 0;
unsigned char *data = 0;
KXErrorHandler handler; // ignore errors?
status = XGetWindowProperty( qt_xdisplay(), window(),
status = XGetWindowProperty( QX11Info::display(), window(),
atoms->kde_net_wm_user_creation_time, 0, 10000, FALSE, XA_CARDINAL,
&type, &format, &nitems, &extra, &data );
if (status == Success )
......@@ -906,7 +902,7 @@ void Group::startupIdChanged()
void Group::updateUserTime( Time time )
{ // copy of Client::updateUserTime
if( time == CurrentTime )
time = qt_x_time;
time = QX11Info::appTime();
if( time != -1U
&& ( user_time == CurrentTime
|| timestampCompare( time, user_time ) > 0 )) // time > user_time
......
......@@ -13,6 +13,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <qapplication.h>
#include "atoms.h"
#include <assert.h>
#include <QX11Info>
namespace KWinInternal
{
......@@ -44,6 +45,15 @@ Atoms::Atoms()
atoms[n] = &wm_client_leader;
names[n++] = (char *) "WM_CLIENT_LEADER";
atoms[n] = &wm_window_role;
names[n++] = (char *) "WM_WINDOW_ROLE";
atoms[n] = &wm_state;
names[n++] = (char *) "WM_STATE";
atoms[n] = &sm_client_id;
names[n++] = (char *) "SM_CLIENT_ID";
atoms[n] = &motif_wm_hints;
names[n++] = (char *) "_MOTIF_WM_HINTS";
......@@ -98,7 +108,7 @@ Atoms::Atoms()
assert( n <= max );
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_return );
XInternAtoms( QX11Info::display(), names, n, FALSE, atoms_return );
for (int i = 0; i < n; i++ )
*atoms[i] = atoms_return[i];
}
......
......@@ -28,6 +28,9 @@ class Atoms
Atom wm_take_focus;
Atom wm_change_state;
Atom wm_client_leader;
Atom wm_window_role;
Atom wm_state;
Atom sm_client_id;
Atom motif_wm_hints;
Atom net_wm_context_help;
......
......@@ -69,7 +69,8 @@ NET::WindowType Bridge::windowType( unsigned long supported_types ) const
QIconSet Bridge::icon() const
{
return QIconSet( c->miniIcon(), c->icon());
#warning KDE4 drop me ?
return QIconSet( /*c->miniIcon(),*/ c->icon());
}
bool Bridge::isSetShade() const
......
This diff is collapsed.
......@@ -13,7 +13,6 @@ License. See the file "COPYING" for the exact licensing terms.
#define KWIN_CLIENT_H
#include <qframe.h>
#include <qvbox.h>
#include <qpixmap.h>
#include <netwm.h>
#include <kdebug.h>
......@@ -218,12 +217,12 @@ class Client : public QObject, public KDecorationDefines
bool performMouseCommand( Options::MouseCommand, QPoint globalPos, bool handled = false );
QCString windowRole() const;
QCString sessionId();
QCString resourceName() const;
QCString resourceClass() const;
QCString wmCommand();
QCString wmClientMachine( bool use_localhost ) const;
QByteArray windowRole() const;
QByteArray sessionId();
QByteArray resourceName() const;
QByteArray resourceClass() const;
QByteArray wmCommand();
QByteArray wmClientMachine( bool use_localhost ) const;
Window wmClientLeader() const;
pid_t pid() const;
......@@ -251,10 +250,10 @@ class Client : public QObject, public KDecorationDefines
void gotPing( Time timestamp );
static QCString staticWindowRole(WId);
static QCString staticSessionId(WId);
static QCString staticWmCommand(WId);
static QCString staticWmClientMachine(WId);
static QByteArray staticWindowRole(WId);
static QByteArray staticSessionId(WId);
static QByteArray staticWmCommand(WId);
static QByteArray staticWmClientMachine(WId);
static Window staticWmClientLeader(WId);
void checkWorkspacePosition();
......@@ -507,12 +506,12 @@ class Client : public QObject, public KDecorationDefines
QTimer* autoRaiseTimer;
QTimer* shadeHoverTimer;
Colormap cmap;
QCString resource_name;
QCString resource_class;
QCString client_machine;
QByteArray resource_name;
QByteArray resource_class;
QByteArray client_machine;
QString cap_normal, cap_iconic, cap_suffix;
WId wmClientLeaderWin;
QCString window_role;
QByteArray window_role;
Group* in_group;
Window window_group;
Layer in_layer;
......@@ -645,12 +644,12 @@ inline int Client::mappingState() const
return mapping_state;
}
inline QCString Client::resourceName() const
inline QByteArray Client::resourceName() const
{
return resource_name; // it is always lowercase
}
inline QCString Client::resourceClass() const
inline QByteArray Client::resourceClass() const
{
return resource_class; // it is always lowercase
}
......@@ -799,7 +798,7 @@ inline bool Client::isManaged() const
return mapping_state != WithdrawnState;
}
inline QCString Client::windowRole() const
inline QByteArray Client::windowRole() const
{
return window_role;
}
......
......@@ -8,7 +8,7 @@ kde_module_LTLIBRARIES = kwin3_b2.la
kwin3_b2_la_SOURCES = b2client.cpp
kwin3_b2_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
# kwin_b2_la_LDFLAGS = $(all_libraries) -avoid-version -module $(KDE_RPATH) $(KDE_MT_LDFLAGS)
kwin3_b2_la_LIBADD = ../../lib/libkdecorations.la
kwin3_b2_la_LIBADD = ../../lib/libkdecorations.la -lkdefx
METASOURCES = AUTO
noinst_HEADERS = b2client.h
......
......@@ -14,6 +14,17 @@
#include <qapplication.h>
#include <qlayout.h>
#include <qdrawutil.h>
//Added by qt3to4:
#include <QPixmap>
#include <QPaintEvent>
#include <Q3PointArray>
#include <QGridLayout>
#include <QEvent>
#include <QBoxLayout>
#include <Q3ValueList>
#include <QShowEvent>
#include <QResizeEvent>
#include <QMouseEvent>
#include <kpixmapeffect.h>
#include <kimageeffect.h>
#include <kicontheme.h>
......@@ -26,6 +37,7 @@
#include <qtooltip.h>
#include <X11/Xlib.h>
#include <QX11Info>
namespace B2 {
......@@ -311,10 +323,10 @@ bool B2ClientFactory::supports( Ability ability )
};
}
QValueList< B2ClientFactory::BorderSize > B2ClientFactory::borderSizes() const
QList< B2ClientFactory::BorderSize > B2ClientFactory::borderSizes() const
{
// the list must be sorted
return QValueList< BorderSize >() << BorderTiny << BorderNormal <<
return Q3ValueList< BorderSize >() << BorderTiny << BorderNormal <<
BorderLarge << BorderVeryLarge << BorderHuge;
}
......@@ -355,10 +367,10 @@ void B2Client::init()
// Check this early, otherwise the preview will be rendered badly.
resizable = isResizable();
createMainWidget(WResizeNoErase | WRepaintNoErase);
createMainWidget(Qt::WResizeNoErase | Qt::WRepaintNoErase);
widget()->installEventFilter(this);
widget()->setBackgroundMode(NoBackground);
widget()->setBackgroundMode(Qt::NoBackground);
// Set button pointers to NULL so we know what has been created
for (int i = 0; i < BtnCount; i++)
......@@ -443,7 +455,7 @@ void B2Client::addButtons(const QString& s, const QString tips[],
case 'M': // Menu button
if (!button[BtnMenu]) {
button[BtnMenu] = new B2Button(this, tb, tips[BtnMenu],
LeftButton | RightButton);
Qt::LeftButton | Qt::RightButton);
button[BtnMenu]->setPixmaps(P_MENU);
button[BtnMenu]->setUseMiniIcon();
connect(button[BtnMenu], SIGNAL(pressed()),
......@@ -483,7 +495,7 @@ void B2Client::addButtons(const QString& s, const QString tips[],
case 'A': // Maximize button
if (isMaximizable() && (!button[BtnMax])) {
button[BtnMax] = new B2Button(this, tb, tips[BtnMax],
LeftButton | MidButton | RightButton);
Qt::LeftButton | Qt::MidButton | Qt::RightButton);
button[BtnMax]->setPixmaps(maximizeMode() == MaximizeFull ?
P_NORMALIZE : P_MAX);
connect(button[BtnMax], SIGNAL(clicked()),
......@@ -962,7 +974,7 @@ static void redraw_pixmaps()
drawB2Rect(&thinBox, color, is_down);
pix->fill(Qt::black);
bitBlt(pix, 0, 0, &thinBox,
0, 0, thinBox.width(), thinBox.height(), Qt::CopyROP, true);
0, 0, thinBox.width(), thinBox.height());
}
// maximize
......@@ -985,11 +997,11 @@ static void redraw_pixmaps()
drawB2Rect(&largeBox, is_act ? aGrp.button() : iGrp.button(), is_down);
pix->fill(options()->color(KDecoration::ColorTitleBar, is_act));
bitBlt(pix, pix->width() - 12, pix->width() - 12, &largeBox,
0, 0, 12, 12, Qt::CopyROP, true);
bitBlt(pix, 0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
0, 0, 12, 12);
bitBlt(pix, 0, 0, &smallBox, 0, 0, 10, 10);
bitBlt(pixmap[P_ICONIFY * NumStates + i], 0, 0,
&smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
&smallBox, 0, 0, 10, 10);
}
// resize
......@@ -1000,7 +1012,7 @@ static void redraw_pixmaps()
pixmap[P_RESIZE * NumStates + i]->detach();
drawB2Rect(&smallBox, is_act ? aGrp.button() : iGrp.button(), is_down);
bitBlt(pixmap[P_RESIZE * NumStates + i],
0, 0, &smallBox, 0, 0, 10, 10, Qt::CopyROP, true);
0, 0, &smallBox, 0, 0, 10, 10);
}
......@@ -1107,7 +1119,7 @@ void B2Client::positionButtons()
// Transparent bound stuff.
static QRect *visible_bound;
static QPointArray bound_shape;
static Q3PointArray bound_shape;
bool B2Client::drawbound(const QRect& geom, bool clear)
{
......@@ -1144,11 +1156,13 @@ bool B2Client::drawbound(const QRect& geom, bool clear)
} else {
*visible_bound = geom;
}
QPainter p(workspaceWidget());
p.setPen(QPen(Qt::white, 5));
p.setRasterOp(Qt::XorROP);
p.drawPolygon(bound_shape);
/**
* TODO: Replace by QRubberBand
* QPainter p(workspaceWidget());
* p.setPen(QPen(Qt::white, 5));
* p.setRasterOp(Qt::XorROP);
* p.drawPolygon(bound_shape);
*/
if (clear) {
delete visible_bound;
visible_bound = 0;
......@@ -1186,10 +1200,10 @@ bool B2Client::eventFilter(QObject *o, QEvent *e)
B2Button::B2Button(B2Client *_client, QWidget *parent,
const QString& tip, const int realizeBtns)
: QButton(parent, 0), hover(false)
: Q3Button(parent, 0), hover(false)
{
setBackgroundMode(NoBackground);
setCursor(arrowCursor);
setBackgroundMode(Qt::NoBackground);
setCursor(Qt::arrowCursor);
realizeButtons = realizeBtns;
client = _client;
useMiniIcon = false;
......@@ -1217,8 +1231,8 @@ void B2Button::drawButton(QPainter *p)
p->fillRect(rect(), bg);
}
if (useMiniIcon) {
QPixmap miniIcon = client->icon().pixmap(QIconSet::Small,
client->isActive() ? QIconSet::Normal : QIconSet::Disabled);
QPixmap miniIcon = client->icon().pixmap(QIcon::Small,
client->isActive() ? QIcon::Normal : QIcon::Disabled);
p->drawPixmap((width() - miniIcon.width()) / 2,
(height() - miniIcon.height()) / 2, miniIcon);
} else {
......@@ -1256,42 +1270,42 @@ void B2Button::mousePressEvent(QMouseEvent * e)
{
last_button = e->button();
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
(e->button() & realizeButtons) ? LeftButton : NoButton,
(e->button() & realizeButtons) ? Qt::LeftButton : Qt::NoButton,
e->state());
QButton::mousePressEvent(&me);
Q3Button::mousePressEvent(&me);
}
void B2Button::mouseReleaseEvent(QMouseEvent * e)
{
last_button = e->button();
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
(e->button() & realizeButtons) ? LeftButton : NoButton,
(e->button() & realizeButtons) ? Qt::LeftButton : Qt::NoButton,
e->state());
QButton::mouseReleaseEvent(&me);
Q3Button::mouseReleaseEvent(&me);
}
void B2Button::enterEvent(QEvent *e)
{
hover = true;
repaint(false);
QButton::enterEvent(e);
Q3Button::enterEvent(e);
}
void B2Button::leaveEvent(QEvent *e)
{
hover = false;
repaint(false);
QButton::leaveEvent(e);
Q3Button::leaveEvent(e);
}
// =====================================
B2Titlebar::B2Titlebar(B2Client *parent)
: QWidget(parent->widget(), 0, WStyle_Customize | WRepaintNoErase),
: QWidget(parent->widget(), 0, Qt::WStyle_Customize | Qt::WNoAutoErase),
client(parent),
set_x11mask(false), isfullyobscured(false), shift_move(false)
{
setBackgroundMode(NoBackground);
setBackgroundMode(Qt::NoBackground);
captionSpacer = new QSpacerItem(buttonSize, buttonSize + 4,
QSizePolicy::Expanding, QSizePolicy::Fixed);
}
......@@ -1300,7 +1314,7 @@ bool B2Titlebar::x11Event(XEvent *e)
{
if (!set_x11mask) {
set_x11mask = true;
XSelectInput(qt_xdisplay(), winId(),
XSelectInput(QX11Info::display(), winId(),
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
KeymapStateMask |
......@@ -1349,7 +1363,7 @@ void B2Titlebar::drawTitlebar(QPainter &p, bool state)
p.setPen(options()->color(KDecoration::ColorFont, state));
p.setFont(options()->font(state));
t = captionSpacer->geometry();
p.drawText(t, AlignLeft | AlignVCenter, client->caption());
p.drawText(t, Qt::AlignLeft | Qt::AlignVCenter, client->caption());
}
void B2Titlebar::recalcBuffer()
......@@ -1372,7 +1386,7 @@ void B2Titlebar::paintEvent(QPaintEvent *)
{
if(client->isActive())
bitBlt(this, 0, 0, &titleBuffer, 0, 0, titleBuffer.width(),
titleBuffer.height(), Qt::CopyROP, true);
titleBuffer.height());
else {
QPainter p(this);
drawTitlebar(p, false);
......@@ -1381,14 +1395,14 @@ void B2Titlebar::paintEvent(QPaintEvent *)
void B2Titlebar::mouseDoubleClickEvent(QMouseEvent *e)
{
if (e->button() == LeftButton && e->y() < height()) {
if (e->button() == Qt::LeftButton && e->y() < height()) {
client->titlebarDblClickOperation();
}
}
void B2Titlebar::mousePressEvent(QMouseEvent * e)
{
shift_move = e->state() & ShiftButton;
shift_move = e->state() & Qt::ShiftButton;
if (shift_move) {
moveOffset = e->globalPos();
} else {
......
......@@ -11,8 +11,16 @@
#include <qvariant.h>
#include <qdatetime.h>
#include <qbutton.h>
#include <q3button.h>
#include <qbitmap.h>
//Added by qt3to4:
#include <QPaintEvent>
#include <QGridLayout>
#include <QEvent>
#include <QBoxLayout>
#include <QShowEvent>
#include <QResizeEvent>
#include <QMouseEvent>
#include <kpixmap.h>
#include <kdecoration.h>
#include <kdecorationfactory.h>
......@@ -25,17 +33,17 @@ namespace B2 {
class B2Client;
class B2Button : public QButton
class B2Button : public Q3Button
{
public:
B2Button(B2Client *_client=0, QWidget *parent=0, const QString& tip=NULL, const int realizeBtns = LeftButton);
B2Button(B2Client *_client=0, QWidget *parent=0, const QString& tip=NULL, const int realizeBtns = Qt::LeftButton);
~B2Button() {};
void setBg(const QColor &c){bg = c;}
void setPixmaps(KPixmap *pix, KPixmap *pixDown, KPixmap *iPix,
KPixmap *iPixDown);
void setPixmaps(int button_id);
void setToggle(){setToggleType(Toggle);}
void setToggle(){setCheckable(true);}
void setActive(bool on){setOn(on);}
void setUseMiniIcon(){useMiniIcon = true;}
QSize sizeHint() const;
......@@ -56,7 +64,7 @@ private:
public:
B2Client* client;
ButtonState last_button;
Qt::ButtonState last_button;
int realizeButtons;
bool hover;
};
......@@ -157,7 +165,7 @@ public:
virtual KDecoration *createDecoration(KDecorationBridge *);
virtual bool reset(unsigned long changed);
virtual bool supports( Ability ability );
QValueList< B2ClientFactory::BorderSize > borderSizes() const;
QList< B2ClientFactory::BorderSize > borderSizes() const;
};
}
......
......@@ -8,8 +8,10 @@
#include "config.h"
#include <kglobal.h>
#include <qwhatsthis.h>
#include <qvbox.h>
#include <q3vbox.h>
//Added by qt3to4:
#include <QLabel>
#include <klocale.h>
......@@ -35,11 +37,11 @@ B2Config::B2Config( KConfig* conf, QWidget* parent )
{
KGlobal::locale()->insertCatalogue("kwin_b2_config");
b2Config = new KConfig("kwinb2rc");
gb = new QVBox(parent);
gb = new Q3VBox(parent);
cbColorBorder = new QCheckBox(
i18n("Draw window frames using &titlebar colors"), gb);
QWhatsThis::add(cbColorBorder,
cbColorBorder->setWhatsThis(
i18n("When selected, the window borders "
"are drawn using the titlebar colors; otherwise, they are "
"drawn using normal border colors."));
......@@ -47,13 +49,14 @@ B2Config::B2Config( KConfig* conf, QWidget* parent )
// Grab Handle
showGrabHandleCb = new QCheckBox(
i18n("Draw &resize handle"), gb);
QWhatsThis::add(showGrabHandleCb,
showGrabHandleCb->setWhatsThis(
i18n("When selected, decorations are drawn with a \"grab handle\" "
"in the bottom right corner of the windows; "
"otherwise, no grab handle is drawn."));
// Double click menu option support
actionsGB = new QHGroupBox(i18n("Actions Settings"), gb);
actionsGB = new Q3GroupBox(i18n("Actions Settings"), gb);
actionsGB->setOrientation(Qt::Horizontal);
QLabel *menuDblClickLabel = new QLabel(actionsGB);
menuDblClickLabel->setText(i18n("Double click on menu button:"));
menuDblClickOp = new QComboBox(actionsGB);
......@@ -62,7 +65,7 @@ B2Config::B2Config( KConfig* conf, QWidget* parent )
menuDblClickOp->insertItem(i18n("Shade Window"));
menuDblClickOp->insertItem(i18n("Close Window"));
QWhatsThis::add(menuDblClickOp,
menuDblClickOp->setWhatsThis(
i18n("An action can be associated to a double click "
"of the menu button. Leave it to none if in doubt."));
......
......@@ -10,8 +10,7 @@
#define _KDE_B2CONFIG_H
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qhgroupbox.h>
#include <q3groupbox.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <kconfig.h>
......@@ -40,7 +39,7 @@ class B2Config: public QObject
KConfig* b2Config;
QCheckBox* cbColorBorder;
QCheckBox* showGrabHandleCb;
QHGroupBox* actionsGB;
Q3GroupBox* actionsGB;
QComboBox* menuDblClickOp;
QWidget* gb;
};
......
......@@ -7,7 +7,7 @@ kde_module_LTLIBRARIES = kwin3_default.la
kwin3_default_la_SOURCES = kdedefault.cpp
kwin3_default_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
kwin3_default_la_LIBADD = $(LIB_KDECORE) ../../lib/libkdecorations.la
kwin3_default_la_LIBADD = $(LIB_KDECORE) -lkdefx ../../lib/libkdecorations.la
METASOURCES = AUTO
noinst_HEADERS = kdedefault.h
......
......@@ -13,7 +13,6 @@
#include <kdialog.h>
#include <klocale.h>
#include <qpixmap.h>