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
This commit is contained in:
Stephan Kulow 2005-07-28 14:59:42 +00:00
parent 89d0f65e6f
commit b464518b3c
105 changed files with 1328 additions and 1425 deletions

4
README
View file

@ -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.

View file

@ -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

View file

@ -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];
}

View file

@ -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;

View file

@ -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

View file

@ -30,15 +30,11 @@ License. See the file "COPYING" for the exact licensing terms.
#include "rules.h"
#include <X11/extensions/shape.h>
#include <QX11Info>
// put all externs before the namespace statement to allow the linker
// to resolve them properly
extern Atom qt_wm_state;
extern Time qt_x_time;
extern Atom qt_window_role;
extern Atom qt_sm_client_id;
namespace KWinInternal
{
@ -194,7 +190,7 @@ void Client::releaseWindow( bool on_shutdown )
hidden = true; // so that it's not considered visible anymore (can't use hideClient(), it would set flags)
if( !on_shutdown )
workspace()->clientHidden( this );
XUnmapWindow( qt_xdisplay(), frameId()); // destroying decoration would cause ugly visual effect
XUnmapWindow( QX11Info::display(), frameId()); // destroying decoration would cause ugly visual effect
destroyDecoration();
cleanGrouping();
if( !on_shutdown )
@ -206,27 +202,27 @@ void Client::releaseWindow( bool on_shutdown )
desk = 0;
info->setState( 0, info->state()); // reset all state flags
}
XDeleteProperty( qt_xdisplay(), client, atoms->kde_net_wm_user_creation_time);
XDeleteProperty( qt_xdisplay(), client, atoms->net_frame_extents );
XDeleteProperty( qt_xdisplay(), client, atoms->kde_net_wm_frame_strut );
XReparentWindow( qt_xdisplay(), client, workspace()->rootWin(), x(), y());
XRemoveFromSaveSet( qt_xdisplay(), client );
XSelectInput( qt_xdisplay(), client, NoEventMask );
XDeleteProperty( QX11Info::display(), client, atoms->kde_net_wm_user_creation_time);
XDeleteProperty( QX11Info::display(), client, atoms->net_frame_extents );
XDeleteProperty( QX11Info::display(), client, atoms->kde_net_wm_frame_strut );
XReparentWindow( QX11Info::display(), client, workspace()->rootWin(), x(), y());
XRemoveFromSaveSet( QX11Info::display(), client );
XSelectInput( QX11Info::display(), client, NoEventMask );
if( on_shutdown )
{ // map the window, so it can be found after another WM is started
XMapWindow( qt_xdisplay(), client );
XMapWindow( QX11Info::display(), client );
// TODO preserve minimized, shaded etc. state?
}
else
{
// Make sure it's not mapped if the app unmapped it (#65279). The app
// may do map+unmap before we initially map the window by calling rawShow() from manage().
XUnmapWindow( qt_xdisplay(), client );
XUnmapWindow( QX11Info::display(), client );
}
client = None;
XDestroyWindow( qt_xdisplay(), wrapper );
XDestroyWindow( QX11Info::display(), wrapper );
wrapper = None;
XDestroyWindow( qt_xdisplay(), frame );
XDestroyWindow( QX11Info::display(), frame );
frame = None;
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
deleteClient( this, Allowed );
@ -251,9 +247,9 @@ void Client::destroyClient()
cleanGrouping();
workspace()->removeClient( this, Allowed );
client = None; // invalidate
XDestroyWindow( qt_xdisplay(), wrapper );
XDestroyWindow( QX11Info::display(), wrapper );
wrapper = None;
XDestroyWindow( qt_xdisplay(), frame );
XDestroyWindow( QX11Info::display(), frame );
frame = None;
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
deleteClient( this, Allowed );
@ -274,7 +270,7 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
// TODO check decoration's minimum size?
decoration->init();
decoration->widget()->installEventFilter( this );
XReparentWindow( qt_xdisplay(), decoration->widget()->winId(), frameId(), 0, 0 );
XReparentWindow( QX11Info::display(), decoration->widget()->winId(), frameId(), 0, 0 );
decoration->widget()->lower();
decoration->borders( border_left, border_right, border_top, border_bottom );
options->onlyDecoTranslucent ?
@ -460,13 +456,13 @@ void Client::updateShape()
setShapable(TRUE);
if ( shape() )
{
XShapeCombineShape(qt_xdisplay(), frameId(), ShapeBounding,
XShapeCombineShape(QX11Info::display(), frameId(), ShapeBounding,
clientPos().x(), clientPos().y(),
window(), ShapeBounding, ShapeSet);
}
else
{
XShapeCombineMask( qt_xdisplay(), frameId(), ShapeBounding, 0, 0,
XShapeCombineMask( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
None, ShapeSet);
}
// workaround for #19644 - shaped windows shouldn't have decoration
@ -481,16 +477,16 @@ void Client::setMask( const QRegion& reg, int mode )
{
_mask = reg;
if( reg.isNull())
XShapeCombineMask( qt_xdisplay(), frameId(), ShapeBounding, 0, 0,
XShapeCombineMask( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
None, ShapeSet );
else if( mode == X::Unsorted )
XShapeCombineRegion( qt_xdisplay(), frameId(), ShapeBounding, 0, 0,
XShapeCombineRegion( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
reg.handle(), ShapeSet );
else
{
QMemArray< QRect > rects = reg.rects();
QVector< QRect > rects = reg.rects();
XRectangle* xrects = new XRectangle[ rects.count() ];
for( unsigned int i = 0;
for( int i = 0;
i < rects.count();
++i )
{
@ -499,7 +495,7 @@ void Client::setMask( const QRegion& reg, int mode )
xrects[ i ].width = rects[ i ].width();
xrects[ i ].height = rects[ i ].height();
}
XShapeCombineRectangles( qt_xdisplay(), frameId(), ShapeBounding, 0, 0,
XShapeCombineRectangles( QX11Info::display(), frameId(), ShapeBounding, 0, 0,
xrects, rects.count(), ShapeSet, mode );
delete[] xrects;
}
@ -515,7 +511,7 @@ QRegion Client::mask() const
void Client::setShapable(bool b)
{
long tmp = b?1:0;
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_shapable, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &tmp, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shapable, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &tmp, 1L);
}
void Client::hideClient( bool hide )
@ -665,7 +661,7 @@ void Client::animateMinimizeOrUnminimize( bool minimize )
if (area2 != area)
{
pm = animationPixmap( area.width() );
pm2 = QPixmap::grabWindow( qt_xrootwin(), area.x(), area.y(), area.width(), area.height() );
pm2 = QPixmap::grabWindow( QX11Info::appRootWindow(), area.x(), area.y(), area.width(), area.height() );
p.drawPixmap( area.x(), area.y(), pm );
if ( need_to_clear )
{
@ -674,8 +670,8 @@ void Client::animateMinimizeOrUnminimize( bool minimize )
}
area2 = area;
}
XFlush(qt_xdisplay());
XSync( qt_xdisplay(), FALSE );
XFlush(QX11Info::display());
XSync( QX11Info::display(), FALSE );
diff = t.elapsed();
if (diff > step)
diff = step;
@ -714,7 +710,7 @@ QPixmap Client::animationPixmap( int w )
QPainter p( &pm );
p.setPen(options->color(Options::ColorFont, isActive() || isMinimized() ));
p.setFont(options->font(isActive()));
p.drawText( pm.rect(), AlignLeft|AlignVCenter|SingleLine, caption() );
p.drawText( pm.rect(), Qt::AlignLeft|Qt::AlignVCenter|Qt::SingleLine, caption() );
return pm;
}
@ -763,16 +759,16 @@ void Client::setShade( ShadeMode mode )
{ // shade_mode == ShadeNormal
// we're about to shade, texx xcompmgr to prepare
long _shade = 1;
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
// shade
int h = height();
shade_geometry_change = true;
QSize s( sizeForClientSize( QSize( clientSize())));
s.setHeight( border_top + border_bottom );
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( qt_xdisplay(), wrapper );
XUnmapWindow( qt_xdisplay(), client );
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( QX11Info::display(), wrapper );
XUnmapWindow( QX11Info::display(), client );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
//as we hid the unmap event, xcompmgr didn't recognize the client wid has vanished, so we'll extra inform it
//done xcompmgr workaround
// FRAME repaint( FALSE );
@ -782,7 +778,7 @@ void Client::setShade( ShadeMode mode )
do
{
h -= step;
XResizeWindow( qt_xdisplay(), frameId(), s.width(), h );
XResizeWindow( QX11Info::display(), frameId(), s.width(), h );
resizeDecoration( QSize( s.width(), h ));
QApplication::syncX();
} while ( h > s.height() + step );
@ -799,7 +795,7 @@ void Client::setShade( ShadeMode mode )
}
// tell xcompmgr shade's done
_shade = 2;
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shade, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &_shade, 1L);
}
else
{
@ -812,7 +808,7 @@ void Client::setShade( ShadeMode mode )
do
{
h += step;
XResizeWindow( qt_xdisplay(), frameId(), s.width(), h );
XResizeWindow( QX11Info::display(), frameId(), s.width(), h );
resizeDecoration( QSize( s.width(), h ));
// assume a border
// we do not have time to wait for X to send us paint events
@ -825,9 +821,9 @@ void Client::setShade( ShadeMode mode )
plainResize( s );
if( shade_mode == ShadeHover || shade_mode == ShadeActivated )
setActive( TRUE );
XMapWindow( qt_xdisplay(), wrapperId());
XMapWindow( qt_xdisplay(), window());
XDeleteProperty (qt_xdisplay(), client, atoms->net_wm_window_shade);
XMapWindow( QX11Info::display(), wrapperId());
XMapWindow( QX11Info::display(), window());
XDeleteProperty (QX11Info::display(), client, atoms->net_wm_window_shade);
if ( isActive() )
workspace()->requestFocus( this );
}
@ -917,7 +913,7 @@ void Client::setMappingState(int s)
mapping_state = s;
if( mapping_state == WithdrawnState )
{
XDeleteProperty( qt_xdisplay(), window(), qt_wm_state );
XDeleteProperty( QX11Info::display(), window(), atoms->wm_state );
return;
}
assert( s == NormalState || s == IconicState );
@ -925,7 +921,7 @@ void Client::setMappingState(int s)
unsigned long data[2];
data[0] = (unsigned long) s;
data[1] = (unsigned long) None;
XChangeProperty(qt_xdisplay(), window(), qt_wm_state, qt_wm_state, 32,
XChangeProperty(QX11Info::display(), window(), atoms->wm_state, atoms->wm_state, 32,
PropModeReplace, (unsigned char *)data, 2);
if( was_unmanaged ) // manage() did postpone_geometry_updates = 1, now it's ok to finally set the geometry
@ -940,11 +936,11 @@ void Client::rawShow()
{
if( decoration != NULL )
decoration->widget()->show(); // not really necessary, but let it know the state
XMapWindow( qt_xdisplay(), frame );
XMapWindow( QX11Info::display(), frame );
if( !isShade())
{
XMapWindow( qt_xdisplay(), wrapper );
XMapWindow( qt_xdisplay(), client );
XMapWindow( QX11Info::display(), wrapper );
XMapWindow( QX11Info::display(), client );
}
}
@ -961,11 +957,11 @@ void Client::rawHide()
// which won't be missed, so this shouldn't be a problem. The chance the real UnmapNotify
// will be missed is also very minimal, so I don't think it's needed to grab the server
// here.
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( qt_xdisplay(), frame );
XUnmapWindow( qt_xdisplay(), wrapper );
XUnmapWindow( qt_xdisplay(), client );
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
XUnmapWindow( QX11Info::display(), frame );
XUnmapWindow( QX11Info::display(), wrapper );
XUnmapWindow( QX11Info::display(), client );
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
if( decoration != NULL )
decoration->widget()->hide(); // not really necessary, but let it know the state
workspace()->clientHidden( this );
@ -982,14 +978,14 @@ void Client::sendClientMessage(Window w, Atom a, Atom protocol, long data1, long
ev.xclient.message_type = a;
ev.xclient.format = 32;
ev.xclient.data.l[0] = protocol;
ev.xclient.data.l[1] = qt_x_time;
ev.xclient.data.l[1] = QX11Info::appTime();
ev.xclient.data.l[2] = data1;
ev.xclient.data.l[3] = data2;
ev.xclient.data.l[4] = data3;
mask = 0L;
if (w == qt_xrootwin())
if (w == QX11Info::appRootWindow())
mask = SubstructureRedirectMask; /* magic! */
XSendEvent(qt_xdisplay(), w, False, mask, &ev);
XSendEvent(QX11Info::display(), w, False, mask, &ev);
}
/*
@ -1044,7 +1040,7 @@ void Client::killWindow()
Notify::raise( Notify::Delete );
killProcess( false );
// always kill this client at the server
XKillClient(qt_xdisplay(), window() );
XKillClient(QX11Info::display(), window() );
destroyClient();
}
@ -1062,7 +1058,7 @@ void Client::pingWindow()
ping_timer = new QTimer( this );
connect( ping_timer, SIGNAL( timeout()), SLOT( pingTimeout()));
ping_timer->start( options->killPingTimeout, true );
ping_timestamp = qt_x_time;
ping_timestamp = QX11Info::appTime();
workspace()->sendPingToWindow( window(), ping_timestamp );
}
@ -1093,7 +1089,7 @@ void Client::killProcess( bool ask, Time timestamp )
if( process_killer != NULL )
return;
Q_ASSERT( !ask || timestamp != CurrentTime );
QCString machine = wmClientMachine( true );
QByteArray machine = wmClientMachine( true );
pid_t pid = info->pid();
if( pid <= 0 || machine.isEmpty()) // needed properties missing
return;
@ -1103,7 +1099,7 @@ void Client::killProcess( bool ask, Time timestamp )
if( machine != "localhost" )
{
KProcess proc;
proc << "xon" << machine << "kill" << pid;
proc << "xon" << machine << "kill" << QString::number( pid );
proc.start( KProcess::DontCare );
}
else
@ -1113,11 +1109,11 @@ void Client::killProcess( bool ask, Time timestamp )
{ // SELI TODO handle the window created by handler specially (on top,urgent?)
process_killer = new KProcess( this );
*process_killer << KStandardDirs::findExe( "kwin_killer_helper" )
<< "--pid" << QCString().setNum( pid ) << "--hostname" << machine
<< "--pid" << QByteArray().setNum( pid ) << "--hostname" << machine
<< "--windowname" << caption().utf8()
<< "--applicationname" << resourceClass()
<< "--wid" << QCString().setNum( window())
<< "--timestamp" << QCString().setNum( timestamp );
<< "--wid" << QString::number( window() )
<< "--timestamp" << QString::number( timestamp );
connect( process_killer, SIGNAL( processExited( KProcess* )),
SLOT( processKillerExited()));
if( !process_killer->start( KProcess::NotifyOnExit ))
@ -1224,15 +1220,15 @@ void Client::takeActivity( int flags, bool handled, allowed_t )
#ifndef NDEBUG
static Time previous_activity_timestamp;
static Client* previous_client;
if( previous_activity_timestamp == qt_x_time && previous_client != this )
if( previous_activity_timestamp == QX11Info::appTime() && previous_client != this )
{
kdDebug( 1212 ) << "Repeated use of the same X timestamp for activity" << endl;
kdDebug( 1212 ) << kdBacktrace() << endl;
}
previous_activity_timestamp = qt_x_time;
previous_activity_timestamp = QX11Info::appTime();
previous_client = this;
#endif
workspace()->sendTakeActivity( this, qt_x_time, flags );
workspace()->sendTakeActivity( this, QX11Info::appTime(), flags );
}
// performs the actual focusing of the window using XSetInputFocus and WM_TAKE_FOCUS
@ -1241,17 +1237,17 @@ void Client::takeFocus( allowed_t )
#ifndef NDEBUG
static Time previous_focus_timestamp;
static Client* previous_client;
if( previous_focus_timestamp == qt_x_time && previous_client != this )
if( previous_focus_timestamp == QX11Info::appTime() && previous_client != this )
{
kdDebug( 1212 ) << "Repeated use of the same X timestamp for focus" << endl;
kdDebug( 1212 ) << kdBacktrace() << endl;
}
previous_focus_timestamp = qt_x_time;
previous_focus_timestamp = QX11Info::appTime();
previous_client = this;
#endif
if ( rules()->checkAcceptFocus( input ))
{
XSetInputFocus( qt_xdisplay(), window(), RevertToPointerRoot, qt_x_time );
XSetInputFocus( QX11Info::display(), window(), RevertToPointerRoot, QX11Info::appTime() );
}
if ( Ptakefocus )
sendClientMessage(window(), atoms->wm_protocols, atoms->wm_take_focus);
@ -1306,16 +1302,17 @@ QString Client::readName() const
KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, const Client*, (!cl->isSpecialWindow() || cl->isToolbar()) && cl != value && cl->caption() == value->caption());
void Client::setCaption( const QString& s, bool force )
void Client::setCaption( const QString& _s, bool force )
{
QString s = _s;
if ( s != cap_normal || force )
{
bool reset_name = force;
for( unsigned int i = 0;
for( int i = 0;
i < s.length();
++i )
if( !s[ i ].isPrint())
s[ i ] = ' ';
s[ i ] = QChar( ' ' );
cap_normal = s;
bool was_suffix = ( !cap_suffix.isEmpty());
QString machine_suffix;
@ -1383,7 +1380,7 @@ QString Client::caption( bool full ) const
void Client::getWMHints()
{
XWMHints *hints = XGetWMHints(qt_xdisplay(), window() );
XWMHints *hints = XGetWMHints(QX11Info::display(), window() );
input = true;
window_group = None;
urgency = false;
@ -1472,7 +1469,7 @@ void Client::getWindowProtocols()
Pcontexthelp = 0;
Pping = 0;
if (XGetWMProtocols(qt_xdisplay(), window(), &p, &n))
if (XGetWMProtocols(QX11Info::display(), window(), &p, &n))
{
for (i = 0; i < n; i++)
if (p[i] == atoms->wm_delete_window)
@ -1498,23 +1495,23 @@ static int nullErrorHandler(Display *, XErrorEvent *)
/*!
Returns WM_WINDOW_ROLE property for a given window.
*/
QCString Client::staticWindowRole(WId w)
QByteArray Client::staticWindowRole(WId w)
{
return getStringProperty(w, qt_window_role).lower();
return getStringProperty(w, atoms->wm_window_role).lower();
}
/*!
Returns SM_CLIENT_ID property for a given window.
*/
QCString Client::staticSessionId(WId w)
QByteArray Client::staticSessionId(WId w)
{
return getStringProperty(w, qt_sm_client_id);
return getStringProperty(w, atoms->sm_client_id);
}
/*!
Returns WM_COMMAND property for a given window.
*/
QCString Client::staticWmCommand(WId w)
QByteArray Client::staticWmCommand(WId w)
{
return getStringProperty(w, XA_WM_COMMAND, ' ');
}
@ -1531,7 +1528,7 @@ Window Client::staticWmClientLeader(WId w)
unsigned char *data = 0;
Window result = w;
XErrorHandler oldHandler = XSetErrorHandler(nullErrorHandler);
status = XGetWindowProperty( qt_xdisplay(), w, atoms->wm_client_leader, 0, 10000,
status = XGetWindowProperty( QX11Info::display(), w, atoms->wm_client_leader, 0, 10000,
FALSE, XA_WINDOW, &type, &format,
&nitems, &extra, &data );
XSetErrorHandler(oldHandler);
@ -1554,9 +1551,9 @@ void Client::getWmClientLeader()
Returns sessionId for this client,
taken either from its window or from the leader window.
*/
QCString Client::sessionId()
QByteArray Client::sessionId()
{
QCString result = staticSessionId(window());
QByteArray result = staticSessionId(window());
if (result.isEmpty() && wmClientLeaderWin && wmClientLeaderWin!=window())
result = staticSessionId(wmClientLeaderWin);
return result;
@ -1566,9 +1563,9 @@ QCString Client::sessionId()
Returns command property for this client,
taken either from its window or from the leader window.
*/
QCString Client::wmCommand()
QByteArray Client::wmCommand()
{
QCString result = staticWmCommand(window());
QByteArray result = staticWmCommand(window());
if (result.isEmpty() && wmClientLeaderWin && wmClientLeaderWin!=window())
result = staticWmCommand(wmClientLeaderWin);
return result;
@ -1587,9 +1584,9 @@ void Client::getWmClientMachine()
Returns client machine for this client,
taken either from its window or from the leader window.
*/
QCString Client::wmClientMachine( bool use_localhost ) const
QByteArray Client::wmClientMachine( bool use_localhost ) const
{
QCString result = client_machine;
QByteArray result = client_machine;
if( use_localhost )
{ // special name for the local machine (localhost)
if( result != "localhost" && isLocalMachine( result ))
@ -1694,7 +1691,7 @@ NET::WindowType Client::windowType( bool direct, int supported_types ) const
wt = NET::TopMenu;
}
// TODO change this to rule
const char* const oo_prefix = "openoffice.org"; // QCString has no startsWith()
const char* const oo_prefix = "openoffice.org"; // QByteArray has no startsWith()
// oo_prefix is lowercase, because resourceClass() is forced to be lowercase
if( qstrncmp( resourceClass(), oo_prefix, strlen( oo_prefix )) == 0 && wt == NET::Dialog )
wt = NET::Normal; // see bug #66065
@ -1717,25 +1714,25 @@ void Client::setCursor( Position m )
{
case PositionTopLeft:
case PositionBottomRight:
setCursor( sizeFDiagCursor );
setCursor( Qt::sizeFDiagCursor );
break;
case PositionBottomLeft:
case PositionTopRight:
setCursor( sizeBDiagCursor );
setCursor( Qt::sizeBDiagCursor );
break;
case PositionTop:
case PositionBottom:
setCursor( sizeVerCursor );
setCursor( Qt::sizeVerCursor );
break;
case PositionLeft:
case PositionRight:
setCursor( sizeHorCursor );
setCursor( Qt::sizeHorCursor );
break;
default:
if( buttonDown && isMovable())
setCursor( sizeAllCursor );
setCursor( Qt::sizeAllCursor );
else
setCursor( arrowCursor );
setCursor( Qt::arrowCursor );
break;
}
}
@ -1748,7 +1745,7 @@ void Client::setCursor( const QCursor& c )
cursor = c;
if( decoration != NULL )
decoration->widget()->setCursor( cursor );
XDefineCursor( qt_xdisplay(), frameId(), cursor.handle());
XDefineCursor( QX11Info::display(), frameId(), cursor.handle());
}
Client::Position Client::mousePosition( const QPoint& p ) const
@ -1803,21 +1800,21 @@ void Client::setOpacity(bool translucent, uint opacity)
{
if (isDesktop())
return; // xcompmgr does not like non solid desktops and the user could set it accidently by mouse scrolling
// qWarning("setting opacity for %d",qt_xdisplay());
// qWarning("setting opacity for %d",QX11Info::display());
//rule out activated translulcency with 100% opacity
if (!translucent || opacity == 0xFFFFFFFF)
{
opacity_ = 0xFFFFFFFF;
XDeleteProperty (qt_xdisplay(), frameId(), atoms->net_wm_window_opacity);
XDeleteProperty (qt_xdisplay(), window(), atoms->net_wm_window_opacity); // ??? frameId() is necessary for visible changes, window() is the winId() that would be set by apps - we set both to be sure the app knows what's currently displayd
XDeleteProperty (QX11Info::display(), frameId(), atoms->net_wm_window_opacity);
XDeleteProperty (QX11Info::display(), window(), atoms->net_wm_window_opacity); // ??? frameId() is necessary for visible changes, window() is the winId() that would be set by apps - we set both to be sure the app knows what's currently displayd
}
else{
if(opacity == opacity_)
return;
opacity_ = opacity;
long data = opacity; // 32bit XChangeProperty needs long
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(qt_xdisplay(), window(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(QX11Info::display(), window(), atoms->net_wm_window_opacity, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
}
@ -1826,7 +1823,7 @@ void Client::setShadowSize(uint shadowSize)
// ignoring all individual settings - if we control a window, we control it's shadow
// TODO somehow handle individual settings for docks (besides custom sizes)
long data = shadowSize;
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_shadow, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::updateOpacity()
@ -2010,7 +2007,7 @@ bool Client::getWindowOpacity() //query translucency settings from X, returns tr
Atom actual;
int format, result;
unsigned long n, left;
result = XGetWindowProperty(qt_xdisplay(), window(), atoms->net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data);
result = XGetWindowProperty(QX11Info::display(), window(), atoms->net_wm_window_opacity, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, /*(unsigned char **)*/ &data);
if (result == Success && data != None && format == 32 )
{
opacity_ = *reinterpret_cast< long* >( data );
@ -2056,12 +2053,12 @@ void Client::setDecoHashProperty(uint topHeight, uint rightWidth, uint bottomHei
(rightWidth < 255 ? rightWidth : 255) << 16 |
(bottomHeight < 255 ? bottomHeight : 255) << 8 |
(leftWidth < 255 ? leftWidth : 255);
XChangeProperty(qt_xdisplay(), frameId(), atoms->net_wm_window_decohash, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
XChangeProperty(QX11Info::display(), frameId(), atoms->net_wm_window_decohash, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &data, 1L);
}
void Client::unsetDecoHashProperty()
{
XDeleteProperty( qt_xdisplay(), frameId(), atoms->net_wm_window_decohash);
XDeleteProperty( QX11Info::display(), frameId(), atoms->net_wm_window_decohash);
}
#ifndef NDEBUG

View file

@ -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;
}

View file

@ -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

View file

@ -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 {

View file

@ -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;
};
}

View file

@ -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."));

View file

@ -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;
};

View file

@ -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

View file

@ -13,7 +13,6 @@
#include <kdialog.h>
#include <klocale.h>
#include <qpixmap.h>
#include <qvbox.h>
extern "C"
{
@ -34,7 +33,7 @@ KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, QWidget* parent )
{
KGlobal::locale()->insertCatalogue("kwin_clients");
highcolor = QPixmap::defaultDepth() > 8;
gb = new QVBox( parent );
gb = new Q3VBox( parent );
gb->setSpacing( KDialog::spacingHint() );
cbShowStipple = new QCheckBox( i18n("Draw titlebar &stipple effect"), gb );

View file

@ -13,9 +13,8 @@
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <kconfig.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qvbox.h>
#include <Qt3Support/q3vbox.h>
class KDEDefaultConfig: public QObject
{
@ -41,7 +40,7 @@ class KDEDefaultConfig: public QObject
QCheckBox* cbShowStipple;
QCheckBox* cbShowGrabBar;
QCheckBox* cbUseGradients;
QVBox* gb;
Q3VBox* gb;
bool highcolor;
};

View file

@ -26,6 +26,7 @@
#include <qapplication.h>
#include <qlabel.h>
#include <kdebug.h>
#include <Qt3Support/q3pointarray.h>
namespace Default
{
@ -528,9 +529,9 @@ void KDEDefaultHandler::drawButtonBackground(KPixmap *pix,
p.drawLine(2, x2-2, y2-2, x2-2);
}
QValueList< KDEDefaultHandler::BorderSize > KDEDefaultHandler::borderSizes() const
QList< KDEDefaultHandler::BorderSize > KDEDefaultHandler::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}
@ -560,7 +561,7 @@ bool KDEDefaultHandler::supports( Ability ability )
KDEDefaultButton::KDEDefaultButton(ButtonType type, KDEDefaultClient *parent, const char *name)
: KCommonDecorationButton(type, parent, name)
{
setBackgroundMode( QWidget::NoBackground );
setAttribute( Qt::WA_NoBackground );
isMouseOver = false;
deco = NULL;
@ -721,7 +722,7 @@ void KDEDefaultButton::enterEvent(QEvent *e)
{
isMouseOver=true;
repaint(false);
QButton::enterEvent(e);
KCommonDecorationButton::enterEvent(e);
}
@ -729,7 +730,7 @@ void KDEDefaultButton::leaveEvent(QEvent *e)
{
isMouseOver=false;
repaint(false);
QButton::leaveEvent(e);
KCommonDecorationButton::leaveEvent(e);
}
@ -938,7 +939,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
p.drawLine(x+1, y2-1, x2-1, y2-1);
p.setPen(options()->color(ColorFrame, isActive()));
QPointArray a;
Q3PointArray a;
QBrush brush( options()->color(ColorFrame, isActive()), Qt::SolidPattern );
p.setBrush( brush ); // use solid, yellow brush
a.setPoints( 4, x+2, leftFrameStart+borderWidth-4,
@ -990,7 +991,8 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
// Fill with frame color behind RHS buttons
p.fillRect( rightOffset, y+2, x2-rightOffset-1, titleHeight+1, c2);
QPainter p2( titleBuffer, this );
QPainter p2( titleBuffer );
p2.initFrom( widget());
// Draw the titlebar gradient
if (upperGradient)
@ -1022,7 +1024,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
p2.setPen( options()->color(ColorFont, isActive()) );
p2.drawText(r.x(), 1, r.width()-1, r.height(),
(caption().isRightToLeft() ? AlignRight : AlignLeft) | AlignVCenter,
(caption().isRightToLeft() ? Qt::AlignRight : Qt::AlignLeft) | Qt::AlignVCenter,
caption() );
bitBlt( widget(), 2, 2, titleBuffer );

View file

@ -13,7 +13,6 @@
#ifndef _KDE_DEFAULT_H
#define _KDE_DEFAULT_H
#include <qbutton.h>
#include <qbitmap.h>
#include <qdatetime.h>
#include <kpixmap.h>
@ -35,7 +34,7 @@ class KDEDefaultHandler: public KDecorationFactory
~KDEDefaultHandler();
KDecoration* createDecoration( KDecorationBridge* b );
bool reset( unsigned long changed );
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
virtual bool supports( Ability ability );
private:

View file

@ -2,43 +2,19 @@ INCLUDES = -I$(srcdir)/../../lib $(all_includes)
SUBDIRS = . config
noinst_PROGRAMS = embedtool
noinst_HEADERS = tiles.h
embedtool_SOURCES = embedtool.cpp
embedtool_LDADD = $(LIB_QT)
embedtool_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kde_module_LTLIBRARIES = kwin3_keramik.la
kwin3_keramik_la_SOURCES = keramik.cpp
kwin3_keramik_la_COMPILE_FIRST = tiles.h
kwin3_keramik_la_SOURCES = keramik.cpp tiles.qrc
kwin3_keramik_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
kwin3_keramik_la_LIBADD = $(LIB_KDEUI) ../../lib/libkdecorations.la
#kwin3_keramik_la_LDFLAGS = $(all_libraries) -avoid-version -module $(KDE_RPATH) $(KDE_MT_LDFLAGS)
METASOURCES = AUTO
noinst_headers = keramik.h tiles.h
noinst_headers = keramik.h
lnkdir = $(kde_datadir)/kwin
lnk_DATA = keramik.desktop
EXTRA_DIST = $(lnk_DATA)
tiles.h: pics/caption-large-left.png pics/caption-small-right.png pics/titlebar-center.png \
pics/titlebutton-square.png pics/border-left.png pics/caption-large-right.png \
pics/grabbar-center.png pics/titlebar-left.png pics/border-right.png \
pics/caption-small-center.png pics/grabbar-left.png pics/titlebar-right.png \
pics/caption-large-center.png pics/caption-small-left.png pics/grabbar-right.png \
pics/titlebutton-round.png pics/bottom-left.png pics/bottom-right.png \
pics/bottom-center.png \
pics/titlebutton-square-large.png pics/titlebutton-square-huge.png \
pics/titlebutton-round-large.png pics/titlebutton-round-huge.png
tiles.h: embedtool
pics=`ls $(srcdir)/pics/*.png 2>/dev/null` ;\
./embedtool $$pics
keramik.lo: tiles.h

View file

@ -68,9 +68,5 @@
</widget>
</vbox>
</widget>
<includes>
<include location="global" impldecl="in implementation">kdialog.h</include>
</includes>
<layoutdefaults spacing="6" margin="11"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

View file

@ -1,230 +0,0 @@
/*
* Keramik KWin embed tool (version 1.0)
*
* Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
*
* 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
* the Free Software Foundation; either version 2 of the license, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <qimage.h>
#include <qtextstream.h>
#include <qregexp.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qdatetime.h>
#include <iostream>
static int primes[] = {
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
179, 181, 191, 193, 197, 199, 211, 223, 227, 229
};
struct EmbedImage {
QString string;
int width;
int height;
bool alpha;
QString name;
};
class KeramikEmbedder {
public:
KeramikEmbedder();
~KeramikEmbedder();
void embed( const char * );
void writeIndex();
private:
QFile *file;
QPtrList<EmbedImage> *index;
QTextStream stream;
};
KeramikEmbedder::KeramikEmbedder()
{
QDateTime date( QDateTime::currentDateTime() );
QString datestring( date.toString() );
file = new QFile( "tiles.h" );
file->open( IO_WriteOnly | IO_Truncate );
stream.setDevice( file );
stream << "/*\n";
stream << " * Generated by embedtool 1.0 on " << datestring << endl;
stream << " */\n\n";
stream << "#ifndef __TILES_H\n";
stream << "#define __TILES_H\n\n";
stream << "#include <qimage.h>\n";
stream << "#include <qdict.h>\n\n";
stream << "namespace Keramik {\n\n";
index = new QPtrList<EmbedImage>;
index->setAutoDelete( true );
}
KeramikEmbedder::~KeramikEmbedder()
{
stream << "} // namespace Keramik\n\n";
stream << "#endif // __TILES_H\n\n";
stream << "// vim: set noet ts=4 sw=4:\n";
file->close();
delete file;
delete index;
}
void KeramikEmbedder::embed( const char *name )
{
QFileInfo fileinfo( name );
QString basename( fileinfo.baseName() );
QString codename( basename );
QImage image( name );
codename = codename.replace( QRegExp("[^a-zA-Z0-9]"), "_" );
stream << "\tstatic const QRgb " << codename << "_data[] = {" << endl << "\t\t";
stream.setf( QTextStream::hex | QTextStream::right );
stream.fill( '0' );
int pixels = image.width() * image.height();
Q_UINT32 *data = reinterpret_cast<Q_UINT32*>( image.bits() );
bool hasAlpha = false;
for ( int i = 0, j = 0; i < pixels; i++ ) {
if ( qAlpha( *data ) && qAlpha( *data ) != 0xff )
hasAlpha = true;
stream << "0x" << qSetW(8) << *(data++);
if ( i != pixels-1 ) {
stream << ',';
if ( j++ > 4 ) {
j = 0;
stream << endl << "\t\t";
} else
stream << ' ';
}
}
stream.reset();
stream << endl << "\t}; // " << codename << "_data" << endl << endl;
EmbedImage *imginfo = new EmbedImage;
imginfo->width = image.width();
imginfo->height = image.height();
imginfo->alpha = hasAlpha;
imginfo->name = codename;
imginfo->string = basename;
index->append( imginfo );
}
void KeramikEmbedder::writeIndex()
{
stream << "\tstruct EmbedImage {\n";
stream << "\t\tconst char *name;\n";
stream << "\t\tint width;\n";
stream << "\t\tint height;\n";
stream << "\t\tbool alpha;\n";
stream << "\t\tconst QRgb *data;\n";
stream << "\t};\n\n";
uint i = 0;
stream << "\tstatic const EmbedImage image_db[] = {\n";
for ( EmbedImage *image = index->first(); image; image = index->next() )
{
stream << "\t\t{ \"" << image->string << "\", "
<< image->width << ", " << image->height <<
", " << (image->alpha ? "true" : "false")
<< ", " << image->name << "_data }";
if ( i++ < index->count() - 1 )
stream << ',';
stream << endl;
}
stream << "\t};\n\n";
uint prime = 0;
for ( i = 0; i < 50; i++ )
if ( (prime = primes[i]) >= index->count() )
break;
stream << "\tclass KeramikImageDb {\n";
stream << "\tprivate:\n";
stream << "\t\tstatic KeramikImageDb *m_inst;\n";
stream << "\t\tQDict<QImage> *db;\n\n";
stream << "\t\tKeramikImageDb() {\n";
stream << "\t\t\tdb = new QDict<QImage>( " << prime << " );\n";
stream << "\t\t\tdb->setAutoDelete( true );\n\n";
stream << "\t\t\tfor ( int i = 0; i < " << index->count() << "; i++ ) {\n";
stream << "\t\t\t\tQImage *img = new QImage( (uchar*)image_db[i].data,\n";
stream << "\t\t\t\t\t\timage_db[i].width, image_db[i].height,\n";
stream << "\t\t\t\t\t\t32, NULL, 0, QImage::LittleEndian );\n\n";
stream << "\t\t\t\tif ( image_db[i].alpha )\n";
stream << "\t\t\t\t\timg->setAlphaBuffer( true );\n\n";
stream << "\t\t\t\tdb->insert( image_db[i].name, img );\n";
stream << "\t\t\t}\n";
stream << "\t\t}\n\n";
stream << "\t\t~KeramikImageDb() {\n";
stream << "\t\t\tdelete db;\n";
stream << "\t\t}\n\n";
stream << "\tpublic:\n";
stream << "\t\tstatic KeramikImageDb* instance() {\n";
stream << "\t\t\tif ( ! m_inst ) m_inst = new KeramikImageDb;\n";
stream << "\t\t\treturn m_inst;\n";
stream << "\t\t}\n\n";
stream << "\t\tstatic void release() {\n";
stream << "\t\t\tif ( m_inst ) delete m_inst;\n";
stream << "\t\t\tm_inst = NULL;\n";
stream << "\t\t}\n\n";
stream << "\t\tQImage *image( const QString &name ) const {\n";
stream << "\t\t\treturn db->find( name );\n";
stream << "\t\t}\n\n";
stream << "\t}; // class KeramikImageDb\n\n";
stream << "\tKeramikImageDb *KeramikImageDb::m_inst = NULL;\n\n";
}
int main( int argv, char **argc )
{
if ( argv < 2 ) {
std::cout << "Insufficient arguments" << std::endl;
return 1;
}
KeramikEmbedder embedder;
for ( int i = 1; i < argv; i++ )
{
std::cout << argc[i] << std::endl;
embedder.embed( argc[i] );
}
embedder.writeIndex();
return 0;
}
// vim: set noet ts=4 sw=4:

View file

@ -31,6 +31,8 @@
#include <qtooltip.h>
#include <qwidget.h>
#include <qlabel.h>
#include <QEvent>
#include <QApplication>
#include <X11/Xlib.h>
@ -171,8 +173,6 @@ KeramikHandler::KeramikHandler()
settings_cache = NULL;
imageDb = KeramikImageDb::instance();
// Create the button deco bitmaps
buttonDecos[ Menu ] = new QBitmap( 17, 17, menu_bits, true );
buttonDecos[ OnAllDesktops ] = new QBitmap( 17, 17, on_all_desktops_bits, true );
@ -219,8 +219,6 @@ KeramikHandler::~KeramikHandler()
delete settings_cache;
KeramikImageDb::release();
imageDb = NULL;
clientHandler = NULL;
}
@ -628,11 +626,11 @@ QPixmap *KeramikHandler::composite( QImage *over, QImage *under )
QImage *KeramikHandler::loadImage( const QString &name, const QColor &col )
{
if ( col.isValid() ) {
QImage *img = new QImage( imageDb->image(name)->copy() );
QImage *img = new QImage( ":/pics/" + name + ".png" );
KIconEffect::colorize( *img, col, 1.0 );
return img;
} else
return new QImage( imageDb->image(name)->copy() );
return new QImage( ":/pics/" + name + ".png" );
}
@ -742,9 +740,9 @@ KDecoration* KeramikHandler::createDecoration( KDecorationBridge* bridge )
return new KeramikClient( bridge, this );
}
QValueList< KeramikHandler::BorderSize > KeramikHandler::borderSizes() const
QList< KeramikHandler::BorderSize > KeramikHandler::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}
@ -754,14 +752,14 @@ QValueList< KeramikHandler::BorderSize > KeramikHandler::borderSizes() const
KeramikButton::KeramikButton( KeramikClient* c, const char *name, Button btn, const QString &tip, const int realizeBtns )
: QButton( c->widget(), name ),
client( c ), button( btn ), hover( false ), lastbutton( NoButton )
: Q3Button( c->widget(), name ),
client( c ), button( btn ), hover( false ), lastbutton( Qt::NoButton )
{
realizeButtons = realizeBtns;
QToolTip::add( this, tip ); // FRAME
setBackgroundMode( NoBackground );
setCursor( arrowCursor );
setBackgroundMode( Qt::NoBackground );
setCursor( Qt::arrowCursor );
int size = clientHandler->roundButton()->height();
setFixedSize( size, size );
@ -777,7 +775,7 @@ KeramikButton::~KeramikButton()
void KeramikButton::enterEvent( QEvent *e )
{
QButton::enterEvent( e );
Q3Button::enterEvent( e );
hover = true;
repaint( false );
@ -786,7 +784,7 @@ void KeramikButton::enterEvent( QEvent *e )
void KeramikButton::leaveEvent( QEvent *e )
{
QButton::leaveEvent( e );
Q3Button::leaveEvent( e );
hover = false;
repaint( false );
@ -796,16 +794,16 @@ void KeramikButton::leaveEvent( QEvent *e )
void KeramikButton::mousePressEvent( QMouseEvent *e )
{
lastbutton = e->button();
QMouseEvent me( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?LeftButton:NoButton, e->state() );
QButton::mousePressEvent( &me );
QMouseEvent me( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state() );
Q3Button::mousePressEvent( &me );
}
void KeramikButton::mouseReleaseEvent( QMouseEvent *e )
{
lastbutton = e->button();
QMouseEvent me( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?LeftButton:NoButton, e->state() );
QButton::mouseReleaseEvent( &me );
QMouseEvent me( e->type(), e->pos(), e->globalPos(), (e->button()&realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state() );
Q3Button::mouseReleaseEvent( &me );
}
@ -828,14 +826,14 @@ void KeramikButton::drawButton( QPainter *p )
if ( isDown() ) {
// Pressed
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QRect(2*size, 0, size, size), pix->rect() ) );
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(2*size, 0, size, size), pix->rect() ) );
p->translate( QApplication::reverseLayout() ? -1 : 1, 1 );
} else if ( hover )
// Mouse over
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QRect(size, 0, size, size), pix->rect() ) );
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(size, 0, size, size), pix->rect() ) );
else
// Normal
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QRect(0, 0, size, size), pix->rect() ) );
p->drawPixmap( QPoint(), *pix, QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(0, 0, size, size), pix->rect() ) );
// Draw the button deco on the bevel
@ -906,11 +904,12 @@ void KeramikClient::init()
connect( this, SIGNAL( keepAboveChanged( bool )), SLOT( keepAboveChange( bool )));
connect( this, SIGNAL( keepBelowChanged( bool )), SLOT( keepBelowChange( bool )));
createMainWidget( WStaticContents | WResizeNoErase | WRepaintNoErase );
createMainWidget( Qt::WResizeNoErase );
widget()->setAttribute( Qt::WA_StaticContents );
widget()->installEventFilter( this );
// Minimize flicker
widget()->setBackgroundMode( NoBackground );
widget()->setBackgroundMode( Qt::NoBackground );
for ( int i=0; i < NumButtons; i++ )
button[i] = NULL;
@ -1023,14 +1022,14 @@ void KeramikClient::reset( unsigned long )
void KeramikClient::addButtons( QBoxLayout *layout, const QString &s )
{
for ( uint i=0; i < s.length(); i++ )
for ( int i=0; i < s.length(); i++ )
{
switch ( s[i].latin1() )
{
// Menu button
case 'M' :
if ( !button[MenuButton] ) {
button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), LeftButton|RightButton );
button[MenuButton] = new KeramikButton( this, "menu", MenuButton, i18n("Menu"), Qt::LeftButton|Qt::RightButton );
connect( button[MenuButton], SIGNAL( pressed() ), SLOT( menuButtonPressed() ) );
layout->addWidget( button[MenuButton] );
}
@ -1069,7 +1068,7 @@ void KeramikClient::addButtons( QBoxLayout *layout, const QString &s )
// Maximize button
case 'A' :
if ( !button[MaxButton] && isMaximizable() ) {
button[MaxButton] = new KeramikButton( this, "maximize", MaxButton, i18n("Maximize"), LeftButton|MidButton|RightButton );
button[MaxButton] = new KeramikButton( this, "maximize", MaxButton, i18n("Maximize"), Qt::LeftButton|Qt::MidButton|Qt::RightButton );
connect( button[MaxButton], SIGNAL( clicked() ), SLOT( slotMaximize() ) );
layout->addWidget( button[MaxButton] );
}
@ -1257,7 +1256,7 @@ void KeramikClient::updateCaptionBuffer()
( clientHandler->showAppIcons() ? 16 + iconSpacing : 0 );
int xpos = QMAX( (captionRect.width() - tw) / 3, 8 );
QRect tr = QStyle::visualRect( QRect(xpos, 1, captionRect.width() - xpos - 10,
QRect tr = QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(xpos, 1, captionRect.width() - xpos - 10,
captionRect.height() - 4), captionBuffer.rect() );
//p.setPen( Qt::red ); // debug
@ -1266,7 +1265,7 @@ void KeramikClient::updateCaptionBuffer()
// Application icon
if ( clientHandler->showAppIcons() )
{
QRect iconRect = QStyle::visualRect( QRect(tr.x(),
QRect iconRect = QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(tr.x(),
1 + (captionRect.height() - 4 - 16) / 2, 16, 16), tr );
QRect r( icon->rect() );
r.moveCenter( iconRect.center() );
@ -1294,8 +1293,8 @@ void KeramikClient::updateCaptionBuffer()
}
// Draw the titlebar text
int flags = AlignVCenter | SingleLine;
flags |= ( QApplication::reverseLayout() ? AlignRight : AlignLeft );
int flags = Qt::AlignVCenter | Qt::SingleLine;
flags |= ( QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft );
if ( clientHandler->useShadowedText() )
{
@ -1304,7 +1303,7 @@ void KeramikClient::updateCaptionBuffer()
if (qGray(options()->color(ColorFont, active).rgb()) < 100)
p.setPen( QColor(200,200,200) );
else
p.setPen( black );
p.setPen( Qt::black );
p.drawText( tr, flags, caption() );
p.translate( QApplication::reverseLayout() ? 1 : -1, -1 );
}
@ -1326,7 +1325,7 @@ void KeramikClient::calculateCaptionRect()
cw += 16 + 4; // icon width + space
cw = QMIN( cw, titlebar->geometry().width() );
captionRect = QStyle::visualRect( QRect(titlebar->geometry().x(), (largeCaption ? 0 : titleBaseY),
captionRect = QStyle::visualRect( QApplication::reverseLayout() ? Qt::RightToLeft : Qt::LeftToRight, QRect(titlebar->geometry().x(), (largeCaption ? 0 : titleBaseY),
cw, clientHandler->titleBarHeight(largeCaption) ),
titlebar->geometry() );
}
@ -1645,7 +1644,7 @@ void KeramikClient::resizeEvent( QResizeEvent *e )
widget()->update( QRect( titlebar->geometry().topRight(), QPoint( width() - 4,
titlebar->geometry().bottom() ) ) );
// Titlebar needs no paint event
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry(), FALSE ) );
QApplication::postEvent( this, new QPaintEvent( titlebar->geometry() ) );
}
}
}
@ -1653,7 +1652,7 @@ void KeramikClient::resizeEvent( QResizeEvent *e )
void KeramikClient::mouseDoubleClickEvent( QMouseEvent *e )
{
if ( e->button() == LeftButton
if ( e->button() == Qt::LeftButton
&& QRect( 0, 0, width(), clientHandler->titleBarHeight( largeTitlebar ) ).contains( e->pos() ) )
titlebarDblClickOperation();
}

View file

@ -24,12 +24,10 @@
#ifndef __KERAMIK_H
#define __KERAMIK_H
#include <qbutton.h>
#include <Q3Button>
#include <kdecoration.h>
#include <kdecorationfactory.h>
#include "tiles.h"
class QSpacerItem;
namespace Keramik {
@ -60,7 +58,7 @@ namespace Keramik {
KeramikHandler();
~KeramikHandler();
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
virtual bool reset( unsigned long changed );
virtual KDecoration* createDecoration( KDecorationBridge* );
virtual bool supports( Ability ability );
@ -101,7 +99,6 @@ namespace Keramik {
bool showIcons:1, shadowedText:1,
smallCaptionBubbles:1, largeGrabBars:1;
SettingsCache *settings_cache;
KeramikImageDb *imageDb;
QPixmap *activeTiles[ NumTiles ];
QPixmap *inactiveTiles[ NumTiles ];
@ -112,13 +109,13 @@ namespace Keramik {
}; // class KeramikHandler
class KeramikClient;
class KeramikButton : public QButton
class KeramikButton : public Q3Button
{
public:
KeramikButton( KeramikClient *, const char *, Button, const QString &, const int realizeBtns = LeftButton );
KeramikButton( KeramikClient *, const char *, Button, const QString &, const int realizeBtns = Qt::LeftButton );
~KeramikButton();
ButtonState lastButton() const { return lastbutton; }
Qt::ButtonState lastButton() const { return lastbutton; }
private:
void enterEvent( QEvent * );
@ -131,7 +128,7 @@ namespace Keramik {
KeramikClient *client;
Button button;
bool hover;
ButtonState lastbutton;
Qt::ButtonState lastbutton;
int realizeButtons;
}; // class KeramikButton

27
clients/keramik/tiles.qrc Normal file
View file

@ -0,0 +1,27 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>pics/border-left.png</file>
<file>pics/border-right.png</file>
<file>pics/bottom-center.png</file>
<file>pics/bottom-left.png</file>
<file>pics/bottom-right.png</file>
<file>pics/caption-large-center.png</file>
<file>pics/caption-large-left.png</file>
<file>pics/caption-large-right.png</file>
<file>pics/caption-small-center.png</file>
<file>pics/caption-small-left.png</file>
<file>pics/caption-small-right.png</file>
<file>pics/grabbar-center.png</file>
<file>pics/grabbar-left.png</file>
<file>pics/grabbar-right.png</file>
<file>pics/titlebar-center.png</file>
<file>pics/titlebar-left.png</file>
<file>pics/titlebar-right.png</file>
<file>pics/titlebutton-round-huge.png</file>
<file>pics/titlebutton-round-large.png</file>
<file>pics/titlebutton-round.png</file>
<file>pics/titlebutton-square-huge.png</file>
<file>pics/titlebutton-square-large.png</file>
<file>pics/titlebutton-square.png</file>
</qresource>
</RCC>

View file

@ -5,7 +5,7 @@ kde_module_LTLIBRARIES = kwin3_laptop.la
kwin3_laptop_la_SOURCES = laptopclient.cpp
kwin3_laptop_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
kwin3_laptop_la_LIBADD = ../../lib/libkdecorations.la
kwin3_laptop_la_LIBADD = ../../lib/libkdecorations.la -lkdefx
METASOURCES = AUTO
noinst_HEADERS = laptopclient.h

View file

@ -9,6 +9,9 @@
#include <kconfig.h> // up here to avoid X11 header conflict :P
#include "laptopclient.h"
#include <qdrawutil.h>
//Added by qt3to4:
#include <QPixmap>
#include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kdrawutil.h>
#include <kglobal.h>
@ -249,7 +252,7 @@ static void delete_pixmaps()
LaptopButton::LaptopButton(ButtonType type, LaptopClient *parent, const char *name)
: KCommonDecorationButton(type, parent, name)
{
setBackgroundMode(QWidget::NoBackground);
setBackgroundMode(Qt::NoBackground);
}
void LaptopButton::reset(unsigned long changed)
@ -556,7 +559,7 @@ void LaptopClient::paintEvent( QPaintEvent* )
p.drawLine(r.x(), r.bottom(), r.right(), r.bottom());
p.setPen(options()->color(KDecoration::ColorFont, false));
p.drawText(r.x(), r.y(), r.width(), r.height()-1,
AlignCenter, caption() );
Qt::AlignCenter, caption() );
g = options()->colorGroup(KDecoration::ColorFrame, true);
p.setPen(g.background());
p.drawPoint(r.x(), r.y());
@ -639,7 +642,7 @@ void LaptopClient::updateActiveBuffer( )
p.drawLine(r.x(), r.bottom(), r.right(), r.bottom());
p.setPen(options()->color(KDecoration::ColorFont, true));
p.drawText(r.x(), r.y(), r.width(), r.height()-1,
AlignCenter, caption() );
Qt::AlignCenter, caption() );
g = options()->colorGroup(KDecoration::ColorFrame, true);
p.setPen(g.background());
p.drawPoint(r.x(), r.y());
@ -716,11 +719,11 @@ bool LaptopClientFactory::supports( Ability ability )
};
}
QValueList< LaptopClientFactory::BorderSize >
QList< LaptopClientFactory::BorderSize >
LaptopClientFactory::borderSizes() const
{
// the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}

View file

@ -65,7 +65,7 @@ public:
virtual KDecoration* createDecoration( KDecorationBridge* );
virtual bool reset( unsigned long changed );
virtual bool supports( Ability ability );
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
private:
void findPreferredHandleSize();
};

View file

@ -6,7 +6,7 @@ SUBDIRS = config
kde_module_LTLIBRARIES = kwin3_modernsys.la
kwin3_modernsys_la_SOURCES = modernsys.cpp
kwin3_modernsys_la_LIBADD = ../../lib/libkdecorations.la
kwin3_modernsys_la_LIBADD = ../../lib/libkdecorations.la -lkdefx
kwin3_modernsys_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
METASOURCES = AUTO

View file

@ -6,7 +6,11 @@
#include <klocale.h>
#include <kglobal.h>
#include <qlayout.h>
#include <qwhatsthis.h>
//Added by qt3to4:
#include <QLabel>
#include <QVBoxLayout>
#include <QGridLayout>
#include "config.h"
@ -38,7 +42,7 @@ ModernSysConfig::ModernSysConfig(KConfig* conf, QWidget* parent) : QObject(paren
QGridLayout* layout = new QGridLayout(handleBox, 0, KDialog::spacingHint());
cbShowHandle = new QCheckBox(i18n("&Show window resize handle"), handleBox);
QWhatsThis::add(cbShowHandle,
cbShowHandle->setWhatsThis(
i18n("When selected, all windows are drawn with a resize "
"handle at the lower right corner. This makes window resizing "
"easier, especially for trackballs and other mouse replacements "
@ -46,24 +50,24 @@ ModernSysConfig::ModernSysConfig(KConfig* conf, QWidget* parent) : QObject(paren
layout->addMultiCellWidget(cbShowHandle, 0, 0, 0, 1);
connect(cbShowHandle, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()));
sliderBox = new QVBox(handleBox);
handleSizeSlider = new QSlider(0, 4, 1, 0, QSlider::Horizontal, sliderBox);
QWhatsThis::add(handleSizeSlider,
sliderBox = new Q3VBox(handleBox);
handleSizeSlider = new QSlider(0, 4, 1, 0, Qt::Horizontal, sliderBox);
handleSizeSlider->setWhatsThis(
i18n("Here you can change the size of the resize handle."));
handleSizeSlider->setTickInterval(1);
handleSizeSlider->setTickmarks(QSlider::Below);
connect(handleSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotSelectionChanged()));
hbox = new QHBox(sliderBox);
hbox = new Q3HBox(sliderBox);
hbox->setSpacing(6);
bool rtl = kapp->reverseLayout();
label1 = new QLabel(i18n("Small"), hbox);
label1->setAlignment(rtl ? AlignRight : AlignLeft);
label1->setAlignment(rtl ? Qt::AlignRight : Qt::AlignLeft);
label2 = new QLabel(i18n("Medium"), hbox);
label2->setAlignment(AlignHCenter);
label2->setAlignment( Qt::AlignHCenter );
label3 = new QLabel(i18n("Large"), hbox);
label3->setAlignment(rtl ? AlignLeft : AlignRight);
label3->setAlignment(rtl ? Qt::AlignLeft : Qt::AlignRight);
vbox->addWidget(handleBox);
vbox->addStretch(1);
@ -104,7 +108,7 @@ void ModernSysConfig::load(KConfig* /*conf*/)
handleSizeSlider->setEnabled(i);
handleWidth = clientrc->readUnsignedNumEntry("HandleWidth", 6);
handleSize = clientrc->readUnsignedNumEntry("HandleSize", 30);
handleSizeSlider->setValue(QMIN((handleWidth - 6) / 2, 4));
handleSizeSlider->setValue(QMIN((handleWidth - 6) / 2, (uint)4));
}

View file

@ -2,11 +2,13 @@
#define __KDE_MODSYSTEMCONFIG_H
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <q3groupbox.h>
#include <qlayout.h>
#include <qvbox.h>
#include <q3vbox.h>
#include <qslider.h>
#include <qlabel.h>
//Added by qt3to4:
#include <QVBoxLayout>
class ModernSysConfig : public QObject
{
@ -34,9 +36,9 @@ class ModernSysConfig : public QObject
QVBoxLayout *vbox;
QWidget *handleBox;
QCheckBox *cbShowHandle;
QVBox *sliderBox;
Q3VBox *sliderBox;
QSlider *handleSizeSlider;
QHBox *hbox;
Q3HBox *hbox;
QLabel *label1;
QLabel *label2;
QLabel *label3;

View file

@ -6,6 +6,9 @@
#include <klocale.h>
#include <qlayout.h>
#include <qdrawutil.h>
//Added by qt3to4:
#include <QPixmap>
#include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kdrawutil.h>
#include <qbitmap.h>
@ -276,9 +279,9 @@ void ModernSysFactory::read_config()
title_height = theight;
}
QValueList< ModernSysFactory::BorderSize > ModernSysFactory::borderSizes() const
QList< ModernSysFactory::BorderSize > ModernSysFactory::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge;
// as long as the buttons don't scale don't offer the largest two sizes.
// BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
@ -287,7 +290,7 @@ QValueList< ModernSysFactory::BorderSize > ModernSysFactory::borderSizes() const
ModernButton::ModernButton(ButtonType type, ModernSys *parent, const char *name)
: KCommonDecorationButton(type, parent, name)
{
setBackgroundMode( NoBackground );
setBackgroundMode( Qt::NoBackground );
QBitmap mask(14, 15, QPixmap::defaultDepth() > 8 ?
btnhighcolor_mask_bits : lowcolor_mask_bits, true);
@ -540,7 +543,7 @@ void ModernSys::recalcTitleBuffer()
p.setFont(options()->font(true));
p.drawText(t.x()+((t.width()-fm.width(caption()))/2)-4,
0, fm.width(caption())+8, title_height+2, AlignCenter, caption());
0, fm.width(caption())+8, title_height+2, Qt::AlignCenter, caption());
p.setClipping(false);
p.end();
oldTitle = caption();
@ -597,7 +600,7 @@ void ModernSys::paintEvent( QPaintEvent* )
p.fillRect(1, 1, w-2, title_height+2, fillBrush);
p.setPen(options()->color(ColorFont, isActive()));
p.setFont(options()->font(isActive()));
p.drawText(t, AlignCenter, caption() );
p.drawText(t, Qt::AlignCenter, caption() );
}
// titlebar highlight

View file

@ -62,7 +62,7 @@ public:
virtual KDecoration* createDecoration( KDecorationBridge* );
virtual bool reset( unsigned long changed );
virtual bool supports( Ability ability );
QValueList< BorderSize > borderSizes() const;
QList< BorderSize > borderSizes() const;
private:
void read_config();
};

View file

@ -33,6 +33,7 @@
#include "plastik.moc"
#include "plastikclient.h"
#include "plastikbutton.h"
#include <QApplication>
namespace KWinPlastik
{
@ -272,7 +273,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow
} else {
pm = new QPixmap(1, titleBarTileHeight);
painter.begin(pm);
painter.drawPixmap(0, 0, gradient, 0,2);
painter.drawPixmap(0, 0, gradient, 0,2 ,-1,-1);
if (m_coloredBorder) {
painter.setPen(getColor(TitleGradient3, active).dark(110) );
} else {
@ -540,11 +541,11 @@ const QBitmap &PlastikHandler::buttonBitmap(ButtonIcon type, const QSize &size,
return *bitmap;
}
QValueList< PlastikHandler::BorderSize >
QList< PlastikHandler::BorderSize >
PlastikHandler::borderSizes() const
{
// the list must be sorted
return QValueList< BorderSize >() << BorderTiny << BorderNormal <<
return QList< BorderSize >() << BorderTiny << BorderNormal <<
BorderLarge << BorderVeryLarge << BorderHuge <<
BorderVeryHuge << BorderOversized;
}

View file

@ -93,11 +93,11 @@ public:
int borderSize() { return m_borderSize; }
bool animateButtons() { return m_animateButtons; }
bool menuClose() { return m_menuClose; }
Qt::AlignmentFlags titleAlign() { return m_titleAlign; }
Qt::AlignmentFlag titleAlign() { return m_titleAlign; }
bool reverseLayout() { return m_reverse; }
QColor getColor(KWinPlastik::ColorType type, const bool active = true);
QValueList< PlastikHandler::BorderSize > borderSizes() const;
QList< PlastikHandler::BorderSize > borderSizes() const;
private:
void readConfig();
@ -111,7 +111,7 @@ private:
int m_titleHeightTool;
QFont m_titleFont;
QFont m_titleFontTool;
Qt::AlignmentFlags m_titleAlign;
Qt::AlignmentFlag m_titleAlign;
// pixmap cache
QPixmap *m_pixmaps[2][2][NumPixmaps]; // button pixmaps have normal+pressed state...

View file

@ -22,6 +22,7 @@
// #include <kwin/options.h>
#include <Q3Button>
#include <qbitmap.h>
#include <qpainter.h>
#include <qpixmap.h>
@ -46,7 +47,7 @@ PlastikButton::PlastikButton(ButtonType type, PlastikClient *parent, const char
m_iconType(NumButtonIcons),
hover(false)
{
setBackgroundMode(NoBackground);
setBackgroundMode(Qt::NoBackground);
// no need to reset here as the button will be resetted on first resize.
@ -145,7 +146,7 @@ void PlastikButton::animate()
void PlastikButton::enterEvent(QEvent *e)
{
QButton::enterEvent(e);
Q3Button::enterEvent(e);
hover = true;
animate();
@ -153,7 +154,7 @@ void PlastikButton::enterEvent(QEvent *e)
void PlastikButton::leaveEvent(QEvent *e)
{
QButton::leaveEvent(e);
Q3Button::leaveEvent(e);
hover = false;
animate();

View file

@ -23,7 +23,6 @@
#ifndef PLASTIKBUTTON_H
#define PLASTIKBUTTON_H
#include <qbutton.h>
#include <qimage.h>
#include "plastik.h"

View file

@ -394,7 +394,7 @@ QRect PlastikClient::captionRect() const
buttonsLeftWidth() - buttonsRightWidth() -
marginLeft - marginRight;
Qt::AlignmentFlags a = Handler()->titleAlign();
Qt::AlignmentFlag a = Handler()->titleAlign();
int tX, tW; // position/width of the title buffer
if (caption.width() > titleWidth) {
@ -468,7 +468,7 @@ const QPixmap &PlastikClient::captionPixmap() const
// not found, create new pixmap...
const uint maxCaptionLength = 300; // truncate captions longer than this!
const int maxCaptionLength = 300; // truncate captions longer than this!
QString c(caption() );
if (c.length() > maxCaptionLength) {
c.truncate(maxCaptionLength);

View file

@ -9,7 +9,7 @@
#include "config.h"
#include <kglobal.h>
#include <qwhatsthis.h>
#include <klocale.h>
@ -35,15 +35,15 @@ QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
{
quartzConfig = new KConfig("kwinquartzrc");
KGlobal::locale()->insertCatalogue("kwin_clients");
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 decoration borders "
"are drawn using the titlebar colors; otherwise, they are "
"drawn using normal border colors instead.") );
cbExtraSmall = new QCheckBox( i18n("Quartz &extra slim"), gb );
QWhatsThis::add( cbExtraSmall,
cbExtraSmall->setWhatsThis(
i18n("Quartz window decorations with extra-small title bar.") );
// Load configuration options
load( conf );

View file

@ -11,7 +11,7 @@
#define __KDE_QUARTZCONFIG_H
#include <qcheckbox.h>
#include <qvbox.h>
#include <q3vbox.h>
#include <kconfig.h>
class QuartzConfig: public QObject
@ -38,7 +38,7 @@ class QuartzConfig: public QObject
KConfig* quartzConfig;
QCheckBox* cbColorBorder;
QCheckBox* cbExtraSmall;
QVBox* gb;
Q3VBox* gb;
};

View file

@ -25,6 +25,9 @@
#include <qapplication.h>
#include "quartz.h"
//Added by qt3to4:
#include <QPixmap>
#include <QPaintEvent>
namespace Quartz {
@ -370,9 +373,9 @@ void QuartzHandler::freePixmaps()
}
QValueList< QuartzHandler::BorderSize > QuartzHandler::borderSizes() const
QList< QuartzHandler::BorderSize > QuartzHandler::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}
@ -381,7 +384,7 @@ QuartzButton::QuartzButton(ButtonType type, QuartzClient *parent, const char *na
: KCommonDecorationButton(type, parent, name)
{
// Eliminate any possible background flicker
setBackgroundMode( QWidget::NoBackground );
setBackgroundMode( Qt::NoBackground );
deco = 0;
}
@ -484,7 +487,7 @@ void QuartzButton::drawButton(QPainter *p)
btnpix = isOn() ? *ipinDownPix : *ipinUpPix;
} else
btnpix = decoration()->icon().pixmap( QIconSet::Small, QIconSet::Normal);
btnpix = decoration()->icon().pixmap( QIcon::Small, QIcon::Normal);
// Shrink the miniIcon for tiny titlebars.
if ( height() < 16)
@ -742,7 +745,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
KPixmap* titleBuffer = new KPixmap;
titleBuffer->resize( maxFull?w-2:(w-2*(borderSize-1)), titleHeight );
QPainter p2( titleBuffer, this );
QPainter p2( titleBuffer );
// subtract titleBlocks pixmap width and some
int rightoffset = r.x()+r.width()-titleBlocks->width()-borderSize;
@ -769,7 +772,7 @@ void QuartzClient::paintEvent( QPaintEvent* )
p2.setPen( options()->color(ColorFont, isActive() ));
p2.drawText(r.x()+4-borderSize, 0, r.width()-3, r.height(),
AlignLeft | AlignVCenter, caption() );
Qt::AlignLeft | Qt::AlignVCenter, caption() );
p2.end();
p.drawPixmap( maxFull?1:borderSize-1, borderSize-1, *titleBuffer );

View file

@ -38,7 +38,7 @@ class QuartzHandler: public QObject, public KDecorationFactory
virtual KDecoration* createDecoration( KDecorationBridge* );
virtual bool reset(unsigned long changed);
virtual bool supports( Ability ability );
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
private:
void readConfig();

View file

@ -5,7 +5,7 @@ kde_module_LTLIBRARIES = kwin3_redmond.la
kwin3_redmond_la_SOURCES = redmond.cpp
kwin3_redmond_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
kwin3_redmond_la_LIBADD = $(LIB_KDECORE) ../../lib/libkdecorations.la
kwin3_redmond_la_LIBADD = $(LIB_KDECORE) -lkdefx ../../lib/libkdecorations.la
METASOURCES = AUTO
noinst_HEADERS = redmond.h

View file

@ -16,6 +16,9 @@
#include <qdrawutil.h>
#include <qdatetime.h>
//Added by qt3to4:
#include <QPixmap>
#include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kimageeffect.h>
#include <kdrawutil.h>
@ -234,7 +237,7 @@ RedmondButton::RedmondButton(ButtonType type, RedmondDeco *parent, const char *n
: KCommonDecorationButton(type, parent, name)
{
// Eliminate background flicker
setBackgroundMode( NoBackground );
setBackgroundMode( Qt::NoBackground );
miniBtn = decoration()->isToolWindow();
}
@ -257,7 +260,7 @@ void RedmondButton::reset(unsigned long changed)
break;
case MenuButton:
{
QPixmap miniIcon = decoration()->icon().pixmap(QIconSet::Small, QIconSet::Normal);
QPixmap miniIcon = decoration()->icon().pixmap(QIcon::Small, QIcon::Normal);
if (!miniIcon.isNull()) {
setPixmap(miniIcon);
} else {
@ -553,7 +556,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
titleBuffer->convertFromImage(image, Qt::OrderedDither);
}
QPainter p2( titleBuffer, this );
QPainter p2( titleBuffer );
// Since drawing the gradient is (relatively) slow, it is best
// to draw the title text on the pixmap.
@ -561,7 +564,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
p2.setFont( fnt );
p2.setPen( options()->color(KDecoration::ColorFont, isActive() ));
p2.drawText( r.x(), fontoffset, r.width()-3, r.height()-1,
AlignLeft | AlignVCenter, caption() );
Qt::AlignLeft | Qt::AlignVCenter, caption() );
p2.end();
p.drawPixmap( modBorderWidth, modBorderWidth, *titleBuffer );
@ -577,7 +580,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
p.setFont( fnt );
p.setPen(options()->color(KDecoration::ColorFont, isActive() ));
p.drawText(r.x()+4, r.y()+fontoffset-2, r.width()-3, r.height()-1,
AlignLeft | AlignVCenter, caption() );
Qt::AlignLeft | Qt::AlignVCenter, caption() );
}
}
@ -670,9 +673,9 @@ bool RedmondDecoFactory::supports( Ability ability )
}
}
QValueList< RedmondDecoFactory::BorderSize > RedmondDecoFactory::borderSizes() const
QList< RedmondDecoFactory::BorderSize > RedmondDecoFactory::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}

View file

@ -79,7 +79,7 @@ public:
virtual KDecoration *createDecoration(KDecorationBridge *);
virtual bool reset(unsigned long);
virtual bool supports( Ability ability );
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
private:
void readConfig();
};

View file

@ -21,6 +21,8 @@
*/
#include <qpainter.h>
//Added by qt3to4:
#include <QPaintEvent>
#include <kconfig.h>
@ -283,7 +285,7 @@ WebClient::paintEvent(QPaintEvent * pe)
p.setPen(options()->color(ColorFont, isActive()));
p.drawText(titleRect, AlignCenter, caption());
p.drawText(titleRect, Qt::AlignCenter, caption());
}
void WebClient::updateWindowShape()
@ -372,9 +374,9 @@ bool WebFactory::supports( Ability ability )
};
}
QValueList< WebFactory::BorderSize > WebFactory::borderSizes() const
QList< WebFactory::BorderSize > WebFactory::borderSizes() const
{ // the list must be sorted
return QValueList< BorderSize >() << BorderNormal << BorderLarge <<
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}

View file

@ -78,7 +78,7 @@ namespace Web
virtual KDecoration* createDecoration( KDecorationBridge* );
virtual bool reset( unsigned long changed );
virtual bool supports( Ability ability );
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
};
}

View file

@ -20,6 +20,8 @@
*/
#include <qpainter.h>
//Added by qt3to4:
#include <QEvent>
#include "WebButton.h"
#include "Web.h"
@ -75,7 +77,7 @@ WebButton::WebButton(ButtonType type, WebClient *parent, const char *name, bool
shape_ (shape),
deco_ (parent)
{
setBackgroundMode(NoBackground);
setBackgroundMode(Qt::NoBackground);
}
WebButton::~WebButton()
@ -128,7 +130,7 @@ WebButton::enterEvent(QEvent * e)
{
mouseOver_ = true;
repaint();
QButton::enterEvent(e);
Q3Button::enterEvent(e);
}
void
@ -136,7 +138,7 @@ WebButton::leaveEvent(QEvent * e)
{
mouseOver_ = false;
repaint();
QButton::leaveEvent(e);
Q3Button::leaveEvent(e);
}
void
@ -152,7 +154,7 @@ WebButton::drawButton(QPainter *p)
if (mouseOver_)
highlightPen = QPen(colorGroup().highlight());
else
highlightPen = QPen(NoPen);
highlightPen = QPen(Qt::NoPen);
}
p->fillRect(rect(), colorGroup().background());
@ -166,7 +168,7 @@ WebButton::drawButton(QPainter *p)
position_ = Mid;
switch ( position_ )
{
case Left:
case Qt::DockLeft:
{
// Draw edge.
@ -184,7 +186,7 @@ WebButton::drawButton(QPainter *p)
}
// Draw highlight.
p->setBrush(NoBrush);
p->setBrush(Qt::NoBrush);
p->setPen(highlightPen);
if (shape_)
@ -203,7 +205,7 @@ WebButton::drawButton(QPainter *p)
break;
case Right:
case Qt::DockRight:
{
// Draw edge.
@ -220,7 +222,7 @@ WebButton::drawButton(QPainter *p)
}
// Draw highlight.
p->setBrush(NoBrush);
p->setBrush(Qt::NoBrush);
p->setPen(highlightPen);
if (shape_)
@ -249,7 +251,7 @@ WebButton::drawButton(QPainter *p)
// Draw highlight.
p->setBrush(NoBrush);
p->setBrush(Qt::NoBrush);
p->setPen(highlightPen);
p->drawRect(2, 2, width() - 4, height() - 4);
@ -265,7 +267,7 @@ WebButton::drawButton(QPainter *p)
int bwby2(bitmap_.width() / 2); // Bitmap Width BY 2
int bhby2(bitmap_.height() / 2); // Bitmap Height BY 2
p->setBrush(NoBrush);
p->setBrush(Qt::NoBrush);
p->setPen(Qt::black);
p->drawPixmap(center.x() - bwby2 + 1, center.y() - bhby2 + 1, bitmap_);

View file

@ -14,15 +14,19 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kconfig.h>
#include <kinstance.h>
#include <dcopclient.h>
#include <qrect.h>
//Added by qt3to4:
#include <Q3CString>
#include <Q3PtrList>
struct SessionInfo
{
QCString sessionId;
QCString windowRole;
QCString wmCommand;
QCString wmClientMachine;
QCString resourceName;
QCString resourceClass;
Q3CString sessionId;
Q3CString windowRole;
Q3CString wmCommand;
Q3CString wmClientMachine;
Q3CString resourceName;
Q3CString resourceClass;
QRect geometry;
QRect restore;
@ -43,7 +47,7 @@ struct SessionInfo
bool fake; // fake session, i.e. 'save window settings', not SM restored
};
QPtrList<SessionInfo> fakeSession;
Q3PtrList<SessionInfo> fakeSession;
static const char* const window_type_names[] =
{
@ -164,5 +168,5 @@ int main()
dest_cfg.sync();
DCOPClient client;
client.attach();
client.send("kwin*", "", "reconfigure()", "");
client.send("kwin*", "", "reconfigure()", QByteArray());
}

View file

@ -28,9 +28,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <X11/extensions/shape.h>
#include <X11/Xatom.h>
extern Time qt_x_time;
extern Atom qt_window_role;
#include <QX11Info>
namespace KWinInternal
{
@ -197,7 +195,7 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( mouse_emulation && (e->type == ButtonPress || e->type == ButtonRelease ) )
{
mouse_emulation = FALSE;
XUngrabKeyboard( qt_xdisplay(), qt_x_time );
XUngrabKeyboard( QX11Info::display(), QX11Info::appTime() );
}
if ( e->type == PropertyNotify || e->type == ClientMessage )
@ -288,9 +286,10 @@ bool Workspace::workspaceEvent( XEvent * e )
!e->xcreatewindow.override_redirect )
{
// see comments for allowClientActivation()
XChangeProperty(qt_xdisplay(), e->xcreatewindow.window,
Time t = QX11Info::appTime();
XChangeProperty(QX11Info::display(), e->xcreatewindow.window,
atoms->kde_net_wm_user_creation_time, XA_CARDINAL,
32, PropModeReplace, (unsigned char *)&qt_x_time, 1);
32, PropModeReplace, (unsigned char *)&t, 1);
}
break;
@ -308,12 +307,12 @@ bool Workspace::workspaceEvent( XEvent * e )
// window.
XEvent ev;
WId w = e->xunmap.window;
if ( XCheckTypedWindowEvent (qt_xdisplay(), w,
if ( XCheckTypedWindowEvent (QX11Info::display(), w,
ReparentNotify, &ev) )
{
if ( ev.xreparent.parent != root )
{
XReparentWindow( qt_xdisplay(), w, root, 0, 0 );
XReparentWindow( QX11Info::display(), w, root, 0, 0 );
addSystemTrayWin( w );
}
}
@ -358,13 +357,13 @@ bool Workspace::workspaceEvent( XEvent * e )
if ( addSystemTrayWin( e->xmaprequest.window ) )
return TRUE;
c = createClient( e->xmaprequest.window, false );
if ( c != NULL && root != qt_xrootwin() )
if ( c != NULL && root != QX11Info::appRootWindow() )
{ // TODO what is this?
// TODO may use QWidget::create
XReparentWindow( qt_xdisplay(), c->frameId(), root, 0, 0 );
XReparentWindow( QX11Info::display(), c->frameId(), root, 0, 0 );
}
if( c == NULL ) // refused to manage, simply map it (most probably override redirect)
XMapRaised( qt_xdisplay(), e->xmaprequest.window );
XMapRaised( QX11Info::display(), e->xmaprequest.window );
return true;
}
if ( c )
@ -412,7 +411,7 @@ bool Workspace::workspaceEvent( XEvent * e )
wc.sibling = None;
wc.stack_mode = Above;
value_mask = e->xconfigurerequest.value_mask | CWBorderWidth;
XConfigureWindow( qt_xdisplay(), e->xconfigurerequest.window, value_mask, &wc );
XConfigureWindow( QX11Info::display(), e->xconfigurerequest.window, value_mask, &wc );
return true;
}
break;
@ -429,10 +428,10 @@ bool Workspace::workspaceEvent( XEvent * e )
if( e->xfocus.window == rootWin()
&& ( e->xfocus.detail == NotifyDetailNone || e->xfocus.detail == NotifyPointerRoot ))
{
updateXTime(); // focusToNull() uses qt_x_time, which is old now (FocusIn has no timestamp)
updateXTime(); // focusToNull() uses QX11Info::appTime(), which is old now (FocusIn has no timestamp)
Window focus;
int revert;
XGetInputFocus( qt_xdisplay(), &focus, &revert );
XGetInputFocus( QX11Info::display(), &focus, &revert );
if( focus == None || focus == PointerRoot )
{
//kdWarning( 1212 ) << "X focus set to None/PointerRoot, reseting focus" << endl;
@ -724,7 +723,7 @@ void Client::unmapNotifyEvent( XUnmapEvent* e )
case NormalState:
// maybe we will be destroyed soon. Check this first.
XEvent ev;
if( XCheckTypedWindowEvent (qt_xdisplay(), window(),
if( XCheckTypedWindowEvent (QX11Info::display(), window(),
DestroyNotify, &ev) ) // TODO I don't like this much
{
destroyClient(); // deletes this
@ -820,7 +819,7 @@ void Client::configureRequestEvent( XConfigureRequestEvent* e )
wc.border_width = 0;
value_mask = CWBorderWidth;
XConfigureWindow( qt_xdisplay(), window(), value_mask, & wc );
XConfigureWindow( QX11Info::display(), window(), value_mask, & wc );
}
if( e->value_mask & ( CWX | CWY | CWHeight | CWWidth ))
@ -871,7 +870,7 @@ void Client::propertyNotifyEvent( XPropertyEvent* e )
getWindowProtocols();
else if (e->atom == atoms->wm_client_leader )
getWmClientLeader();
else if( e->atom == qt_window_role )
else if( e->atom == atoms->wm_window_role )
window_role = staticWindowRole( window());
else if( e->atom == atoms->motif_wm_hints )
getMotifHints();
@ -930,7 +929,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e )
if ( !buttonDown )
{
mode = PositionCenter;
setCursor( arrowCursor );
setCursor( Qt::arrowCursor );
}
bool lostMouse = !rect().contains( QPoint( e->x, e->y ) );
// 'lostMouse' wouldn't work with e.g. B2 or Keramik, which have non-rectangular decorations
@ -945,7 +944,7 @@ void Client::leaveNotifyEvent( XCrossingEvent* e )
int d1, d2, d3, d4;
unsigned int d5;
Window w, child;
if( XQueryPointer( qt_xdisplay(), frameId(), &w, &child, &d1, &d2, &d3, &d4, &d5 ) == False
if( XQueryPointer( QX11Info::display(), frameId(), &w, &child, &d1, &d2, &d3, &d4, &d5 ) == False
|| child == None )
lostMouse = true; // really lost the mouse
}
@ -978,7 +977,7 @@ void Client::grabButton( int modifier )
for( int i = 0;
i < 8;
++i )
XGrabButton( qt_xdisplay(), AnyButton,
XGrabButton( QX11Info::display(), AnyButton,
modifier | mods[ i ],
wrapperId(), FALSE, ButtonPressMask,
GrabModeSync, GrabModeAsync, None, None );
@ -995,7 +994,7 @@ void Client::ungrabButton( int modifier )
for( int i = 0;
i < 8;
++i )
XUngrabButton( qt_xdisplay(), AnyButton,
XUngrabButton( QX11Info::display(), AnyButton,
modifier | mods[ i ], wrapperId());
}
#undef XCapL
@ -1024,9 +1023,9 @@ void Client::updateMouseGrab()
}
else
{
XUngrabButton( qt_xdisplay(), AnyButton, AnyModifier, wrapperId());
XUngrabButton( QX11Info::display(), AnyButton, AnyModifier, wrapperId());
// simply grab all modifier combinations
XGrabButton(qt_xdisplay(), AnyButton, AnyModifier, wrapperId(), FALSE,
XGrabButton(QX11Info::display(), AnyButton, AnyModifier, wrapperId(), FALSE,
ButtonPressMask,
GrabModeSync, GrabModeAsync,
None, None );
@ -1117,7 +1116,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
if (buttonDown)
{
if( w == wrapperId())
XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime ); //qt_x_time);
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
return true;
}
@ -1135,7 +1134,7 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
{ // hide splashwindow if the user clicks on it
hideClient( true );
if( w == wrapperId())
XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime ); //qt_x_time);
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
return true;
}
@ -1200,14 +1199,14 @@ bool Client::buttonPressEvent( Window w, int button, int state, int x, int y, in
replay = TRUE;
if( w == wrapperId()) // these can come only from a grab
XAllowEvents(qt_xdisplay(), replay? ReplayPointer : SyncPointer, CurrentTime ); //qt_x_time);
XAllowEvents(QX11Info::display(), replay? ReplayPointer : SyncPointer, CurrentTime ); //QX11Info::appTime());
return true;
}
}
if( w == wrapperId()) // these can come only from a grab
{
XAllowEvents(qt_xdisplay(), ReplayPointer, CurrentTime ); //qt_x_time);
XAllowEvents(QX11Info::display(), ReplayPointer, CurrentTime ); //QX11Info::appTime());
return true;
}
if( w == decorationId())
@ -1258,13 +1257,13 @@ void Client::processMousePressEvent( QMouseEvent* e )
int button;
switch( e->button())
{
case LeftButton:
case Qt::LeftButton:
button = Button1;
break;
case MidButton:
case Qt::MidButton:
button = Button2;
break;
case RightButton:
case Qt::RightButton:
button = Button3;
break;
default:
@ -1280,7 +1279,7 @@ bool Client::buttonReleaseEvent( Window w, int /*button*/, int state, int x, int
return false;
if( w == wrapperId())
{
XAllowEvents(qt_xdisplay(), SyncPointer, CurrentTime ); //qt_x_time);
XAllowEvents(QX11Info::display(), SyncPointer, CurrentTime ); //QX11Info::appTime());
return true;
}
if( w != frameId() && w != decorationId() && w != moveResizeGrabWindow())
@ -1327,12 +1326,12 @@ static bool waitingMotionEvent()
// of processes events reaches the timestamp of the last suitable
// MotionNotify event in the queue.
if( next_motion_time != CurrentTime
&& timestampCompare( qt_x_time, next_motion_time ) < 0 )
&& timestampCompare( QX11Info::appTime(), next_motion_time ) < 0 )
return true;
was_motion = false;
XSync( qt_xdisplay(), False ); // this helps to discard more MotionNotify events
XSync( QX11Info::display(), False ); // this helps to discard more MotionNotify events
XEvent dummy;
XCheckIfEvent( qt_xdisplay(), &dummy, motion_predicate, NULL );
XCheckIfEvent( QX11Info::display(), &dummy, motion_predicate, NULL );
return was_motion;
}
@ -1425,7 +1424,7 @@ static bool check_follows_focusin( Client* c )
// XCheckIfEvent() is used to make the search non-blocking, the predicate
// always returns False, so nothing is removed from the events queue.
// XPeekIfEvent() would block.
XCheckIfEvent( qt_xdisplay(), &dummy, predicate_follows_focusin, (XPointer)c );
XCheckIfEvent( QX11Info::display(), &dummy, predicate_follows_focusin, (XPointer)c );
return follows_focusin;
}
@ -1517,26 +1516,26 @@ void Client::keyPressEvent( uint key_code )
QPoint pos = QCursor::pos();
switch ( key_code )
{
case Key_Left:
case Qt::Key_Left:
pos.rx() -= delta;
break;
case Key_Right:
case Qt::Key_Right:
pos.rx() += delta;
break;
case Key_Up:
case Qt::Key_Up:
pos.ry() -= delta;
break;
case Key_Down:
case Qt::Key_Down:
pos.ry() += delta;
break;
case Key_Space:
case Key_Return:
case Key_Enter:
case Qt::Key_Space:
case Qt::Key_Return:
case Qt::Key_Enter:
finishMoveResize( false );
buttonDown = FALSE;
setCursor( mode );
break;
case Key_Escape:
case Qt::Key_Escape:
finishMoveResize( true );
buttonDown = FALSE;
setCursor( mode );

View file

@ -28,8 +28,8 @@ License. See the file "COPYING" for the exact licensing terms.
#include "notifications.h"
#include "geometrytip.h"
#include "rules.h"
extern Time qt_x_time;
#include <QX11Info>
#include <QDesktopWidget>
namespace KWinInternal
{
@ -326,7 +326,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos )
snap = options->windowSnapZone;
if (snap)
{
QValueList<Client *>::ConstIterator l;
QList<Client *>::ConstIterator l;
for (l = clients.begin();l != clients.end();++l )
{
if ((*l)->isOnDesktop(currentDesktop()) &&
@ -483,7 +483,7 @@ QRect Workspace::adjustClientSize( Client* c, QRect moveResizeGeom, int mode )
{
deltaX = int(snap);
deltaY = int(snap);
QValueList<Client *>::ConstIterator l;
QList<Client *>::ConstIterator l;
for (l = clients.begin();l != clients.end();++l )
{
if ((*l)->isOnDesktop(currentDesktop()) &&
@ -617,15 +617,14 @@ void Workspace::cascadeDesktop()
*/
void Workspace::unclutterDesktop()
{
ClientList::Iterator it(clients.fromLast());
for (; it != clients.end(); --it)
for ( int i = clients.size() - 1; i>=0; i-- )
{
if((!(*it)->isOnDesktop(currentDesktop())) ||
((*it)->isMinimized()) ||
((*it)->isOnAllDesktops()) ||
(!(*it)->isMovable()) )
if( ( !clients.at( i )->isOnDesktop( currentDesktop() ) ) ||
(clients.at( i )->isMinimized()) ||
(clients.at( i )->isOnAllDesktops()) ||
(!clients.at( i )->isMovable()) )
continue;
initPositioning->placeSmart(*it, QRect());
initPositioning->placeSmart(clients.at( i ), QRect());
}
}
@ -637,18 +636,18 @@ void Workspace::updateTopMenuGeometry( Client* c )
if( c != NULL )
{
XEvent ev;
ev.xclient.display = qt_xdisplay();
ev.xclient.display = QX11Info::display();
ev.xclient.type = ClientMessage;
ev.xclient.window = c->window();
static Atom msg_type_atom = XInternAtom( qt_xdisplay(), "_KDE_TOPMENU_MINSIZE", False );
static Atom msg_type_atom = XInternAtom( QX11Info::display(), "_KDE_TOPMENU_MINSIZE", False );
ev.xclient.message_type = msg_type_atom;
ev.xclient.format = 32;
ev.xclient.data.l[0] = qt_x_time;
ev.xclient.data.l[0] = QX11Info::appTime();
ev.xclient.data.l[1] = topmenu_space->width();
ev.xclient.data.l[2] = topmenu_space->height();
ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0;
XSendEvent( qt_xdisplay(), c->window(), False, NoEventMask, &ev );
XSendEvent( QX11Info::display(), c->window(), False, NoEventMask, &ev );
KWin::setStrut( c->window(), 0, 0, topmenu_height, 0 ); // so that kicker etc. know
c->checkWorkspacePosition();
return;
@ -792,25 +791,25 @@ NETExtendedStrut Client::strut() const
{
ext.left_width = str.left;
ext.left_start = 0;
ext.left_end = XDisplayHeight( qt_xdisplay(), DefaultScreen( qt_xdisplay()));
ext.left_end = XDisplayHeight( QX11Info::display(), DefaultScreen( QX11Info::display()));
}
if( str.right != 0 )
{
ext.right_width = str.right;
ext.right_start = 0;
ext.right_end = XDisplayHeight( qt_xdisplay(), DefaultScreen( qt_xdisplay()));
ext.right_end = XDisplayHeight( QX11Info::display(), DefaultScreen( QX11Info::display()));
}
if( str.top != 0 )
{
ext.top_width = str.top;
ext.top_start = 0;
ext.top_end = XDisplayWidth( qt_xdisplay(), DefaultScreen( qt_xdisplay()));
ext.top_end = XDisplayWidth( QX11Info::display(), DefaultScreen( QX11Info::display()));
}
if( str.bottom != 0 )
{
ext.bottom_width = str.bottom;
ext.bottom_start = 0;
ext.bottom_end = XDisplayWidth( qt_xdisplay(), DefaultScreen( qt_xdisplay()));
ext.bottom_end = XDisplayWidth( QX11Info::display(), DefaultScreen( QX11Info::display()));
}
}
return ext;
@ -1207,7 +1206,7 @@ QSize Client::sizeForClientSize( const QSize& wsize, Sizemode mode, bool noframe
void Client::getWmNormalHints()
{
long msize;
if (XGetWMNormalHints(qt_xdisplay(), window(), &xSizeHint, &msize) == 0 )
if (XGetWMNormalHints(QX11Info::display(), window(), &xSizeHint, &msize) == 0 )
xSizeHint.flags = 0;
// set defined values for the fields, even if they're not in flags
@ -1295,7 +1294,7 @@ void Client::sendSyntheticConfigureNotify()
c.border_width = 0;
c.above = None;
c.override_redirect = 0;
XSendEvent( qt_xdisplay(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c );
XSendEvent( QX11Info::display(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c );
}
const QPoint Client::calculateGravitation( bool invert, int gravity ) const
@ -1657,14 +1656,14 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
return;
}
resizeDecoration( QSize( w, h ));
XMoveResizeWindow( qt_xdisplay(), frameId(), x, y, w, h );
XMoveResizeWindow( QX11Info::display(), frameId(), x, y, w, h );
// resizeDecoration( QSize( w, h ));
if( !isShade())
{
QSize cs = clientSize();
XMoveResizeWindow( qt_xdisplay(), wrapperId(), clientPos().x(), clientPos().y(),
XMoveResizeWindow( QX11Info::display(), wrapperId(), clientPos().x(), clientPos().y(),
cs.width(), cs.height());
XMoveResizeWindow( qt_xdisplay(), window(), 0, 0, cs.width(), cs.height());
XMoveResizeWindow( QX11Info::display(), window(), 0, 0, cs.width(), cs.height());
}
if( shape())
updateShape();
@ -1712,14 +1711,14 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
return;
}
resizeDecoration( QSize( w, h ));
XResizeWindow( qt_xdisplay(), frameId(), w, h );
XResizeWindow( QX11Info::display(), frameId(), w, h );
// resizeDecoration( QSize( w, h ));
if( !isShade())
{
QSize cs = clientSize();
XMoveResizeWindow( qt_xdisplay(), wrapperId(), clientPos().x(), clientPos().y(),
XMoveResizeWindow( QX11Info::display(), wrapperId(), clientPos().x(), clientPos().y(),
cs.width(), cs.height());
XMoveResizeWindow( qt_xdisplay(), window(), 0, 0, cs.width(), cs.height());
XMoveResizeWindow( QX11Info::display(), window(), 0, 0, cs.width(), cs.height());
}
if( shape())
updateShape();
@ -1743,7 +1742,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
pending_geometry_update = true;
return;
}
XMoveWindow( qt_xdisplay(), frameId(), x, y );
XMoveWindow( QX11Info::display(), frameId(), x, y );
sendSyntheticConfigureNotify();
updateWindowRules();
checkMaximizeGeometry();
@ -2117,7 +2116,7 @@ void Client::doDrawbound( const QRect& geom, bool clear )
return; // done by decoration
QPainter p ( workspace()->desktopWidget() );
p.setPen( QPen( Qt::white, 5 ) );
p.setRasterOp( Qt::XorROP );
p.setCompositionMode( QPainter::CompositionMode_Xor );
// the line is 5 pixel thick, so compensate for the extra two pixels
// on outside (#88657)
QRect g = geom;
@ -2183,18 +2182,18 @@ bool Client::startMoveResize()
// (http://lists.kde.org/?t=107302193400001&r=1&w=2)
XSetWindowAttributes attrs;
QRect r = workspace()->clientArea( FullArea, this );
move_resize_grab_window = XCreateWindow( qt_xdisplay(), workspace()->rootWin(), r.x(), r.y(),
move_resize_grab_window = XCreateWindow( QX11Info::display(), workspace()->rootWin(), r.x(), r.y(),
r.width(), r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, 0, &attrs );
XMapRaised( qt_xdisplay(), move_resize_grab_window );
if( XGrabPointer( qt_xdisplay(), move_resize_grab_window, False,
XMapRaised( QX11Info::display(), move_resize_grab_window );
if( XGrabPointer( QX11Info::display(), move_resize_grab_window, False,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask,
GrabModeAsync, GrabModeAsync, None, cursor.handle(), qt_x_time ) == Success )
GrabModeAsync, GrabModeAsync, None, cursor.handle(), QX11Info::appTime() ) == Success )
has_grab = true;
if( XGrabKeyboard( qt_xdisplay(), frameId(), False, GrabModeAsync, GrabModeAsync, qt_x_time ) == Success )
if( XGrabKeyboard( QX11Info::display(), frameId(), False, GrabModeAsync, GrabModeAsync, QX11Info::appTime() ) == Success )
has_grab = true;
if( !has_grab ) // at least one grab is necessary in order to be able to finish move/resize
{
XDestroyWindow( qt_xdisplay(), move_resize_grab_window );
XDestroyWindow( QX11Info::display(), move_resize_grab_window );
move_resize_grab_window = None;
return false;
}
@ -2257,9 +2256,9 @@ void Client::leaveMoveResize()
if ( ( isMove() && rules()->checkMoveResizeMode( options->moveMode ) != Options::Opaque )
|| ( isResize() && rules()->checkMoveResizeMode( options->resizeMode ) != Options::Opaque ) )
ungrabXServer();
XUngrabKeyboard( qt_xdisplay(), qt_x_time );
XUngrabPointer( qt_xdisplay(), qt_x_time );
XDestroyWindow( qt_xdisplay(), move_resize_grab_window );
XUngrabKeyboard( QX11Info::display(), QX11Info::appTime() );
XUngrabPointer( QX11Info::display(), QX11Info::appTime() );
XDestroyWindow( QX11Info::display(), move_resize_grab_window );
move_resize_grab_window = None;
workspace()->setClientIsMoving(0);
if( move_faked_activity )
@ -2505,7 +2504,7 @@ void Client::handleMoveResize( int x, int y, int x_root, int y_root )
} // so the geometry tip will be painted above the outline
}
if ( isMove() )
workspace()->clientMoved(globalPos, qt_x_time);
workspace()->clientMoved(globalPos, QX11Info::appTime());
}

View file

@ -9,6 +9,7 @@ License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#include "geometrytip.h"
#include <QX11Info>
namespace KWinInternal
{
@ -20,13 +21,13 @@ GeometryTip::GeometryTip( const XSizeHints* xSizeHints, bool save_under ):
setIndent(0);
setLineWidth(1);
setFrameStyle( QFrame::Raised | QFrame::StyledPanel );
setAlignment( AlignCenter | AlignTop );
setAlignment( Qt::AlignCenter | Qt::AlignTop );
sizeHints = xSizeHints;
if( save_under )
{
XSetWindowAttributes attr;
attr.save_under = True; // use saveunder if possible to avoid weird effects in transparent mode
XChangeWindowAttributes( qt_xdisplay(), winId(), CWSaveUnder, &attr );
XChangeWindowAttributes( QX11Info::display(), winId(), CWSaveUnder, &attr );
}
}

View file

@ -24,6 +24,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <assert.h>
#include <kstartupinfo.h>
#include <QX11Info>
/*
@ -50,7 +51,7 @@ Group::Group( Window leader_P, Workspace* workspace_P )
{
leader_client = workspace_P->findClient( WindowMatchPredicate( leader_P ));
unsigned long properties[ 2 ] = { 0, NET::WM2StartupId };
leader_info = new NETWinInfo( qt_xdisplay(), leader_P, workspace()->rootWin(),
leader_info = new NETWinInfo( QX11Info::display(), leader_P, workspace()->rootWin(),
properties, 2 );
}
workspace()->addGroup( this, Allowed );
@ -392,7 +393,7 @@ bool Client::sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool ac
void Client::readTransient()
{
Window new_transient_for_id;
if( XGetTransientForHint( qt_xdisplay(), window(), &new_transient_for_id ))
if( XGetTransientForHint( QX11Info::display(), window(), &new_transient_for_id ))
{
original_transient_for_id = new_transient_for_id;
new_transient_for_id = verifyTransientFor( new_transient_for_id, true );
@ -595,7 +596,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
Window root_return, parent_return;
Window* wins = NULL;
unsigned int nwins;
int r = XQueryTree(qt_xdisplay(), new_transient_for, &root_return, &parent_return, &wins, &nwins);
int r = XQueryTree(QX11Info::display(), new_transient_for, &root_return, &parent_return, &wins, &nwins);
if ( wins )
XFree((void *) wins);
if ( r == 0)
@ -636,7 +637,7 @@ Window Client::verifyTransientFor( Window new_transient_for, bool defined )
new_transient_for = workspace()->rootWin();
}
if( new_property_value != original_transient_for_id )
XSetTransientForHint( qt_xdisplay(), window(), new_property_value );
XSetTransientForHint( QX11Info::display(), window(), new_property_value );
return new_transient_for;
}

View file

@ -28,11 +28,21 @@
*/
#include <qheader.h>
#include <q3header.h>
#include <qpainter.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qstyle.h>
//Added by qt3to4:
#include <QPixmap>
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <Q3Frame>
#include <QResizeEvent>
#include <QVBoxLayout>
#include <QDragEnterEvent>
#include <QMouseEvent>
#include <kdebug.h>
@ -48,10 +58,10 @@
#define BUTTONDRAGMIMETYPE "application/x-kde_kwindecoration_buttons"
ButtonDrag::ButtonDrag( Button btn, QWidget* parent, const char* name)
: QStoredDrag( BUTTONDRAGMIMETYPE, parent, name)
: Q3StoredDrag( BUTTONDRAGMIMETYPE, parent, name)
{
QByteArray data;
QDataStream stream(data, IO_WriteOnly);
QDataStream stream(&data, QIODevice::WriteOnly);
stream << btn.name;
stream << btn.icon;
stream << btn.type.unicode();
@ -72,7 +82,7 @@ bool ButtonDrag::decode( QDropEvent* e, Button& btn )
if ( data.size() )
{
e->accept();
QDataStream stream(data, IO_ReadOnly);
QDataStream stream(data);
stream >> btn.name;
stream >> btn.icon;
ushort type;
@ -125,7 +135,7 @@ ButtonSource::ButtonSource(QWidget *parent, const char* name)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setResizeMode(QListView::AllColumns);
setResizeMode(Q3ListView::AllColumns);
setDragEnabled(true);
setAcceptDrops(true);
setDropVisualizer(false);
@ -152,7 +162,7 @@ QSize ButtonSource::sizeHint() const
QSize s( header()->sizeHint() );
if ( verticalScrollBar()->isVisible() )
s.setWidth( s.width() + style().pixelMetric(QStyle::PM_ScrollBarExtent) );
s.setWidth( s.width() + style()->pixelMetric(QStyle::PM_ScrollBarExtent) );
s += QSize(frameWidth()*2,frameWidth()*2);
// size hint: 4 lines of text...
@ -165,7 +175,7 @@ QSize ButtonSource::sizeHint() const
void ButtonSource::hideAllButtons()
{
QListViewItemIterator it(this);
Q3ListViewItemIterator it(this);
while (it.current() ) {
it.current()->setVisible(false);
++it;
@ -174,7 +184,7 @@ void ButtonSource::hideAllButtons()
void ButtonSource::showAllButtons()
{
QListViewItemIterator it(this);
Q3ListViewItemIterator it(this);
while (it.current() ) {
it.current()->setVisible(true);
++it;
@ -183,7 +193,7 @@ void ButtonSource::showAllButtons()
void ButtonSource::showButton( QChar btn )
{
QListViewItemIterator it(this);
Q3ListViewItemIterator it(this);
while (it.current() ) {
ButtonSourceItem *item = dynamic_cast<ButtonSourceItem*>(it.current() );
if (item && item->button().type == btn) {
@ -196,7 +206,7 @@ void ButtonSource::showButton( QChar btn )
void ButtonSource::hideButton( QChar btn )
{
QListViewItemIterator it(this);
Q3ListViewItemIterator it(this);
while (it.current() ) {
ButtonSourceItem *item = dynamic_cast<ButtonSourceItem*>(it.current() );
if (item && item->button().type == btn && !item->button().duplicate) {
@ -212,7 +222,7 @@ bool ButtonSource::acceptDrag(QDropEvent* e) const
return acceptDrops() && ButtonDrag::canDecode(e);
}
QDragObject *ButtonSource::dragObject()
Q3DragObject *ButtonSource::dragObject()
{
ButtonSourceItem *i = dynamic_cast<ButtonSourceItem*>(selectedItem() );
@ -264,7 +274,7 @@ void ButtonDropSiteItem::draw(QPainter *p, const QColorGroup& cg, QRect r)
ButtonDropSite::ButtonDropSite( QWidget* parent, const char* name )
: QFrame( parent, name ),
: Q3Frame( parent, name ),
m_selected(0)
{
setAcceptDrops( TRUE );
@ -608,19 +618,19 @@ void ButtonDropSite::drawContents( QPainter* p )
p->fillRect( r, c1 );
p->setPen( Qt::white );
p->setFont( QFont( KGlobalSettings::generalFont().family(), 12, QFont::Bold) );
p->drawText( r, AlignLeft | AlignVCenter, i18n("KDE") );
p->drawText( r, Qt::AlignLeft | Qt::AlignVCenter, i18n("KDE") );
offset = geometry().width() - 3 - rightoffset;
drawButtonList( p, buttonsRight, offset );
if (m_oldDropVisualizer.isValid() )
{
p->fillRect(m_oldDropVisualizer, Dense4Pattern);
p->fillRect(m_oldDropVisualizer, Qt::Dense4Pattern);
}
}
ButtonSourceItem::ButtonSourceItem(QListView * parent, const Button& btn)
: QListViewItem(parent),
ButtonSourceItem::ButtonSourceItem(Q3ListView * parent, const Button& btn)
: Q3ListViewItem(parent),
m_button(btn),
m_dirty(true)
{
@ -644,12 +654,12 @@ void ButtonSourceItem::paintCell(QPainter *p, const QColorGroup &cg, int column,
}
if (m_button.supported) {
QListViewItem::paintCell(p,cg,column,width,align);
Q3ListViewItem::paintCell(p,cg,column,width,align);
} else {
// grey out unsupported buttons
QColorGroup cg2 = cg;
cg2.setColor(QColorGroup::Text, cg.mid() );
QListViewItem::paintCell(p,cg2,column,width,align);
Q3ListViewItem::paintCell(p,cg2,column,width,align);
}
}
@ -679,7 +689,7 @@ ButtonPositionWidget::ButtonPositionWidget(QWidget *parent, const char* name)
QLabel* label = new QLabel( this );
m_dropSite = new ButtonDropSite( this );
label->setAlignment( int( QLabel::WordBreak ) );
label->setWordWrap( true );
label->setText( i18n( "To add or remove titlebar buttons, simply <i>drag</i> items "
"between the available item list and the titlebar preview. Similarly, "
"drag items within the titlebar preview to re-position them.") );
@ -691,7 +701,7 @@ ButtonPositionWidget::ButtonPositionWidget(QWidget *parent, const char* name)
connect( m_dropSite, SIGNAL(buttonAdded(QChar)), m_buttonSource, SLOT(hideButton(QChar)) );
connect( m_dropSite, SIGNAL(buttonRemoved(QChar)), m_buttonSource, SLOT(showButton(QChar)) );
connect( m_buttonSource, SIGNAL(dropped(QDropEvent*, QListViewItem*)), m_dropSite, SLOT(removeSelectedButton()) );
connect( m_buttonSource, SIGNAL(dropped(QDropEvent*, Q3ListViewItem*)), m_dropSite, SLOT(removeSelectedButton()) );
connect( m_dropSite, SIGNAL(changed()), SIGNAL(changed()) );
@ -756,7 +766,7 @@ void ButtonPositionWidget::setDecorationFactory(KDecorationFactory *factory)
// update the button lists...
// 1. set status on the source items...
QListViewItemIterator it(m_buttonSource);
Q3ListViewItemIterator it(m_buttonSource);
while (it.current() ) {
ButtonSourceItem *i = dynamic_cast<ButtonSourceItem*>(it.current() );
if (i) {
@ -849,7 +859,7 @@ void ButtonPositionWidget::setButtonsLeft(const QString &buttons)
// to keep the button lists consistent, first remove all left buttons, then add buttons again...
m_dropSite->clearLeft();
for (uint i = 0; i < buttons.length(); ++i) {
for (int i = 0; i < buttons.length(); ++i) {
bool succ = false;
Button btn = getButton(buttons[i], succ);
if (succ) {
@ -866,7 +876,7 @@ void ButtonPositionWidget::setButtonsRight(const QString &buttons)
// to keep the button lists consistent, first remove all left buttons, then add buttons again...
m_dropSite->clearRight();
for (uint i = 0; i < buttons.length(); ++i) {
for (int i = 0; i < buttons.length(); ++i) {
bool succ = false;
Button btn = getButton(buttons[i], succ);
if (succ) {

View file

@ -33,8 +33,17 @@
#include <qbitmap.h>
#include <qevent.h>
#include <qdragobject.h>
#include <qlistbox.h>
#include <q3dragobject.h>
#include <q3listbox.h>
//Added by qt3to4:
#include <QDragLeaveEvent>
#include <QDragMoveEvent>
#include <Q3Frame>
#include <QDropEvent>
#include <Q3ValueList>
#include <QResizeEvent>
#include <QDragEnterEvent>
#include <QMouseEvent>
#include <klistview.h>
@ -57,7 +66,7 @@ class Button
bool supported;
};
class ButtonDrag : public QStoredDrag
class ButtonDrag : public Q3StoredDrag
{
public:
ButtonDrag( Button btn, QWidget* parent, const char* name=0 );
@ -91,10 +100,10 @@ class ButtonDropSiteItem
/**
* This is plugged into ButtonSource
*/
class ButtonSourceItem : public QListViewItem
class ButtonSourceItem : public Q3ListViewItem
{
public:
ButtonSourceItem(QListView * parent, const Button& btn);
ButtonSourceItem(Q3ListView * parent, const Button& btn);
virtual ~ButtonSourceItem();
void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
@ -128,15 +137,15 @@ class ButtonSource : public KListView
protected:
bool acceptDrag(QDropEvent* e) const;
virtual QDragObject *dragObject();
virtual Q3DragObject *dragObject();
};
typedef QValueList<ButtonDropSiteItem*> ButtonList;
typedef Q3ValueList<ButtonDropSiteItem*> ButtonList;
/**
* This class renders and handles the demo titlebar dropsite
*/
class ButtonDropSite: public QFrame
class ButtonDropSite: public Q3Frame
{
Q_OBJECT

View file

@ -31,14 +31,19 @@
#include <qdir.h>
#include <qfileinfo.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qgroupbox.h>
#include <q3groupbox.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qvbox.h>
#include <q3vbox.h>
#include <qlabel.h>
#include <qfile.h>
#include <qslider.h>
//Added by qt3to4:
#include <QPixmap>
#include <QHBoxLayout>
#include <Q3ValueList>
#include <QVBoxLayout>
#include <kapplication.h>
#include <kcombobox.h>
@ -64,7 +69,7 @@ K_EXPORT_COMPONENT_FACTORY( kcm_kwindecoration, KWinDecoFactory("kcmkwindecorati
KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, const QStringList &)
: DCOPObject("KWinClientDecoration"),
KCModule(KWinDecoFactory::instance(), parent, name),
KCModule(KWinDecoFactory::instance(), parent),
kwinConfig("kwinrc"),
pluginObject(0)
{
@ -89,11 +94,11 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
decorationList = new KComboBox( pluginPage );
QString whatsThis = i18n("Select the window decoration. This is the look and feel of both "
"the window borders and the window handle.");
QWhatsThis::add(decorationList, whatsThis);
decorationList->setWhatsThis( whatsThis);
pluginLayout->addWidget(decorationList);
QGroupBox *pluginSettingsGrp = new QGroupBox( i18n("Decoration Options"), pluginPage );
pluginSettingsGrp->setColumnLayout( 0, Vertical );
Q3GroupBox *pluginSettingsGrp = new Q3GroupBox( i18n("Decoration Options"), pluginPage );
pluginSettingsGrp->setColumnLayout( 0, Qt::Vertical );
pluginSettingsGrp->setFlat( true );
pluginSettingsGrp->layout()->setMargin( 0 );
pluginSettingsGrp->layout()->setSpacing( KDialog::spacingHint() );
@ -105,7 +110,7 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
lBorder = new QLabel (i18n("B&order size:"), pluginSettingsGrp);
cBorder = new QComboBox(pluginSettingsGrp);
lBorder->setBuddy(cBorder);
QWhatsThis::add( cBorder, i18n( "Use this combobox to change the border size of the decoration." ));
cBorder->setWhatsThis( i18n( "Use this combobox to change the border size of the decoration." ));
lBorder->hide();
cBorder->hide();
QHBoxLayout *borderSizeLayout = new QHBoxLayout(pluginSettingsGrp->layout() );
@ -113,7 +118,7 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
borderSizeLayout->addWidget(cBorder);
borderSizeLayout->addStretch();
pluginConfigWidget = new QVBox(pluginSettingsGrp);
pluginConfigWidget = new Q3VBox(pluginSettingsGrp);
pluginSettingsGrp->layout()->add( pluginConfigWidget );
// Page 2 (Button Selector)
@ -122,13 +127,13 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
cbShowToolTips = new QCheckBox(
i18n("&Show window button tooltips"), buttonPage );
QWhatsThis::add( cbShowToolTips,
cbShowToolTips->setWhatsThis(
i18n( "Enabling this checkbox will show window button tooltips. "
"If this checkbox is off, no window button tooltips will be shown."));
cbUseCustomButtonPositions = new QCheckBox(
i18n("Use custom titlebar button &positions"), buttonPage );
QWhatsThis::add( cbUseCustomButtonPositions,
cbUseCustomButtonPositions->setWhatsThis(
i18n( "The appropriate settings can be found in the \"Buttons\" Tab; "
"please note that this option is not available on all styles yet." ) );
@ -206,9 +211,9 @@ void KWinDecorationModule::findDecorations()
{
QDir d(*it);
if (d.exists())
for (QFileInfoListIterator it(*d.entryInfoList()); it.current(); ++it)
foreach (const QFileInfo& fi, d.entryInfoList())
{
QString filename(it.current()->absFilePath());
QString filename(fi.absFilePath());
if (KDesktopFile::isDesktopFile(filename))
{
KDesktopFile desktopFile(filename);
@ -230,7 +235,7 @@ void KWinDecorationModule::findDecorations()
// Fills the decorationList with a list of available kwin decorations
void KWinDecorationModule::createDecorationList()
{
QValueList<DecorationInfo>::ConstIterator it;
Q3ValueList<DecorationInfo>::ConstIterator it;
// Sync with kwin hardcoded KDE2 style which has no desktop item
QStringList decorationNames;
@ -272,10 +277,10 @@ static const char* const border_names[ KDecorationDefines::BordersCount ] =
I18N_NOOP( "Oversized" )
};
int KWinDecorationModule::borderSizeToIndex( BorderSize size, QValueList< BorderSize > sizes )
int KWinDecorationModule::borderSizeToIndex( BorderSize size, Q3ValueList< BorderSize > sizes )
{
int pos = 0;
for( QValueList< BorderSize >::ConstIterator it = sizes.begin();
for( Q3ValueList< BorderSize >::ConstIterator it = sizes.begin();
it != sizes.end();
++it, ++pos )
if( size <= *it )
@ -284,9 +289,9 @@ int KWinDecorationModule::borderSizeToIndex( BorderSize size, QValueList< Border
}
KDecorationDefines::BorderSize KWinDecorationModule::indexToBorderSize( int index,
QValueList< BorderSize > sizes )
Q3ValueList< BorderSize > sizes )
{
QValueList< BorderSize >::ConstIterator it = sizes.begin();
Q3ValueList< BorderSize >::ConstIterator it = sizes.begin();
for(;
it != sizes.end();
++it, --index )
@ -300,7 +305,7 @@ void KWinDecorationModule::slotBorderChanged( int size )
if( lBorder->isHidden())
return;
emit KCModule::changed( true );
QValueList< BorderSize > sizes;
Q3ValueList< BorderSize > sizes;
if( plugins->factory() != NULL )
sizes = plugins->factory()->borderSizes();
assert( sizes.count() >= 2 );
@ -320,7 +325,7 @@ QString KWinDecorationModule::decorationName( QString& libName )
{
QString decoName;
QValueList<DecorationInfo>::Iterator it;
Q3ValueList<DecorationInfo>::Iterator it;
for( it = decorations.begin(); it != decorations.end(); ++it )
if ( (*it).libraryName == libName )
{
@ -338,7 +343,7 @@ QString KWinDecorationModule::decorationLibName( const QString& name )
// Find the corresponding library name to that of
// the current plugin name
QValueList<DecorationInfo>::Iterator it;
Q3ValueList<DecorationInfo>::Iterator it;
for( it = decorations.begin(); it != decorations.end(); ++it )
if ( (*it).name == name )
{
@ -558,7 +563,7 @@ void KWinDecorationModule::defaults()
void KWinDecorationModule::checkSupportedBorderSizes()
{
QValueList< BorderSize > sizes;
Q3ValueList< BorderSize > sizes;
if( plugins->factory() != NULL )
sizes = plugins->factory()->borderSizes();
if( sizes.count() < 2 ) {
@ -566,7 +571,7 @@ void KWinDecorationModule::checkSupportedBorderSizes()
cBorder->hide();
} else {
cBorder->clear();
for (QValueList<BorderSize>::const_iterator it = sizes.begin(); it != sizes.end(); ++it) {
for (Q3ValueList<BorderSize>::const_iterator it = sizes.begin(); it != sizes.end(); ++it) {
BorderSize size = *it;
cBorder->insertItem(i18n(border_names[size]), borderSizeToIndex(size,sizes) );
}

View file

@ -39,12 +39,15 @@
#include <kdecoration.h>
#include "kwindecorationIface.h"
//Added by qt3to4:
#include <QLabel>
#include <Q3ValueList>
class KComboBox;
class QCheckBox;
class QLabel;
class QTabWidget;
class QVBox;
class Q3VBox;
class QSlider;
class KDecorationPlugins;
@ -98,14 +101,14 @@ class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface
void resetPlugin( KConfig* conf, const QString& currentDecoName = QString::null );
void resetKWin();
void checkSupportedBorderSizes();
static int borderSizeToIndex( BorderSize size, QValueList< BorderSize > sizes );
static BorderSize indexToBorderSize( int index, QValueList< BorderSize > sizes );
static int borderSizeToIndex( BorderSize size, Q3ValueList< BorderSize > sizes );
static BorderSize indexToBorderSize( int index, Q3ValueList< BorderSize > sizes );
QTabWidget* tabWidget;
// Page 1
KComboBox* decorationList;
QValueList<DecorationInfo> decorations;
Q3ValueList<DecorationInfo> decorations;
KDecorationPreview* preview;
KDecorationPlugins* plugins;
@ -126,7 +129,7 @@ class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface
// Page 2
ButtonPositionWidget *buttonPositionWidget;
QVBox* buttonPage;
Q3VBox* buttonPage;
};

View file

@ -25,6 +25,10 @@
#include <kglobal.h>
#include <qlabel.h>
#include <qstyle.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <QResizeEvent>
#include <QVector>
#include <kiconloader.h>
#include <X11/Xlib.h>
@ -32,6 +36,7 @@
#include <kdecorationfactory.h>
#include <kdecoration_plugins_p.h>
#include <QX11Info>
// FRAME the preview doesn't update to reflect the changes done in the kcm
@ -49,7 +54,7 @@ KDecorationPreview::KDecorationPreview( QWidget* parent, const char* name )
"Most probably there\n"
"was a problem loading the plugin." ), this );
no_preview->setAlignment( AlignCenter );
no_preview->setAlignment( Qt::AlignCenter );
setMinimumSize( 100, 100 );
no_preview->resize( size());
@ -129,13 +134,13 @@ void KDecorationPreview::positionPreviews()
size = QSize( width() - xoffset, height() - titleBarHeight )
.expandedTo( deco[Active]->minimumSize() );
geometry = QRect( QPoint( 0, titleBarHeight ), size );
deco[Active]->widget()->setGeometry( QStyle::visualRect( geometry, this ) );
deco[Active]->widget()->setGeometry( QStyle::visualRect( this->layoutDirection(), this->rect(), geometry ) );
// Resize the inactive window
size = QSize( width() - xoffset, height() - titleBarHeight )
.expandedTo( deco[Inactive]->minimumSize() );
geometry = QRect( QPoint( xoffset, 0 ), size );
deco[Inactive]->widget()->setGeometry( QStyle::visualRect( geometry, this ) );
deco[Inactive]->widget()->setGeometry( QStyle::visualRect( this->layoutDirection(), this->rect(), geometry ) );
}
void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode, bool active )
@ -145,14 +150,14 @@ void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode, bool acti
// FRAME duped from client.cpp
if( mode == Unsorted )
{
XShapeCombineRegion( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
XShapeCombineRegion( QX11Info::display(), widget->winId(), ShapeBounding, 0, 0,
reg.handle(), ShapeSet );
}
else
{
QMemArray< QRect > rects = reg.rects();
QVector< QRect > rects = reg.rects();
XRectangle* xrects = new XRectangle[ rects.count() ];
for( unsigned int i = 0;
for( int i = 0;
i < rects.count();
++i )
{
@ -161,7 +166,7 @@ void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode, bool acti
xrects[ i ].width = rects[ i ].width();
xrects[ i ].height = rects[ i ].height();
}
XShapeCombineRectangles( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
XShapeCombineRectangles( QX11Info::display(), widget->winId(), ShapeBounding, 0, 0,
xrects, rects.count(), ShapeSet, mode );
delete[] xrects;
}
@ -319,7 +324,7 @@ NET::WindowType KDecorationPreviewBridge::windowType( unsigned long ) const
return NET::Normal;
}
QIconSet KDecorationPreviewBridge::icon() const
QIcon KDecorationPreviewBridge::icon() const
{
return SmallIconSet( "xapp" );
}

View file

@ -21,6 +21,10 @@
#define KWINDECORATION_PREVIEW_H
#include <qwidget.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <QLabel>
#include <QResizeEvent>
#include <kdecoration_p.h>
#include <kdecoration_plugins_p.h>
@ -81,7 +85,7 @@ class KDecorationPreviewBridge
virtual bool isMovable() const;
virtual bool isResizable() const;
virtual NET::WindowType windowType( unsigned long supported_types ) const;
virtual QIconSet icon() const;
virtual QIcon icon() const;
virtual QString caption() const;
virtual void processMousePressEvent( QMouseEvent* );
virtual void showWindowMenu( const QRect &);

View file

@ -18,6 +18,8 @@
*/
#include <qlayout.h>
//Added by qt3to4:
#include <QVBoxLayout>
#include <dcopclient.h>
@ -171,7 +173,7 @@ void KWinOptions::save()
mConfig->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
@ -244,7 +246,7 @@ void KActionsOptions::save()
mConfig->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}

View file

@ -19,14 +19,17 @@
#include <qlabel.h>
#include <qcombobox.h>
#include <qwhatsthis.h>
#include <qlayout.h>
#include <qvgroupbox.h>
#include <qgrid.h>
#include <q3grid.h>
#include <qsizepolicy.h>
#include <qbitmap.h>
#include <qhgroupbox.h>
#include <qtooltip.h>
#include <Q3GroupBox>
//Added by qt3to4:
#include <QPixmap>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <dcopclient.h>
#include <klocale.h>
@ -137,8 +140,8 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
{
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3;
QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
QGrid *grid;
QGroupBox *box;
Q3Grid *grid;
Q3GroupBox *box;
QLabel *label;
QString strMouseButton1, strMouseButton3, strMouseWheel;
QString txtButton1, txtButton3, txtButton4;
@ -151,7 +154,7 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
label = new QLabel(i18n("&Titlebar double-click:"), this);
hlayout->addWidget(label);
QWhatsThis::add( label, i18n("Here you can customize mouse click behavior when double clicking on the"
label->setWhatsThis( i18n("Here you can customize mouse click behavior when double clicking on the"
" titlebar of a window.") );
QComboBox* combo = new QComboBox(this);
@ -167,7 +170,7 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
hlayout->addWidget(combo);
coTiDbl = combo;
QWhatsThis::add(combo, i18n("Behavior on <em>double</em> click into the titlebar."));
combo->setWhatsThis( i18n("Behavior on <em>double</em> click into the titlebar."));
label->setBuddy(combo);
@ -177,7 +180,7 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
label = new QLabel(strMouseWheel, this);
hlayoutW->addWidget(label);
txtButton4 = i18n("Handle mouse wheel events");
QWhatsThis::add( label, txtButton4);
label->setWhatsThis( txtButton4);
// Titlebar and frame mouse Wheel
QComboBox* comboW = new QComboBox(this);
@ -192,19 +195,19 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
connect(comboW, SIGNAL(activated(int)), SLOT(changed()));
hlayoutW->addWidget(comboW);
coTiAct4 = comboW;
QWhatsThis::add(comboW, txtButton4);
comboW->setWhatsThis( txtButton4);
label->setBuddy(comboW);
/** Titlebar and frame **************/
box = new QVGroupBox( i18n("Titlebar && Frame"), this, "Titlebar and Frame");
box = new Q3GroupBox( 1, Qt::Horizontal, i18n("Titlebar && Frame"), this, "Titlebar and Frame");
box->layout()->setMargin(KDialog::marginHint());
box->layout()->setSpacing(KDialog::spacingHint());
layout->addWidget(box);
QWhatsThis::add( box, i18n("Here you can customize mouse click behavior when clicking on the"
box->setWhatsThis( i18n("Here you can customize mouse click behavior when clicking on the"
" titlebar or the frame of a window.") );
grid = new QGrid(4, Qt::Vertical, box);
grid = new Q3Grid(4, Qt::Vertical, box);
new QLabel(grid); // dummy
@ -224,19 +227,19 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
}
label = new QLabel(strMouseButton1, grid);
QWhatsThis::add( label, txtButton1);
label->setWhatsThis( txtButton1);
label = new QLabel(i18n("Middle button:"), grid);
QWhatsThis::add( label, i18n("In this row you can customize middle click behavior when clicking into"
label->setWhatsThis( i18n("In this row you can customize middle click behavior when clicking into"
" the titlebar or the frame.") );
label = new QLabel(strMouseButton3, grid);
QWhatsThis::add( label, txtButton3);
label->setWhatsThis( txtButton3);
label = new QLabel(i18n("Active"), grid);
label->setAlignment(AlignCenter);
QWhatsThis::add( label, i18n("In this column you can customize mouse clicks into the titlebar"
label->setAlignment(Qt::AlignCenter);
label->setWhatsThis( i18n("In this column you can customize mouse clicks into the titlebar"
" or the frame of an active window.") );
// Titlebar and frame, active, mouse button 1
@ -258,7 +261,7 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
// Be nice to left handed users
if ( leftHandedMouse ) qSwap(txtButton1, txtButton3);
QWhatsThis::add(combo, txtButton1);
combo->setWhatsThis( txtButton1);
// Titlebar and frame, active, mouse button 2
@ -273,14 +276,14 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coTiAct2 = combo;
QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window."));
combo->setWhatsThis( i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>active</em> window."));
// Titlebar and frame, active, mouse button 3
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coTiAct3 = combo;
QWhatsThis::add(combo, txtButton3 );
combo->setWhatsThis( txtButton3 );
txtButton1 = i18n("Behavior on <em>left</em> click into the titlebar or frame of an "
"<em>inactive</em> window.");
@ -292,8 +295,8 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
if ( leftHandedMouse ) qSwap(txtButton1, txtButton3);
label = new QLabel(i18n("Inactive"), grid);
label->setAlignment(AlignCenter);
QWhatsThis::add( label, i18n("In this column you can customize mouse clicks into the titlebar"
label->setAlignment(Qt::AlignCenter);
label->setWhatsThis( i18n("In this column you can customize mouse clicks into the titlebar"
" or the frame of an inactive window.") );
items.clear();
@ -310,27 +313,27 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coTiInAct1 = combo;
QWhatsThis::add(combo, txtButton1);
combo->setWhatsThis( txtButton1);
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coTiInAct2 = combo;
QWhatsThis::add(combo, i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window."));
combo->setWhatsThis( i18n("Behavior on <em>middle</em> click into the titlebar or frame of an <em>inactive</em> window."));
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coTiInAct3 = combo;
QWhatsThis::add(combo, txtButton3);
combo->setWhatsThis( txtButton3);
/** Maximize Button ******************/
box = new QHGroupBox(i18n("Maximize Button"), this, "Maximize Button");
box = new Q3GroupBox(1, Qt::Vertical, i18n("Maximize Button"), this, "Maximize Button");
box->layout()->setMargin(KDialog::marginHint());
box->layout()->setSpacing(KDialog::spacingHint());
layout->addWidget(box);
QWhatsThis::add( box,
box->setWhatsThis(
i18n("Here you can customize behavior when clicking on the maximize button.") );
QString strMouseButton[] = {
@ -355,14 +358,14 @@ KTitleBarActionsConfig::KTitleBarActionsConfig (bool _standAlone, KConfig *_conf
if (b != 0) new QWidget(box); // Spacer
QLabel * label = new QLabel(strMouseButton[b], box);
QWhatsThis::add( label, txtButton[b] );
label->setWhatsThis( txtButton[b] );
label ->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ));
coMax[b] = new ToolTipComboBox(box, tbl_Max);
for (int t = 0; t < 3; ++t) coMax[b]->insertItem(maxButtonPixmaps[t]);
connect(coMax[b], SIGNAL(activated(int)), SLOT(changed()));
connect(coMax[b], SIGNAL(activated(int)), coMax[b], SLOT(changed()));
QWhatsThis::add( coMax[b], txtButton[b] );
coMax[b]->setWhatsThis( txtButton[b] );
coMax[b]->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ));
}
@ -565,7 +568,7 @@ void KTitleBarActionsConfig::save()
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
}
@ -589,8 +592,8 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
{
QString strWin1, strWin2, strWin3, strAllKey, strAll1, strAll2, strAll3, strAllW;
QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
QGrid *grid;
QGroupBox *box;
Q3Grid *grid;
Q3GroupBox *box;
QLabel *label;
QString strMouseButton1, strMouseButton3;
QString txtButton1, txtButton3;
@ -599,14 +602,14 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
/** Inactive inner window ******************/
box = new QVGroupBox(i18n("Inactive Inner Window"), this, "Inactive Inner Window");
box = new Q3GroupBox(1, Qt::Horizontal, i18n("Inactive Inner Window"), this, "Inactive Inner Window");
box->layout()->setMargin(KDialog::marginHint());
box->layout()->setSpacing(KDialog::spacingHint());
layout->addWidget(box);
QWhatsThis::add( box, i18n("Here you can customize mouse click behavior when clicking on an inactive"
box->setWhatsThis( i18n("Here you can customize mouse click behavior when clicking on an inactive"
" inner window ('inner' means: not titlebar, not frame).") );
grid = new QGrid(3, Qt::Vertical, box);
grid = new Q3Grid(3, Qt::Vertical, box);
strMouseButton1 = i18n("Left button:");
txtButton1 = i18n("In this row you can customize left click behavior when clicking into"
@ -632,15 +635,15 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
if ( leftHandedMouse ) qSwap(strWin1, strWin3);
label = new QLabel(strMouseButton1, grid);
QWhatsThis::add( label, strWin1 );
label->setWhatsThis( strWin1 );
label = new QLabel(i18n("Middle button:"), grid);
strWin2 = i18n("In this row you can customize middle click behavior when clicking into"
" an inactive inner window ('inner' means: not titlebar, not frame).");
QWhatsThis::add( label, strWin2 );
label->setWhatsThis( strWin2 );
label = new QLabel(strMouseButton3, grid);
QWhatsThis::add( label, strWin3 );
label->setWhatsThis( strWin3 );
items.clear();
items << i18n("Activate, Raise & Pass Click")
@ -652,38 +655,38 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coWin1 = combo;
QWhatsThis::add( combo, strWin1 );
combo->setWhatsThis( strWin1 );
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coWin2 = combo;
QWhatsThis::add( combo, strWin2 );
combo->setWhatsThis( strWin2 );
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coWin3 = combo;
QWhatsThis::add( combo, strWin3 );
combo->setWhatsThis( strWin3 );
/** Inner window, titlebar and frame **************/
box = new QVGroupBox(i18n("Inner Window, Titlebar && Frame"), this, "Inner Window, Titlebar and Frame");
box = new Q3GroupBox(1, Qt::Horizontal, i18n("Inner Window, Titlebar && Frame"), this, "Inner Window, Titlebar and Frame");
box->layout()->setMargin(KDialog::marginHint());
box->layout()->setSpacing(KDialog::spacingHint());
layout->addWidget(box);
QWhatsThis::add( box, i18n("Here you can customize KDE's behavior when clicking somewhere into"
box->setWhatsThis( i18n("Here you can customize KDE's behavior when clicking somewhere into"
" a window while pressing a modifier key."));
grid = new QGrid(5, Qt::Vertical, box);
grid = new Q3Grid(5, Qt::Vertical, box);
// Labels
label = new QLabel(i18n("Modifier key:"), grid);
strAllKey = i18n("Here you select whether holding the Meta key or Alt key "
"will allow you to perform the following actions.");
QWhatsThis::add( label, strAllKey );
label->setWhatsThis( strAllKey );
strMouseButton1 = i18n("Modifier key + left button:");
@ -701,20 +704,20 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
}
label = new QLabel(strMouseButton1, grid);
QWhatsThis::add( label, strAll1);
label->setWhatsThis( strAll1);
label = new QLabel(i18n("Modifier key + middle button:"), grid);
strAll2 = i18n("Here you can customize KDE's behavior when middle clicking into a window"
" while pressing the modifier key.");
QWhatsThis::add( label, strAll2 );
label->setWhatsThis( strAll2 );
label = new QLabel(strMouseButton3, grid);
QWhatsThis::add( label, strAll3);
label->setWhatsThis( strAll3);
label = new QLabel(i18n("Modifier key + mouse wheel:"), grid);
strAllW = i18n("Here you can customize KDE's behavior when scrolling with the mouse wheel"
" in a window while pressing the modifier key.");
QWhatsThis::add( label, strAllW);
label->setWhatsThis( strAllW);
// Combo's
combo = new QComboBox(grid);
@ -722,7 +725,7 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
combo->insertItem(i18n("Alt"));
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coAllKey = combo;
QWhatsThis::add( combo, strAllKey );
combo->setWhatsThis( strAllKey );
items.clear();
items << i18n("Move")
@ -738,19 +741,19 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coAll1 = combo;
QWhatsThis::add( combo, strAll1 );
combo->setWhatsThis( strAll1 );
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coAll2 = combo;
QWhatsThis::add( combo, strAll2 );
combo->setWhatsThis( strAll2 );
combo = new QComboBox(grid);
combo->insertStringList(items);
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coAll3 = combo;
QWhatsThis::add( combo, strAll3 );
combo->setWhatsThis( strAll3 );
combo = new QComboBox(grid);
combo->insertItem(i18n("Raise/Lower"));
@ -762,7 +765,7 @@ KWindowActionsConfig::KWindowActionsConfig (bool _standAlone, KConfig *_config,
combo->insertItem(i18n("Nothing"));
connect(combo, SIGNAL(activated(int)), SLOT(changed()));
coAllW = combo;
QWhatsThis::add( combo, strAllW );
combo->setWhatsThis( strAllW );
layout->addStretch();
@ -839,7 +842,7 @@ void KWindowActionsConfig::save()
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
}

View file

@ -26,12 +26,17 @@
#include <qdir.h>
#include <qlayout.h>
#include <qslider.h>
#include <qwhatsthis.h>
#include <qvbuttongroup.h>
#include <Q3ButtonGroup>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qlabel.h>
#include <qcombobox.h>
//Added by qt3to4:
#include <QGridLayout>
#include <QHBoxLayout>
#include <QBoxLayout>
#include <QVBoxLayout>
#include <kmessagebox.h>
#include <kactivelabel.h>
@ -119,7 +124,7 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
//lay->addWidget(plcBox);
// focus policy
fcsBox = new QButtonGroup(i18n("Focus"),this);
fcsBox = new Q3ButtonGroup(i18n("Focus"),this);
fcsBox->setColumnLayout( 0, Qt::Horizontal );
QBoxLayout *fLay = new QVBoxLayout(fcsBox->layout(),
@ -156,8 +161,8 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
" features such as the Alt+Tab walk through windows dialog in the KDE mode"
" from working properly."
);
QWhatsThis::add( focusCombo, wtstr);
QWhatsThis::add(fLabel, wtstr);
focusCombo->setWhatsThis( wtstr);
fLabel->setWhatsThis( wtstr);
connect(focusCombo, SIGNAL(activated(int)), this, SLOT(setAutoRaiseEnabled()) );
@ -193,25 +198,25 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
// fLay->addColSpacing(0,QMAX(autoRaiseOn->sizeHint().width(),
// clickRaiseOn->sizeHint().width()) + 15);
QWhatsThis::add( autoRaiseOn, i18n("When this option is enabled, a window in the background will automatically"
autoRaiseOn->setWhatsThis( i18n("When this option is enabled, a window in the background will automatically"
" come to the front when the mouse pointer has been over it for some time.") );
wtstr = i18n("This is the delay after which the window that the mouse pointer is over will automatically"
" come to the front.");
QWhatsThis::add( autoRaise, wtstr );
autoRaise->setWhatsThis( wtstr );
QWhatsThis::add( clickRaiseOn, i18n("When this option is enabled, the active window will be brought to the"
clickRaiseOn->setWhatsThis( i18n("When this option is enabled, the active window will be brought to the"
" front when you click somewhere into the window contents. To change"
" it for inactive windows, you need to change the settings"
" in the Actions tab.") );
QWhatsThis::add( delayFocusOn, i18n("When this option is enabled, there will be a delay after which the"
delayFocusOn->setWhatsThis( i18n("When this option is enabled, there will be a delay after which the"
" window the mouse pointer is over will become active (receive focus).") );
QWhatsThis::add( delayFocus, i18n("This is the delay after which the window the mouse pointer is over"
delayFocus->setWhatsThis( i18n("This is the delay after which the window the mouse pointer is over"
" will automatically receive focus.") );
lay->addWidget(fcsBox);
kbdBox = new QButtonGroup(i18n("Navigation"), this);
kbdBox = new Q3ButtonGroup(i18n("Navigation"), this);
kbdBox->setColumnLayout( 0, Qt::Horizontal );
QVBoxLayout *kLay = new QVBoxLayout(kbdBox->layout(), KDialog::spacingHint());
@ -227,28 +232,28 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
"Otherwise, the focus is passed to a new window each time Tab"
" is pressed, with no popup widget. In addition, the previously"
" activated window will be sent to the back in this mode.");
QWhatsThis::add( altTabPopup, wtstr );
altTabPopup->setWhatsThis( wtstr );
traverseAll = new QCheckBox( i18n( "&Traverse windows on all desktops" ), kbdBox );
kLay->addWidget( traverseAll );
wtstr = i18n( "Leave this option disabled if you want to limit walking through"
" windows to the current desktop." );
QWhatsThis::add( traverseAll, wtstr );
traverseAll->setWhatsThis( wtstr );
rollOverDesktops = new QCheckBox( i18n("Desktop navi&gation wraps around"), kbdBox );
kLay->addWidget(rollOverDesktops);
wtstr = i18n( "Enable this option if you want keyboard or active desktop border navigation beyond"
" the edge of a desktop to take you to the opposite edge of the new desktop." );
QWhatsThis::add( rollOverDesktops, wtstr );
rollOverDesktops->setWhatsThis( wtstr );
showPopupinfo = new QCheckBox( i18n("Popup desktop name on desktop &switch"), kbdBox );
kLay->addWidget(showPopupinfo);
wtstr = i18n( "Enable this option if you wish to see the current desktop"
" name popup whenever the current desktop is changed." );
QWhatsThis::add( showPopupinfo, wtstr );
showPopupinfo->setWhatsThis( wtstr );
lay->addWidget(kbdBox);
@ -479,7 +484,7 @@ void KFocusConfig::save( void )
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
emit KCModule::changed(false);
}
@ -524,10 +529,10 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
//lay->addWidget(plcBox);
shBox = new QVButtonGroup(i18n("Shading"), this);
shBox = new Q3VButtonGroup(i18n("Shading"), this);
animateShade = new QCheckBox(i18n("Anima&te"), shBox);
QWhatsThis::add(animateShade, i18n("Animate the action of reducing the window to its titlebar (shading)"
animateShade->setWhatsThis( i18n("Animate the action of reducing the window to its titlebar (shading)"
" as well as the expansion of a shaded window") );
shadeHoverOn = new QCheckBox(i18n("&Enable hover"), shBox);
@ -540,12 +545,12 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
shadeHover->setSteps(100, 100);
shadeHover->setSuffix(i18n(" msec"));
QWhatsThis::add(shadeHoverOn, i18n("If Shade Hover is enabled, a shaded window will un-shade automatically "
shadeHoverOn->setWhatsThis( i18n("If Shade Hover is enabled, a shaded window will un-shade automatically "
"when the mouse pointer has been over the title bar for some time."));
wtstr = i18n("Sets the time in milliseconds before the window unshades "
"when the mouse pointer goes over the shaded window.");
QWhatsThis::add(shadeHover, wtstr);
shadeHover->setWhatsThis( wtstr);
lay->addWidget(shBox);
@ -554,10 +559,10 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed()));
connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed()));
electricBox = new QVButtonGroup(i18n("Active Desktop Borders"), this);
electricBox->setMargin(15);
electricBox = new Q3VButtonGroup(i18n("Active Desktop Borders"), this);
electricBox->layout()->setMargin(15);
QWhatsThis::add( electricBox, i18n("If this option is enabled, moving the mouse to a screen border"
electricBox->setWhatsThis( i18n("If this option is enabled, moving the mouse to a screen border"
" will change your desktop. This is e.g. useful if you want to drag windows from one desktop"
" to the other.") );
active_disable = new QRadioButton(i18n("D&isabled"), electricBox);
@ -568,7 +573,7 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
delays->setRange(0, MAX_EDGE_RES, 50, true);
delays->setSuffix(i18n(" msec"));
delays->setLabel(i18n("Desktop &switch delay:"));
QWhatsThis::add( delays, i18n("Here you can set a delay for switching desktops using the active"
delays->setWhatsThis( i18n("Here you can set a delay for switching desktops using the active"
" borders feature. Desktops will be switched after the mouse has been pushed against a screen border"
" for the specified number of milliseconds.") );
@ -590,7 +595,7 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
focusStealing->insertItem( i18n( "Focus Stealing Prevention Level", "Extreme" ));
focusStealingLabel->setBuddy( focusStealing );
focusStealingLayout->addWidget( focusStealingLabel );
focusStealingLayout->addWidget( focusStealing, AlignLeft );
focusStealingLayout->addWidget( focusStealing, Qt::AlignLeft );
wtstr = i18n( "<p>This option specifies how much KWin will try to prevent unwanted focus stealing "
"caused by unexpected activation of new windows. (Note: This feature does not "
"work with the Focus Under Mouse or Focus Strictly Under Mouse focus policies.)"
@ -610,12 +615,12 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p
"<p>Windows that are prevented from stealing focus are marked as demanding attention, "
"which by default means their taskbar entry will be highlighted. This can be changed "
"in the Notifications control module.</p>" );
QWhatsThis::add( focusStealing, wtstr );
QWhatsThis::add( focusStealingLabel, wtstr );
focusStealing->setWhatsThis( wtstr );
focusStealingLabel->setWhatsThis( wtstr );
connect(focusStealing, SIGNAL(activated(int)), SLOT(changed()));
hideUtilityWindowsForInactive = new QCheckBox( i18n( "Hide utility windows for inactive applications" ), this );
QWhatsThis::add( hideUtilityWindowsForInactive,
hideUtilityWindowsForInactive->setWhatsThis(
i18n( "When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be"
" hidden and will be shown only when the application becomes active. Note that applications"
" have to mark the windows with the proper window type for this feature to work." ));
@ -703,7 +708,7 @@ void KAdvancedConfig::save( void )
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
emit KCModule::changed(false);
}
@ -769,7 +774,7 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
QString wtstr;
QBoxLayout *lay = new QVBoxLayout (this, 0, KDialog::spacingHint());
windowsBox = new QButtonGroup(i18n("Windows"), this);
windowsBox = new Q3ButtonGroup(i18n("Windows"), this);
windowsBox->setColumnLayout( 0, Qt::Horizontal );
QBoxLayout *wLay = new QVBoxLayout (windowsBox->layout(), KDialog::spacingHint());
@ -779,19 +784,19 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
opaque = new QCheckBox(i18n("Di&splay content in moving windows"), windowsBox);
bLay->addWidget(opaque);
QWhatsThis::add( opaque, i18n("Enable this option if you want a window's content to be fully shown"
opaque->setWhatsThis( i18n("Enable this option if you want a window's content to be fully shown"
" while moving it, instead of just showing a window 'skeleton'. The result may not be satisfying"
" on slow machines without graphic acceleration.") );
resizeOpaqueOn = new QCheckBox(i18n("Display content in &resizing windows"), windowsBox);
bLay->addWidget(resizeOpaqueOn);
QWhatsThis::add( resizeOpaqueOn, i18n("Enable this option if you want a window's content to be shown"
resizeOpaqueOn->setWhatsThis( i18n("Enable this option if you want a window's content to be shown"
" while resizing it, instead of just showing a window 'skeleton'. The result may not be satisfying"
" on slow machines.") );
geometryTipOn = new QCheckBox(i18n("Display window &geometry when moving or resizing"), windowsBox);
bLay->addWidget(geometryTipOn);
QWhatsThis::add(geometryTipOn, i18n("Enable this option if you want a window's geometry to be displayed"
geometryTipOn->setWhatsThis( i18n("Enable this option if you want a window's geometry to be displayed"
" while it is being moved or resized. The window position relative"
" to the top-left corner of the screen is displayed together with"
" its size."));
@ -803,15 +808,15 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
minimizeAnimOn = new QCheckBox(i18n("Animate minimi&ze and restore"),
windowsBox);
QWhatsThis::add( minimizeAnimOn, i18n("Enable this option if you want an animation shown when"
minimizeAnimOn->setWhatsThis( i18n("Enable this option if you want an animation shown when"
" windows are minimized or restored." ) );
rLay->addWidget(minimizeAnimOn,0,0);
minimizeAnimSlider = new QSlider(0,10,10,0,QSlider::Horizontal, windowsBox);
minimizeAnimSlider = new QSlider(0,10,10,0,Qt::Horizontal, windowsBox);
minimizeAnimSlider->setSteps(1, 1);
// QSlider::Below clashes with a X11/X.h #define
#undef Below
minimizeAnimSlider->setTickmarks(QSlider::Below);
minimizeAnimSlider->setTickmarks(QSlider::TicksBelow);
rLay->addMultiCellWidget(minimizeAnimSlider,0,0,1,2);
connect(minimizeAnimOn, SIGNAL(toggled(bool)), this, SLOT(setMinimizeAnim(bool)));
@ -827,13 +832,13 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
wtstr = i18n("Here you can set the speed of the animation shown when windows are"
" minimized and restored. ");
QWhatsThis::add( minimizeAnimSlider, wtstr );
QWhatsThis::add( minimizeAnimSlowLabel, wtstr );
QWhatsThis::add( minimizeAnimFastLabel, wtstr );
minimizeAnimSlider->setWhatsThis( wtstr );
minimizeAnimSlowLabel->setWhatsThis( wtstr );
minimizeAnimFastLabel->setWhatsThis( wtstr );
moveResizeMaximized = new QCheckBox( i18n("Allow moving and resizing o&f maximized windows"), windowsBox);
bLay->addWidget(moveResizeMaximized);
QWhatsThis::add(moveResizeMaximized, i18n("When enabled, this feature activates the border of maximized windows"
moveResizeMaximized->setWhatsThis( i18n("When enabled, this feature activates the border of maximized windows"
" and allows you to move or resize them,"
" just like for normal windows"));
@ -863,8 +868,8 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
" <li><em>Zero-Cornered</em> will place the window in the top-left corner</li>"
"</ul>") ;
QWhatsThis::add( plcLabel, wtstr);
QWhatsThis::add( placementCombo, wtstr);
plcLabel->setWhatsThis( wtstr);
placementCombo->setWhatsThis( wtstr);
plcLabel->setBuddy(placementCombo);
vLay->addWidget(plcLabel, 0);
@ -889,8 +894,8 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
//CT 15mar98 - add EdgeResistance, BorderAttractor, WindowsAttractor config
MagicBox = new QVButtonGroup(i18n("Snap Zones"), this);
MagicBox->setMargin(15);
MagicBox = new Q3VButtonGroup(i18n("Snap Zones"), this);
MagicBox->layout()->setMargin(15);
BrdrSnap = new KIntNumInput(10, MagicBox);
BrdrSnap->setSpecialValueText( i18n("none") );
@ -898,7 +903,7 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
BrdrSnap->setLabel(i18n("&Border snap zone:"));
BrdrSnap->setSuffix(i18n(" pixels"));
BrdrSnap->setSteps(1,10);
QWhatsThis::add( BrdrSnap, i18n("Here you can set the snap zone for screen borders, i.e."
BrdrSnap->setWhatsThis( i18n("Here you can set the snap zone for screen borders, i.e."
" the 'strength' of the magnetic field which will make windows snap to the border when"
" moved near it.") );
@ -908,12 +913,12 @@ KMovingConfig::KMovingConfig (bool _standAlone, KConfig *_config, QWidget *paren
WndwSnap->setLabel(i18n("&Window snap zone:"));
WndwSnap->setSuffix( i18n(" pixels"));
BrdrSnap->setSteps(1,10);
QWhatsThis::add( WndwSnap, i18n("Here you can set the snap zone for windows, i.e."
WndwSnap->setWhatsThis( i18n("Here you can set the snap zone for windows, i.e."
" the 'strength' of the magnetic field which will make windows snap to each other when"
" they're moved near another window.") );
OverlapSnap=new QCheckBox(i18n("Snap windows onl&y when overlapping"),MagicBox);
QWhatsThis::add( OverlapSnap, i18n("Here you can set that windows will be only"
OverlapSnap->setWhatsThis( i18n("Here you can set that windows will be only"
" snapped if you try to overlap them, i.e. they will not be snapped if the windows"
" comes only near another window or border.") );
@ -1141,7 +1146,7 @@ void KMovingConfig::save( void )
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
emit KCModule::changed(false);
}
@ -1536,7 +1541,7 @@ void KTranslucencyConfig::save( void )
config->sync();
if ( !kapp->dcopClient()->isAttached() )
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
emit KCModule::changed(false);
}

View file

@ -33,9 +33,9 @@ class QComboBox;
class QGroupBox;
class QLabel;
class QSlider;
class QButtonGroup;
class Q3ButtonGroup;
class QSpinBox;
class QVButtonGroup;
class Q3VButtonGroup;
class KColorButton;
class KIntNumInput;
@ -104,7 +104,7 @@ private:
void setRollOverDesktops(bool);
void setShowPopupinfo(bool);
QButtonGroup *fcsBox;
Q3ButtonGroup *fcsBox;
QComboBox *focusCombo;
QCheckBox *autoRaiseOn;
QCheckBox *delayFocusOn;
@ -112,7 +112,7 @@ private:
KIntNumInput *autoRaise;
KIntNumInput *delayFocus;
QButtonGroup *kbdBox;
Q3ButtonGroup *kbdBox;
QCheckBox *altTabPopup;
QCheckBox *traverseAll;
QCheckBox *rollOverDesktops;
@ -152,7 +152,7 @@ private:
void setPlacement(int); //CT
void setMoveResizeMaximized(bool);
QButtonGroup *windowsBox;
Q3ButtonGroup *windowsBox;
QCheckBox *opaque;
QCheckBox *resizeOpaqueOn;
QCheckBox *geometryTipOn;
@ -171,7 +171,7 @@ private:
int getWindowSnapZone();
void setWindowSnapZone( int );
QVButtonGroup *MagicBox;
Q3VButtonGroup *MagicBox;
KIntNumInput *BrdrSnap, *WndwSnap;
QCheckBox *OverlapSnap;
@ -204,7 +204,7 @@ private:
void setShadeHoverInterval(int);
QCheckBox *animateShade;
QButtonGroup *shBox;
Q3ButtonGroup *shBox;
QCheckBox *shadeHoverOn;
KIntNumInput *shadeHover;
@ -216,7 +216,7 @@ private:
void setElectricBorders( int );
void setElectricBorderDelay( int );
QVButtonGroup *electricBox;
Q3VButtonGroup *electricBox;
QRadioButton *active_disable;
QRadioButton *active_move;
QRadioButton *active_always;

View file

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Steet, Fifth Floor, Cambridge, MA 02110-1301, USA.
*/
#include <kdialog.h>
#include "detectwidget.h"
#include <kapplication.h>
@ -25,11 +26,16 @@
#include <qlabel.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
//Added by qt3to4:
#include <QMouseEvent>
#include <QEvent>
#include <Q3CString>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <fixx11h.h>
#include <QX11Info>
namespace KWinInternal
{
@ -112,7 +118,7 @@ void DetectDialog::executeDialog()
emit detectionDone( exec() == QDialog::Accepted );
}
QCString DetectDialog::selectedClass() const
Q3CString DetectDialog::selectedClass() const
{
if( widget->use_class->isChecked() || widget->use_role->isChecked())
return wmclass_class;
@ -124,7 +130,7 @@ bool DetectDialog::selectedWholeClass() const
return widget->use_whole_class->isChecked();
}
QCString DetectDialog::selectedRole() const
Q3CString DetectDialog::selectedRole() const
{
if( widget->use_role->isChecked())
return role;
@ -151,7 +157,7 @@ NET::WindowType DetectDialog::selectedType() const
return type;
}
QCString DetectDialog::selectedMachine() const
Q3CString DetectDialog::selectedMachine() const
{
return machine;
}
@ -161,10 +167,10 @@ void DetectDialog::selectWindow()
// use a dialog, so that all user input is blocked
// use WX11BypassWM and moving away so that it's not actually visible
// grab only mouse, so that keyboard can be used e.g. for switching windows
grabber = new QDialog( NULL, NULL, true, WX11BypassWM );
grabber = new QDialog( NULL, NULL, true, Qt::WX11BypassWM );
grabber->move( -1000, -1000 );
grabber->show();
grabber->grabMouse( crossCursor );
grabber->grabMouse( Qt::CrossCursor );
grabber->installEventFilter( this );
}
@ -176,7 +182,7 @@ bool DetectDialog::eventFilter( QObject* o, QEvent* e )
return false;
delete grabber;
grabber = NULL;
if( static_cast< QMouseEvent* >( e )->button() != LeftButton )
if( static_cast< QMouseEvent* >( e )->button() != Qt::LeftButton )
{
emit detectionDone( false );
return true;
@ -191,13 +197,13 @@ WId DetectDialog::findWindow()
Window child;
uint mask;
int rootX, rootY, x, y;
Window parent = qt_xrootwin();
Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False );
Window parent = QX11Info::appRootWindow();
Atom wm_state = XInternAtom( QX11Info::display(), "WM_STATE", False );
for( int i = 0;
i < 10;
++i )
{
XQueryPointer( qt_xdisplay(), parent, &root, &child,
XQueryPointer( QX11Info::display(), parent, &root, &child,
&rootX, &rootY, &x, &y, &mask );
if( child == None )
return 0;
@ -205,7 +211,7 @@ WId DetectDialog::findWindow()
int format;
unsigned long nitems, after;
unsigned char* prop;
if( XGetWindowProperty( qt_xdisplay(), child, wm_state, 0, 0, False, AnyPropertyType,
if( XGetWindowProperty( QX11Info::display(), child, wm_state, 0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &prop ) == Success )
{
if( prop != NULL )

View file

@ -24,8 +24,12 @@
#include <kdialogbase.h>
#include <kwin.h>
#include <q3cstring.h>
#include "../../rules.h"
//Added by qt3to4:
#include <QEvent>
#include <Q3CString>
namespace KWinInternal
{
@ -45,14 +49,14 @@ class DetectDialog
public:
DetectDialog( QWidget* parent = NULL, const char* name = NULL );
void detect( WId window );
QCString selectedClass() const;
Q3CString selectedClass() const;
bool selectedWholeClass() const;
QCString selectedRole() const;
Q3CString selectedRole() const;
bool selectedWholeApp() const;
NET::WindowType selectedType() const;
QString selectedTitle() const;
Rules::StringMatch titleMatch() const;
QCString selectedMachine() const;
Q3CString selectedMachine() const;
const KWin::WindowInfo& windowInfo() const;
signals:
void detectionDone( bool );
@ -63,13 +67,13 @@ class DetectDialog
void readWindow( WId window );
void executeDialog();
WId findWindow();
QCString wmclass_class;
QCString wmclass_name;
QCString role;
Q3CString wmclass_class;
Q3CString wmclass_name;
Q3CString role;
NET::WindowType type;
QString title;
QCString extrarole;
QCString machine;
Q3CString extrarole;
Q3CString machine;
DetectWidget* widget;
QDialog* grabber;
KWin::WindowInfo info;

View file

@ -2,7 +2,7 @@
<class>KWinInternal::DetectWidgetBase</class>
<widget class="QWidget">
<property name="name">
<cstring>Form3</cstring>
<cstring>DetectWidgetBase</cstring>
</property>
<property name="geometry">
<rect>
@ -24,7 +24,7 @@
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -143,7 +143,7 @@
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">

View file

@ -26,7 +26,7 @@ It is possible to have several possible shortcuts, and the first available short
For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try &lt;b&gt;Shift+Alt+1&lt;/b&gt;, then others with &lt;b&gt;Shift+Ctrl+C&lt;/b&gt; as the last one.</string>
</property>
<property name="textFormat">
<enum>RichText</enum>
<enum>Qt::RichText</enum>
</property>
</widget>
<widget class="Line">
@ -40,7 +40,7 @@ For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="KLineEdit">
@ -61,7 +61,7 @@ For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -86,7 +86,7 @@ For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -111,7 +111,7 @@ For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try
<cstring>spacer3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -136,7 +136,7 @@ For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
</widget>
</vbox>

View file

@ -20,6 +20,8 @@
#include <kglobal.h>
#include <qlayout.h>
//Added by qt3to4:
#include <QVBoxLayout>
#include <klocale.h>
#include <kapplication.h>
#include <dcopclient.h>
@ -68,7 +70,7 @@ void KCMRules::save()
config.sync();
if( !kapp->dcopClient()->isAttached())
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
}
void KCMRules::defaults()

View file

@ -28,11 +28,14 @@
#include "ruleswidget.h"
#include "../../rules.h"
//Added by qt3to4:
#include <Q3ValueList>
#include <Q3CString>
namespace KWinInternal
{
static void loadRules( QValueList< Rules* >& rules )
static void loadRules( Q3ValueList< Rules* >& rules )
{
KConfig cfg( "kwinrulesrc", true );
cfg.setGroup( "General" );
@ -47,13 +50,13 @@ static void loadRules( QValueList< Rules* >& rules )
}
}
static void saveRules( const QValueList< Rules* >& rules )
static void saveRules( const Q3ValueList< Rules* >& rules )
{
KConfig cfg( "kwinrulesrc" );
cfg.setGroup( "General" );
cfg.writeEntry( "count", rules.count());
int i = 1;
for( QValueList< Rules* >::ConstIterator it = rules.begin();
for( Q3ValueList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
{
@ -63,25 +66,25 @@ static void saveRules( const QValueList< Rules* >& rules )
}
}
static Rules* findRule( const QValueList< Rules* >& rules, Window wid )
static Rules* findRule( const Q3ValueList< Rules* >& rules, Window wid )
{
KWin::WindowInfo info = KWin::windowInfo( wid,
NET::WMName | NET::WMWindowType,
NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2ClientMachine );
if( !info.valid()) // shouldn't really happen
return NULL;
QCString wmclass_class = info.windowClassClass().lower();
QCString wmclass_name = info.windowClassName().lower();
QCString role = info.windowRole().lower();
Q3CString wmclass_class = info.windowClassClass().lower();
Q3CString wmclass_name = info.windowClassName().lower();
Q3CString role = info.windowRole().lower();
NET::WindowType type = info.windowType( NET::NormalMask | NET::DesktopMask | NET::DockMask
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask | NET::TopMenuMask
| NET::UtilityMask | NET::SplashMask );
QString title = info.name();
// QCString extrarole = ""; // TODO
QCString machine = info.clientMachine().lower();
Q3CString machine = info.clientMachine().lower();
Rules* best_match = NULL;
int match_quality = 0;
for( QValueList< Rules* >::ConstIterator it = rules.begin();
for( Q3ValueList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
{
@ -136,7 +139,7 @@ static Rules* findRule( const QValueList< Rules* >& rules, Window wid )
if( best_match != NULL )
return best_match;
Rules* ret = new Rules;
ret->description = i18n( "Settings for %1" ).arg( wmclass_class );
ret->description = i18n( "Settings for %1" ).arg( QString::fromLatin1( wmclass_class ) );
if( type == NET::Unknown )
ret->types = NET::NormalMask;
else
@ -194,7 +197,7 @@ static Rules* findRule( const QValueList< Rules* >& rules, Window wid )
static int edit( Window wid )
{
QValueList< Rules* > rules;
Q3ValueList< Rules* > rules;
loadRules( rules );
Rules* orig_rule = findRule( rules, wid );
RulesDialog dlg;
@ -209,7 +212,7 @@ static int edit( Window wid )
}
else if( edited_rule != orig_rule )
{
QValueList< Rules* >::Iterator pos = rules.find( orig_rule );
Q3ValueList< Rules* >::Iterator pos = rules.find( orig_rule );
if( pos != rules.end())
*pos = edited_rule;
else
@ -219,7 +222,7 @@ static int edit( Window wid )
saveRules( rules );
if( !kapp->dcopClient()->isAttached())
kapp->dcopClient()->attach();
kapp->dcopClient()->send("kwin*", "", "reconfigure()", "");
kapp->dcopClient()->send("kwin*", "", "reconfigure()", QByteArray());
return 0;
}
@ -242,7 +245,7 @@ KDE_EXPORT int kdemain( int argc, char* argv[] )
KApplication app;
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
bool id_ok = false;
Window id = args->getOption( "wid" ).toULong( &id_ok );
Window id = args->getOption( "wid" ).toULongLong( &id_ok );
args->clear();
if( !id_ok || id == None )
{

View file

@ -33,10 +33,10 @@ KCMRulesList::KCMRulesList( QWidget* parent, const char* name )
: KCMRulesListBase( parent, name )
{
// connect both current/selected, so that current==selected (stupid QListBox :( )
connect( rules_listbox, SIGNAL( currentChanged( QListBoxItem* )),
SLOT( activeChanged( QListBoxItem*)));
connect( rules_listbox, SIGNAL( selectionChanged( QListBoxItem* )),
SLOT( activeChanged( QListBoxItem*)));
connect( rules_listbox, SIGNAL( currentChanged( Q3ListBoxItem* )),
SLOT( activeChanged( Q3ListBoxItem*)));
connect( rules_listbox, SIGNAL( selectionChanged( Q3ListBoxItem* )),
SLOT( activeChanged( Q3ListBoxItem*)));
connect( new_button, SIGNAL( clicked()),
SLOT( newClicked()));
connect( modify_button, SIGNAL( clicked()),
@ -47,21 +47,21 @@ KCMRulesList::KCMRulesList( QWidget* parent, const char* name )
SLOT( moveupClicked()));
connect( movedown_button, SIGNAL( clicked()),
SLOT( movedownClicked()));
connect( rules_listbox, SIGNAL( doubleClicked ( QListBoxItem * ) ),
connect( rules_listbox, SIGNAL( doubleClicked ( Q3ListBoxItem * ) ),
SLOT( modifyClicked()));
load();
}
KCMRulesList::~KCMRulesList()
{
for( QValueVector< Rules* >::Iterator it = rules.begin();
for( Q3ValueVector< Rules* >::Iterator it = rules.begin();
it != rules.end();
++it )
delete *it;
rules.clear();
}
void KCMRulesList::activeChanged( QListBoxItem* item )
void KCMRulesList::activeChanged( Q3ListBoxItem* item )
{
if( item != NULL )
rules_listbox->setSelected( item, true ); // make current==selected
@ -145,7 +145,7 @@ void KCMRulesList::movedownClicked()
void KCMRulesList::load()
{
rules_listbox->clear();
for( QValueVector< Rules* >::Iterator it = rules.begin();
for( Q3ValueVector< Rules* >::Iterator it = rules.begin();
it != rules.end();
++it )
delete *it;
@ -175,7 +175,7 @@ void KCMRulesList::save()
cfg.setGroup( "General" );
cfg.writeEntry( "count", rules.count());
int i = 1;
for( QValueVector< Rules* >::ConstIterator it = rules.begin();
for( Q3ValueVector< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
{

View file

@ -22,11 +22,11 @@
#include "ruleslistbase.h"
#include <qvaluevector.h>
#include <q3valuevector.h>
#include "../../rules.h"
class QListBoxItem;
class Q3ListBoxItem;
namespace KWinInternal
{
@ -49,9 +49,9 @@ class KCMRulesList
void deleteClicked();
void moveupClicked();
void movedownClicked();
void activeChanged( QListBoxItem* );
void activeChanged( Q3ListBoxItem* );
private:
QValueVector< Rules* > rules;
Q3ValueVector< Rules* > rules;
};
} // namespace

View file

@ -2,7 +2,7 @@
<class>KWinInternal::KCMRulesListBase</class>
<widget class="QWidget">
<property name="name">
<cstring>Form1</cstring>
<cstring>KCMRulesListBase</cstring>
</property>
<property name="geometry">
<rect>
@ -88,4 +88,8 @@
</widget>
<layoutdefaults spacing="6" margin="11"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
<includes>
<include location="local" impldecl="in declaration">kdialog.h</include>
</includes>
</UI>

View file

@ -27,7 +27,7 @@
#include <kwinmodule.h>
#include <klocale.h>
#include <qregexp.h>
#include <qwhatsthis.h>
#include <assert.h>
#include <kmessagebox.h>
#include <qtabwidget.h>
@ -43,8 +43,8 @@ namespace KWinInternal
connect( enable_##var, SIGNAL( toggled( bool )), rule_##var, SLOT( setEnabled( bool ))); \
connect( enable_##var, SIGNAL( toggled( bool )), this, SLOT( updateEnable##var())); \
connect( rule_##var, SIGNAL( activated( int )), this, SLOT( updateEnable##var())); \
QWhatsThis::add( enable_##var, enableDesc ); \
QWhatsThis::add( rule_##var, type##RuleDesc );
enable_##var->setWhatsThis( enableDesc ); \
rule_##var->setWhatsThis( type##RuleDesc );
RulesWidget::RulesWidget( QWidget* parent, const char* name )
: RulesWidgetBase( parent, name )
@ -121,7 +121,7 @@ RulesWidget::RulesWidget( QWidget* parent, const char* name )
void RulesWidget::updateEnable##var() \
{ \
/* leave the label readable label_##var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 );*/ \
var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 ); \
Ui_RulesWidgetBase::var->setEnabled( enable_##var->isChecked() && rule_##var->currentItem() != 0 ); \
}
// geometry tab
@ -346,14 +346,14 @@ static NET::WindowType comboToType( int val )
{ \
enable_##var->setChecked( false ); \
rule_##var->setCurrentItem( 0 ); \
var->uimethod0; \
Ui_RulesWidgetBase::var->uimethod0; \
updateEnable##var(); \
} \
else \
{ \
enable_##var->setChecked( true ); \
rule_##var->setCurrentItem( type##_rule_to_combo[ rules->var##rule ] ); \
var->uimethod( func( rules->var )); \
Ui_RulesWidgetBase::var->uimethod( func( rules->var )); \
updateEnable##var(); \
}
@ -436,7 +436,7 @@ void RulesWidget::setRules( Rules* rules )
if( enable_##var->isChecked()) \
{ \
rules->var##rule = combo_to_##type##_rule[ rule_##var->currentItem() ]; \
rules->var = func( var->uimethod()); \
rules->var = func( Ui_RulesWidgetBase::var->uimethod()); \
} \
else \
rules->var##rule = Rules::Unused##Type##Rule;
@ -591,7 +591,7 @@ void RulesWidget::detected( bool ok )
#define GENERIC_PREFILL( var, func, info, uimethod ) \
if( !enable_##var->isChecked()) \
{ \
var->uimethod( func( info )); \
Ui_RulesWidgetBase::var->uimethod( func( info )); \
}
#define CHECKBOX_PREFILL( var, func, info ) GENERIC_PREFILL( var, func, info, setChecked )
@ -751,12 +751,12 @@ void ShortcutDialog::accept()
KKeySequence seq = shortcut().seq( i );
if( seq.isNull())
break;
if( seq.key( 0 ) == Key_Escape )
if( seq.key( 0 ) == Qt::Key_Escape )
{
reject();
return;
}
if( seq.key( 0 ) == Key_Space )
if( seq.key( 0 ) == Qt::Key_Space )
{ // clear
setShortcut( KShortcut());
KShortcutDialog::accept();

View file

@ -2,7 +2,7 @@
<class>KWinInternal::RulesWidgetBase</class>
<widget class="QWidget">
<property name="name">
<cstring>Form2</cstring>
<cstring>RulesWidgetBase</cstring>
</property>
<property name="geometry">
<rect>
@ -82,7 +82,7 @@
<cstring>spacer29</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -124,7 +124,7 @@
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -152,7 +152,7 @@
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -194,7 +194,7 @@
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -225,7 +225,7 @@
<cstring>spacer5</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -266,7 +266,7 @@
<cstring>spacer27</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -291,7 +291,7 @@
<cstring>spacer28</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -347,7 +347,7 @@
</item>
<item>
<property name="text">
<string>Dock (panel)</string>
<string>Qt::ToolBarDock (panel)</string>
</property>
</item>
<item>
@ -465,7 +465,7 @@
<cstring>spacer2_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -496,7 +496,7 @@
<cstring>spacer5_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -538,7 +538,7 @@
<cstring>spacer2_2_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -569,7 +569,7 @@
<cstring>spacer5_2_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -611,7 +611,7 @@
<cstring>spacer2_2_3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -642,7 +642,7 @@
<cstring>spacer5_2_3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1138,7 +1138,7 @@
</item>
<item>
<property name="text">
<string>Top-Left Corner</string>
<string>Qt::DockTop-Qt::DockLeft Qt::Corner</string>
</property>
</item>
<item>
@ -1171,7 +1171,7 @@
<cstring>spacer31</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1337,7 +1337,7 @@
<cstring>spacer24</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1354,7 +1354,7 @@
<cstring>spacer36_7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1371,7 +1371,7 @@
<cstring>spacer36_6</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1388,7 +1388,7 @@
<cstring>spacer36_5</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1405,7 +1405,7 @@
<cstring>spacer36_4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1422,7 +1422,7 @@
<cstring>spacer36_3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1439,7 +1439,7 @@
<cstring>spacer36_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1456,7 +1456,7 @@
<cstring>spacer36</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1786,7 +1786,7 @@
<cstring>spacer33</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1837,7 +1837,7 @@
<cstring>spacer25</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -1984,7 +1984,7 @@
</item>
<item>
<property name="text">
<string>Dock (panel)</string>
<string>Qt::ToolBarDock (panel)</string>
</property>
</item>
<item>
@ -2257,7 +2257,7 @@
<cstring>spacer35</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
@ -2336,43 +2336,43 @@
<connection>
<sender>detect1</sender>
<signal>clicked()</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>detectClicked()</slot>
</connection>
<connection>
<sender>wmclass_match</sender>
<signal>activated(int)</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>wmclassMatchChanged()</slot>
</connection>
<connection>
<sender>role_match</sender>
<signal>activated(int)</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>roleMatchChanged()</slot>
</connection>
<connection>
<sender>title_match</sender>
<signal>activated(int)</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>titleMatchChanged()</slot>
</connection>
<connection>
<sender>extra_match</sender>
<signal>activated(int)</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>extraMatchChanged()</slot>
</connection>
<connection>
<sender>machine_match</sender>
<signal>activated(int)</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>machineMatchChanged()</slot>
</connection>
<connection>
<sender>shortcut_edit</sender>
<signal>clicked()</signal>
<receiver>Form2</receiver>
<receiver>RulesWidgetBase</receiver>
<slot>shortcutEditClicked()</slot>
</connection>
</connections>

View file

@ -30,6 +30,9 @@ DEALINGS IN THE SOFTWARE.
#include <unistd.h>
#include <kwin.h>
#include <X11/Xlib.h>
//Added by qt3to4:
#include <Q3CString>
#include <QX11Info>
static const KCmdLineOptions options[] =
{
@ -51,15 +54,15 @@ int main( int argc, char* argv[] )
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
QCString hostname = args->getOption( "hostname" );
Q3CString hostname = args->getOption( "hostname" );
bool pid_ok = false;
pid_t pid = args->getOption( "pid" ).toULong( &pid_ok );
pid_t pid = QString( args->getOption( "pid" ) ).toULong( &pid_ok );
QString caption = QString::fromUtf8( args->getOption( "windowname" ));
QString appname = QString::fromLatin1( args->getOption( "applicationname" ));
bool id_ok = false;
Window id = args->getOption( "wid" ).toULong( &id_ok );
Window id = QString( args->getOption( "wid" ) ).toULong( &id_ok );
bool time_ok = false;
Time timestamp =args->getOption( "timestamp" ).toULong( &time_ok );
Time timestamp =QString( args->getOption( "timestamp" ) ).toULong( &time_ok );
args->clear();
if( !pid_ok || pid == 0 || !id_ok || id == None || !time_ok || timestamp == CurrentTime
|| hostname.isEmpty() || caption.isEmpty() || appname.isEmpty())
@ -71,18 +74,18 @@ int main( int argc, char* argv[] )
"<qt>Window with title \"<b>%2</b>\" is not responding. "
"This window belongs to application <b>%1</b> (PID=%3, hostname=%4).<p>"
"Do you wish to terminate this application? (All unsaved data in this application will be lost.)</qt>" )
.arg( appname ).arg( caption ).arg( pid ).arg( hostname );
.arg( appname ).arg( caption ).arg( pid ).arg( QString( hostname ) );
app.updateUserTimestamp( timestamp );
if( KMessageBox::warningYesNoWId( id, question, QString::null, i18n("Terminate"), i18n("Keep Running") ) == KMessageBox::Yes )
{
if( hostname != "localhost" )
{
KProcess proc;
proc << "xon" << hostname << "kill" << pid;
proc << "xon" << hostname << "kill" << QString::number( pid );
proc.start( KProcess::DontCare );
}
else
::kill( pid, SIGKILL );
XKillClient( qt_xdisplay(), id );
XKillClient( QX11Info::display(), id );
}
}

View file

@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <X11/keysym.h>
#include <X11/keysymdef.h>
#include <X11/cursorfont.h>
#include <QX11Info>
namespace KWinInternal
{
@ -35,16 +36,16 @@ void KillWindow::start()
{
static Cursor kill_cursor = 0;
if (!kill_cursor)
kill_cursor = XCreateFontCursor(qt_xdisplay(), XC_pirate);
kill_cursor = XCreateFontCursor(QX11Info::display(), XC_pirate);
if (XGrabPointer(qt_xdisplay(), qt_xrootwin(), False,
if (XGrabPointer(QX11Info::display(), QX11Info::appRootWindow(), False,
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask |
EnterWindowMask | LeaveWindowMask,
GrabModeAsync, GrabModeAsync, None,
kill_cursor, CurrentTime) == GrabSuccess)
{
XGrabKeyboard(qt_xdisplay(), qt_xrootwin(), False,
XGrabKeyboard(QX11Info::display(), QX11Info::appRootWindow(), False,
GrabModeAsync, GrabModeAsync, CurrentTime);
XEvent ev;
@ -56,12 +57,12 @@ void KillWindow::start()
while (!return_pressed && !escape_pressed && !button_released)
{
XMaskEvent(qt_xdisplay(), KeyPressMask | ButtonPressMask |
XMaskEvent(QX11Info::display(), KeyPressMask | ButtonPressMask |
ButtonReleaseMask | PointerMotionMask, &ev);
if (ev.type == KeyPress)
{
int kc = XKeycodeToKeysym(qt_xdisplay(), ev.xkey.keycode, 0);
int kc = XKeycodeToKeysym(QX11Info::display(), ev.xkey.keycode, 0);
int mx = 0;
int my = 0;
return_pressed = (kc == XK_Return) || (kc == XK_space);
@ -95,7 +96,7 @@ void KillWindow::start()
Window root, child;
int dummy1, dummy2, dummy3, dummy4;
unsigned int dummy5;
if( XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
if( XQueryPointer( QX11Info::display(), QX11Info::appRootWindow(), &root, &child,
&dummy1, &dummy2, &dummy3, &dummy4, &dummy5 ) == true
&& child != None )
workspace->killWindowId( child );
@ -103,8 +104,8 @@ void KillWindow::start()
ungrabXServer();
XUngrabKeyboard(qt_xdisplay(), CurrentTime);
XUngrabPointer(qt_xdisplay(), CurrentTime);
XUngrabKeyboard(QX11Info::display(), CurrentTime);
XUngrabPointer(QX11Info::display(), CurrentTime);
}
}

View file

@ -11,6 +11,9 @@
#endif
#define WIN KKey::QtWIN
#define ALT Qt::ALT
#define SHIFT Qt::SHIFT
#define CTRL Qt::CTRL
// some shortcuts have Tarzan-speech like names, they need extra normal human descriptions with DEF2()
// the others can use DEF()
@ -168,3 +171,6 @@ DEF( I18N_NOOP("Window to Taskbar Position 9", WIN+Qt::Key_Alt+9"));
#undef DEF
#undef DEF2
#undef WIN
#undef ALT
#undef SHIFT
#undef CTRL

View file

@ -72,8 +72,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "tabbox.h"
#include "group.h"
#include "rules.h"
extern Time qt_x_time;
#include <QX11Info>
namespace KWinInternal
{
@ -139,12 +138,10 @@ void Workspace::propagateClients( bool propagate_new_clients )
// windows (e.g. popups).
new_stack[ pos++ ] = supportWindow->winId();
int topmenu_space_pos = 1; // not 0, that's supportWindow !!!
for( ClientList::ConstIterator it = stacking_order.fromLast();
it != stacking_order.end();
--it )
for ( int i = stacking_order.size() - 1; i >= 0; i-- )
{
new_stack[ pos++ ] = (*it)->frameId();
if( (*it)->belongsToLayer() >= DockLayer )
new_stack[ pos++ ] = stacking_order.at( i )->frameId();
if( stacking_order.at( i )->belongsToLayer() >= DockLayer )
topmenu_space_pos = pos;
}
if( topmenu_space != NULL )
@ -159,7 +156,7 @@ void Workspace::propagateClients( bool propagate_new_clients )
// TODO isn't it too inefficient to restart always all clients?
// TODO don't restack not visible windows?
assert( new_stack[ 0 ] = supportWindow->winId());
XRestackWindows(qt_xdisplay(), new_stack, pos);
XRestackWindows(QX11Info::display(), new_stack, pos);
delete [] new_stack;
if ( propagate_new_clients )
@ -193,25 +190,21 @@ void Workspace::propagateClients( bool propagate_new_clients )
Client* Workspace::topClientOnDesktop( int desktop, bool unconstrained ) const
{
// TODO Q_ASSERT( block_stacking_updates == 0 );
ClientList::ConstIterator begin, end;
ClientList list;
if( !unconstrained )
{
begin = stacking_order.fromLast();
end = stacking_order.end();
list = stacking_order;
}
else
{
begin = unconstrained_stacking_order.fromLast();
end = unconstrained_stacking_order.end();
}
for( ClientList::ConstIterator it = begin;
it != end;
--it )
{
if ( (*it)->isOnDesktop( desktop ) && !(*it)->isSpecialWindow()
&& (*it)->isShown( false ) && (*it)->wantsTabFocus())
return *it;
list = unconstrained_stacking_order;
}
for ( int i = list.size() - 1; i>=0; i-- )
{
if ( list.at( i )->isOnDesktop( desktop ) && !list.at( i )->isSpecialWindow()
&& list.at( i )->isShown( false ) && list.at( i )->wantsTabFocus())
return list.at( i );
}
return 0;
}
@ -220,20 +213,20 @@ Client* Workspace::findDesktop( bool topmost, int desktop ) const
// TODO Q_ASSERT( block_stacking_updates == 0 );
if( topmost )
{
for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it)
for ( int i = stacking_order.size() - 1; i>=0; i-- )
{
if ( (*it)->isOnDesktop( desktop ) && (*it)->isDesktop()
&& (*it)->isShown( true ))
return *it;
if ( stacking_order.at( i )->isOnDesktop( desktop ) && stacking_order.at( i )->isDesktop()
&& stacking_order.at( i )->isShown( true ))
return stacking_order.at( i );
}
}
else // bottom-most
{
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it)
foreach ( Client* c, stacking_order )
{
if ( (*it)->isOnDesktop( desktop ) && (*it)->isDesktop()
&& (*it)->isShown( true ))
return *it;
if ( c->isOnDesktop( desktop ) && c->isDesktop()
&& c->isShown( true ))
return c;
}
}
return NULL;
@ -274,10 +267,10 @@ void Workspace::lowerClient( Client* c )
{
// lower also mainclients, in their reversed stacking order
ClientList mainclients = ensureStackingOrder( c->mainClients());
for( ClientList::ConstIterator it = mainclients.fromLast();
it != mainclients.end();
++it )
lowerClient( *it );
for( int i = mainclients.size() - 1;
i >= 0;
--i )
lowerClient( mainclients[ i ] );
}
if ( c == most_recently_raised )
@ -355,17 +348,14 @@ void Workspace::raiseClientWithinApplication( Client* c )
// ignore mainwindows
// first try to put it above the top-most window of the application
for( ClientList::Iterator it = unconstrained_stacking_order.fromLast();
it != unconstrained_stacking_order.end();
--it )
for ( int i = unconstrained_stacking_order.size() - 1; i>= 0 ; i-- )
{
if( *it == c ) // don't lower it just because it asked to be raised
if( unconstrained_stacking_order.at( i ) == c ) // don't lower it just because it asked to be raised
return;
if( Client::belongToSameApplication( *it, c ))
if( Client::belongToSameApplication( unconstrained_stacking_order.at( i ), c ))
{
unconstrained_stacking_order.remove( c );
++it; // insert after the found one
unconstrained_stacking_order.insert( it, c );
unconstrained_stacking_order.insert( ++i, c ); // insert after the found one
return;
}
}
@ -425,13 +415,11 @@ void Workspace::restackClientUnderActive( Client* c )
{
// also put in focus_chain after all windows belonging to the active application
focus_chain.remove( c );
for( ClientList::Iterator it = focus_chain.fromLast();
it != focus_chain.end();
--it )
for ( int i = focus_chain.size() - 1; i >= 0 ; i-- )
{
if( Client::belongToSameApplication( active_client, *it ))
if( Client::belongToSameApplication( active_client, focus_chain.at( i ) ))
{
focus_chain.insert( it, c );
focus_chain.insert( i, c );
break;
}
}
@ -497,63 +485,64 @@ ClientList Workspace::constrainedStackingOrder()
#endif
// now keep transients above their mainwindows
// TODO this could(?) use some optimization
for( ClientList::Iterator it = stacking.fromLast();
it != stacking.end();
for( int i = stacking.size() - 1;
i >= 0;
)
{
if( !(*it)->isTransient())
if( !stacking[ i ]->isTransient())
{
--it;
--i;
continue;
}
ClientList::Iterator it2 = stacking.end();
if( (*it)->groupTransient())
int i2 = -1;
if( stacking[ i ]->groupTransient())
{
if( (*it)->group()->members().count() > 0 )
if( stacking[ i ]->group()->members().count() > 0 )
{ // find topmost client this one is transient for
for( it2 = stacking.fromLast();
it2 != stacking.end();
--it2 )
for( i2 = stacking.size() - 1;
i2 >= 0;
--i2 )
{
if( *it2 == *it )
if( stacking[ i2 ] == stacking[ i ] )
{
it2 = stacking.end(); // don't reorder
i2 = -1; // don't reorder
break;
}
if( (*it2)->hasTransient( *it, true ) && keepTransientAbove( *it2, *it ))
if( stacking[ i2 ]->hasTransient( stacking[ i ], true )
&& keepTransientAbove( stacking[ i2 ], stacking[ i ] ))
break;
}
} // else it2 remains pointing at stacking.end()
} // else i2 remains pointing at -1
}
else
{
for( it2 = stacking.fromLast();
it2 != stacking.end();
--it2 )
for( i2 = stacking.size() - 1;
i2 >= 0;
--i2 )
{
if( *it2 == *it )
if( stacking[ i2 ] == stacking[ i ] )
{
it2 = stacking.end(); // don't reorder
i2 = -1; // don't reorder
break;
}
if( *it2 == (*it)->transientFor() && keepTransientAbove( *it2, *it ))
if( stacking[ i2 ] == stacking[ i ]->transientFor()
&& keepTransientAbove( stacking[ i2 ], stacking[ i ] ))
break;
}
}
// kdDebug() << "STACK:" << (*it) << ":" << ( it2 == stacking.end() ? ((Client*)0) : (*it2)) << endl;
if( it2 == stacking.end())
// kdDebug() << "STACK:" << stacking[ i ] << ":" << ( i2 == -1 ? ((Client*)0) : stacking[ i2 ] ) << endl;
if( i2 == -1 )
{
--it;
--i;
continue;
}
Client* current = *it;
ClientList::Iterator remove_it = it;
--it;
stacking.remove( remove_it );
Client* current = stacking[ i ];
stacking.removeAt( i );
--i;
if( !current->transients().isEmpty()) // this one now can be possibly above its transients,
it = it2; // so go again higher in the stack order and possibly move those transients again
++it2; // insert after the mainwindow, it's ok if it2 is now stacking.end()
stacking.insert( it2, current );
i = i2; // so go again higher in the stack order and possibly move those transients again
++i2; // insert after the mainwindow, it's ok if it2 is now stacking.end()
stacking.insert( i2, current );
}
#if 0
kdDebug() << "stacking3:" << endl;

View file

@ -34,6 +34,7 @@
#include <kapplication.h>
#include <kdecorationfactory.h>
#include <klocale.h>
#include <QDesktopWidget>
#include "kcommondecoration.h"
#include "kcommondecoration.moc"
@ -109,10 +110,10 @@ int KCommonDecoration::layoutMetric(LayoutMetric lm, bool, const KCommonDecorati
void KCommonDecoration::init()
{
createMainWidget(WNoAutoErase);
createMainWidget();
// for flicker-free redraws
widget()->setBackgroundMode(NoBackground);
widget()->setBackgroundMode(Qt::NoBackground);
widget()->installEventFilter( this );
@ -199,7 +200,7 @@ void KCommonDecoration::updateLayout() const
if (*it) {
if (!(*it)->isHidden() ) {
moveWidget(x,y, *it);
x += layoutMetric(LM_ButtonWidth, true, ::qt_cast<KCommonDecorationButton*>(*it) );
x += layoutMetric(LM_ButtonWidth, true, qobject_cast<KCommonDecorationButton*>(*it) );
elementLayouted = true;
}
} else {
@ -221,7 +222,7 @@ void KCommonDecoration::updateLayout() const
if (*it) {
if (!(*it)->isHidden() ) {
moveWidget(x,y, *it);
x += layoutMetric(LM_ButtonWidth, true, ::qt_cast<KCommonDecorationButton*>(*it) );;
x += layoutMetric(LM_ButtonWidth, true, qobject_cast<KCommonDecorationButton*>(*it) );;
elementLayouted = true;
}
} else {
@ -319,15 +320,15 @@ int KCommonDecoration::buttonContainerWidth(const ButtonContainer &btnContainer,
void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString& s, bool isLeft)
{
if (s.length() > 0) {
for (unsigned n=0; n < s.length(); n++) {
for (int n=0; n < s.length(); n++) {
KCommonDecorationButton *btn = 0;
switch (s[n]) {
switch (s[n].toAscii()) {
case 'M': // Menu button
if (!m_button[MenuButton]){
btn = createButton(MenuButton);
if (!btn) break;
btn->setTipText(i18n("Menu") );
btn->setRealizeButtons(LeftButton|RightButton);
btn->setRealizeButtons(Qt::LeftButton|Qt::RightButton);
connect(btn, SIGNAL(pressed()), SLOT(menuButtonPressed()));
connect(btn, SIGNAL(released()), this, SLOT(menuButtonReleased()));
@ -371,7 +372,7 @@ void KCommonDecoration::addButtons(ButtonContainer &btnContainer, const QString&
if ((!m_button[MaxButton]) && isMaximizable()){
btn = createButton(MaxButton);
if (!btn) break;
btn->setRealizeButtons(LeftButton|MidButton|RightButton);
btn->setRealizeButtons(Qt::LeftButton|Qt::MidButton|Qt::RightButton);
const bool max = maximizeMode()!=MaximizeRestore;
btn->setTipText(max?i18n("Restore"):i18n("Maximize") );
btn->setToggleButton(true);
@ -684,7 +685,7 @@ void KCommonDecoration::resizeWidget(int w, int h, QWidget *widget) const
void KCommonDecoration::mouseDoubleClickEvent(QMouseEvent *e)
{
if( e->button() != LeftButton )
if( e->button() != Qt::LeftButton )
return;
int tb = layoutMetric(LM_TitleEdgeTop)+layoutMetric(LM_TitleHeight)+layoutMetric(LM_TitleEdgeBottom);
@ -871,14 +872,14 @@ QRect KCommonDecoration::titleRect() const
KCommonDecorationButton::KCommonDecorationButton(ButtonType type, KCommonDecoration *parent, const char *name)
: QButton(parent->widget(), name),
: Q3Button(parent->widget(), name),
m_decoration(parent),
m_type(type),
m_realizeButtons(LeftButton),
m_lastMouse(NoButton),
m_realizeButtons(Qt::LeftButton),
m_lastMouse(Qt::NoButton),
m_isLeft(true)
{
setCursor(ArrowCursor);
setCursor(Qt::ArrowCursor);
}
KCommonDecorationButton::~KCommonDecorationButton()
@ -932,14 +933,14 @@ void KCommonDecorationButton::setTipText(const QString &tip) {
void KCommonDecorationButton::setToggleButton(bool toggle)
{
QButton::setToggleButton(toggle);
Q3Button::setToggleButton(toggle);
reset(ToggleChange);
}
void KCommonDecorationButton::setOn(bool on)
{
if (on != isOn() ) {
QButton::setOn(on);
Q3Button::setOn(on);
reset(StateChange);
}
}
@ -949,9 +950,9 @@ void KCommonDecorationButton::mousePressEvent(QMouseEvent* e)
m_lastMouse = e->button();
// pass on event after changing button to LeftButton
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
(e->button()&m_realizeButtons)?LeftButton:NoButton, e->state());
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
QButton::mousePressEvent(&me);
Q3Button::mousePressEvent(&me);
}
void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e)
@ -959,7 +960,7 @@ void KCommonDecorationButton::mouseReleaseEvent(QMouseEvent* e)
m_lastMouse = e->button();
// pass on event after changing button to LeftButton
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
(e->button()&m_realizeButtons)?LeftButton:NoButton, e->state());
(e->button()&m_realizeButtons)?Qt::LeftButton : Qt::NoButton, e->state());
QButton::mouseReleaseEvent(&me);
Q3Button::mouseReleaseEvent(&me);
}

View file

@ -25,9 +25,7 @@
#ifndef KCOMMONDECORATION_H
#define KCOMMONDECORATION_H
#include <qbutton.h>
#include <qvaluevector.h>
#include <Q3Button>
#include "kdecoration.h"
class KDecorationBridge;
@ -263,7 +261,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
void moveWidget(int x, int y, QWidget *w) const;
void resizeWidget(int w, int h, QWidget *w) const;
typedef QValueVector <KCommonDecorationButton*> ButtonContainer; ///< If the entry is 0, it's a spacer.
typedef QVector <KCommonDecorationButton*> ButtonContainer; ///< If the entry is 0, it's a spacer.
int buttonContainerWidth(const ButtonContainer &btnContainer, bool countHidden = false) const;
void addButtons(ButtonContainer &btnContainer, const QString& buttons, bool isLeft);
@ -287,7 +285,7 @@ class KWIN_EXPORT KCommonDecoration : public KDecoration
/**
* Title bar buttons of KCommonDecoration need to inherit this class.
*/
class KWIN_EXPORT KCommonDecorationButton : public QButton
class KWIN_EXPORT KCommonDecorationButton : public Q3Button
{
friend class KCommonDecoration;
@ -341,7 +339,7 @@ class KWIN_EXPORT KCommonDecorationButton : public QButton
/**
* The mouse button that has been clicked last time.
*/
ButtonState lastMousePress() const { return m_lastMouse; }
Qt::ButtonState lastMousePress() const { return m_lastMouse; }
QSize sizeHint() const;
@ -357,7 +355,7 @@ class KWIN_EXPORT KCommonDecorationButton : public QButton
ButtonType m_type;
int m_realizeButtons;
QSize m_size;
ButtonState m_lastMouse;
Qt::ButtonState m_lastMouse;
bool m_isLeft;

View file

@ -57,7 +57,7 @@ const KDecorationOptions* KDecoration::options()
return options_;
}
void KDecoration::createMainWidget( WFlags flags )
void KDecoration::createMainWidget( Qt::WFlags flags )
{
// FRAME check flags?
setMainWidget( new QWidget( initialParentWidget(), "decoration widget", initialWFlags() | flags ));
@ -236,7 +236,7 @@ void KDecoration::closeWindow()
bridge_->closeWindow();
}
void KDecoration::maximize( ButtonState button )
void KDecoration::maximize( Qt::ButtonState button )
{
performWindowOperation( options()->operationMaxButtonClick( button ));
}

View file

@ -31,6 +31,7 @@ DEALINGS IN THE SOFTWARE.
#include <qiconset.h>
#include <netwm_def.h>
#include <kdeversion.h>
#include <QMouseEvent>
class KDecorationOptionsPrivate;
class KDecorationBridge;
@ -693,7 +694,7 @@ class KWIN_EXPORT KDecoration
* flags that affect widget drawing are allowed. Window type flags
* like WX11BypassWM or WStyle_NoBorder are forbidden.
*/
void createMainWidget( WFlags flags = 0 );
void createMainWidget( Qt::WFlags flags = 0 );
/**
* The parent widget that should be used for the main widget.
*/
@ -704,7 +705,7 @@ class KWIN_EXPORT KDecoration
* that affect widget drawing are allowed. Window type flags like WX11BypassWM
* or WStyle_NoBorder are forbidden.
*/
WFlags initialWFlags() const;
Qt::WFlags initialWFlags() const;
/**
* This function is only allowed to be called once from animateMinimize().
* It can be used if the window should be shown or hidden at a specific
@ -767,7 +768,7 @@ class KWIN_EXPORT KDecoration
#if KDE_IS_VERSION( 3, 90, 0 )
#warning Update the docs.
#endif
void maximize( ButtonState button );
void maximize( Qt::ButtonState button );
/**
* Set the maximize mode of the decorated window.
* @param mode The maximization mode to be set.

View file

@ -153,7 +153,8 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
inactiveFont = config->readFontEntry("inactiveFont", &activeFont);
activeFontSmall = activeFont;
activeFontSmall.setPointSize(activeFont.pointSize() - 2);
#warning KDE4 : is it usefull ? ( temporary hack )
// activeFontSmall.setPointSize(activeFont.pointSize() - 2 > 0 ? activeFont.pointSize() - 2 : activeFont.pointSize()+1 );
activeFontSmall = config->readFontEntry("activeFontSmall", &activeFontSmall);
inactiveFontSmall = config->readFontEntry("inactiveFontSmall", &activeFontSmall);
@ -226,9 +227,9 @@ unsigned long KDecorationOptionsPrivate::updateKWinSettings( KConfig* config )
}
KDecorationDefines::BorderSize KDecorationOptionsPrivate::findPreferredBorderSize( BorderSize size,
QValueList< BorderSize > sizes ) const
QList< BorderSize > sizes ) const
{
for( QValueList< BorderSize >::ConstIterator it = sizes.begin();
for( QList< BorderSize >::ConstIterator it = sizes.begin();
it != sizes.end();
++it )
if( size <= *it ) // size is either a supported size, or *it is the closest larger supported

View file

@ -31,7 +31,6 @@ DEALINGS IN THE SOFTWARE.
#include "kdecoration.h"
#include <qwidget.h>
#include <qvaluelist.h>
class KConfig;
@ -42,7 +41,7 @@ class KWIN_EXPORT KDecorationOptionsPrivate : public KDecorationDefines
virtual ~KDecorationOptionsPrivate();
void defaultKWinSettings(); // shared implementation
unsigned long updateKWinSettings( KConfig* ); // shared implementation
BorderSize findPreferredBorderSize( BorderSize size, QValueList< BorderSize > ) const; // shared implementation
BorderSize findPreferredBorderSize( BorderSize size, QList< BorderSize > ) const; // shared implementation
QColor colors[NUM_COLORS*2];
QColorGroup *cg[NUM_COLORS*2];

View file

@ -106,6 +106,7 @@ bool KDecorationPlugins::loadPlugin( QString nameStr )
KDecorationFactory* oldFactory = fact;
QString path = KLibLoader::findLibrary(QFile::encodeName(nameStr));
kdDebug() << "kwin : path " << path << " for " << nameStr << endl;
// If the plugin was not found, try to find the default
if (path.isEmpty())

View file

@ -30,7 +30,6 @@ DEALINGS IN THE SOFTWARE.
// This header file is internal. I mean it.
//
#include <qcstring.h>
#include <qstring.h>
#include <qwidget.h>
@ -56,7 +55,7 @@ class KWIN_EXPORT KDecorationPlugins
bool reset( unsigned long changed ); // returns true if decorations need to be recreated
protected:
virtual void error( const QString& error_msg );
QCString defaultPlugin; // FRAME normalne protected?
QByteArray defaultPlugin; // FRAME normalne protected?
private:
KDecorationFactory* (*create_ptr)();
KLibrary *library;

View file

@ -51,9 +51,9 @@ void KDecorationFactory::checkRequirements( KDecorationProvides* )
{
}
QValueList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const
QList< KDecorationDefines::BorderSize > KDecorationFactory::borderSizes() const
{
return QValueList< BorderSize >() << BorderNormal;
return QList< BorderSize >() << BorderNormal;
}
bool KDecorationFactory::exists( const KDecoration* deco ) const
@ -73,7 +73,7 @@ void KDecorationFactory::removeDecoration( KDecoration* deco )
void KDecorationFactory::resetDecorations( unsigned long changed )
{
for( QValueList< KDecoration* >::ConstIterator it = _decorations.begin();
for( QList< KDecoration* >::ConstIterator it = _decorations.begin();
it != _decorations.end();
++it )
(*it)->reset( changed );

View file

@ -68,7 +68,7 @@ class KWIN_EXPORT KDecorationFactory
* sizes, ordered from the smallest to the largest one. By default, only
* BorderNormal is returned.
*/
virtual QValueList< BorderSize > borderSizes() const;
virtual QList< BorderSize > borderSizes() const;
virtual bool supports( Ability ability );
@ -108,7 +108,7 @@ class KWIN_EXPORT KDecorationFactory
*/
NET::WindowType windowType( unsigned long supported_types, KDecorationBridge* bridge ) const;
private:
QValueList< KDecoration* > _decorations;
QList< KDecoration* > _decorations;
KDecorationFactoryPrivate* d;
};

View file

@ -22,6 +22,8 @@ License. See the file "COPYING" for the exact licensing terms.
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <QX11Info>
#include <stdio.h>
#include "atoms.h"
#include "options.h"
@ -33,8 +35,6 @@ License. See the file "COPYING" for the exact licensing terms.
#undef INT8
#undef INT32
extern Time qt_x_time;
namespace KWinInternal
{
@ -91,7 +91,7 @@ Application::Application( )
}
if (screen_number == -1)
screen_number = DefaultScreen(qt_xdisplay());
screen_number = DefaultScreen(QX11Info::display());
if( !owner.claim( args->isSet( "replace" ), true ))
{
@ -109,7 +109,7 @@ Application::Application( )
XSetErrorHandler( x11ErrorHandler );
// check whether another windowmanager is running
XSelectInput(qt_xdisplay(), qt_xrootwin(), SubstructureRedirectMask );
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), SubstructureRedirectMask );
syncX(); // trigger error now
options = new Options;
@ -125,19 +125,19 @@ Application::Application( )
dcopClient()->send( "ksplash", "", "upAndRunning(QString)", QString("wm started"));
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = XInternAtom( qt_xdisplay(), "_KDE_SPLASH_PROGRESS", False );
e.xclient.display = qt_xdisplay();
e.xclient.window = qt_xrootwin();
e.xclient.message_type = XInternAtom( QX11Info::display(), "_KDE_SPLASH_PROGRESS", False );
e.xclient.display = QX11Info::display();
e.xclient.window = QX11Info::appRootWindow();
e.xclient.format = 8;
strcpy( e.xclient.data.b, "wm started" );
XSendEvent( qt_xdisplay(), qt_xrootwin(), False, SubstructureNotifyMask, &e );
XSendEvent( QX11Info::display(), QX11Info::appRootWindow(), False, SubstructureNotifyMask, &e );
}
Application::~Application()
{
delete Workspace::self();
if( owner.ownerWindow() != None ) // if there was no --replace (no new WM)
XSetInputFocus( qt_xdisplay(), PointerRoot, RevertToPointerRoot, qt_x_time );
XSetInputFocus( QX11Info::display(), PointerRoot, RevertToPointerRoot, QX11Info::appTime() );
delete options;
}
@ -145,7 +145,7 @@ void Application::lostSelection()
{
delete Workspace::self();
// remove windowmanager privileges
XSelectInput(qt_xdisplay(), qt_xrootwin(), PropertyChangeMask );
XSelectInput(QX11Info::display(), QX11Info::appRootWindow(), PropertyChangeMask );
quit();
}
@ -192,7 +192,7 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
// we only do the multihead fork if we are not restored by the session
// manager, since the session manager will register multiple kwins,
// one for each screen...
QCString multiHead = getenv("KDE_MULTIHEAD");
QByteArray multiHead = getenv("KDE_MULTIHEAD");
if (multiHead.lower() == "true")
{
@ -207,14 +207,14 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
int number_of_screens = ScreenCount( dpy );
KWinInternal::screen_number = DefaultScreen( dpy );
int pos; // temporarily needed to reconstruct DISPLAY var if multi-head
QCString display_name = XDisplayString( dpy );
QByteArray display_name = XDisplayString( dpy );
XCloseDisplay( dpy );
dpy = 0;
if ((pos = display_name.findRev('.')) != -1 )
display_name.remove(pos,10); // 10 is enough to be sure we removed ".s"
QCString envir;
QString envir;
if (number_of_screens != 1)
{
for (int i = 0; i < number_of_screens; i++ )
@ -233,7 +233,7 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
// number. If it had it, it was removed at the "pos" check
envir.sprintf("DISPLAY=%s.%d", display_name.data(), KWinInternal::screen_number);
if (putenv( strdup(envir.data())) )
if (putenv( strdup(envir.toAscii())) )
{
fprintf(stderr,
"%s: WARNING: unable to set DISPLAY environment variable\n",
@ -267,16 +267,16 @@ KDE_EXPORT int kdemain( int argc, char * argv[] )
KWinInternal::SessionManaged weAreIndeed;
KWinInternal::SessionSaveDoneHelper helper;
fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);
fcntl(ConnectionNumber(QX11Info::display()), F_SETFD, 1);
QCString appname;
QString appname;
if (KWinInternal::screen_number == 0)
appname = "kwin";
else
appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);
DCOPClient* client = a.dcopClient();
client->registerAs( appname.data(), false);
client->registerAs( DCOPCString( appname.toAscii() ) , false);
client->setDefaultObject( "KWinInterface" );
return a.exec();

View file

@ -22,10 +22,9 @@ License. See the file "COPYING" for the exact licensing terms.
#include <X11/extensions/shape.h>
#include "notifications.h"
#include <QX11Info>
#include "rules.h"
extern Time qt_x_time;
namespace KWinInternal
{
@ -37,7 +36,7 @@ namespace KWinInternal
bool Client::manage( Window w, bool isMapped )
{
XWindowAttributes attr;
if( !XGetWindowAttributes(qt_xdisplay(), w, &attr))
if( !XGetWindowAttributes(QX11Info::display(), w, &attr))
return false;
grabXServer();
@ -51,7 +50,7 @@ bool Client::manage( Window w, bool isMapped )
// SELI order all these things in some sane manner
bool init_minimize = false;
XWMHints * hints = XGetWMHints(qt_xdisplay(), w );
XWMHints * hints = XGetWMHints(QX11Info::display(), w );
if (hints && (hints->flags & StateHint) && hints->initial_state == IconicState)
init_minimize = true;
if (hints)
@ -77,17 +76,17 @@ bool Client::manage( Window w, bool isMapped )
NET::WM2ExtendedStrut |
0;
info = new WinInfo( this, qt_xdisplay(), client, qt_xrootwin(), properties, 2 );
info = new WinInfo( this, QX11Info::display(), client, QX11Info::appRootWindow(), properties, 2 );
cmap = attr.colormap;
XClassHint classHint;
if ( XGetClassHint( qt_xdisplay(), client, &classHint ) )
if ( XGetClassHint( QX11Info::display(), client, &classHint ) )
{
// Qt3.2 and older had this all lowercase, Qt3.3 capitalized resource class
// force lowercase, so that workarounds listing resource classes still work
resource_name = QCString( classHint.res_name ).lower();
resource_class = QCString( classHint.res_class ).lower();
resource_name = QByteArray( classHint.res_name ).lower();
resource_class = QByteArray( classHint.res_class ).lower();
XFree( classHint.res_name );
XFree( classHint.res_class );
}
@ -307,7 +306,7 @@ bool Client::manage( Window w, bool isMapped )
if(( !isSpecialWindow() || isToolbar()) && isMovable())
keepInArea( area, partial_keep_in_area );
XShapeSelectInput( qt_xdisplay(), window(), ShapeNotifyMask );
XShapeSelectInput( QX11Info::display(), window(), ShapeNotifyMask );
if ( (is_shape = Shape::hasShape( window())) )
{
updateShape();
@ -420,7 +419,7 @@ bool Client::manage( Window w, bool isMapped )
// TODO this should avoid flicker, because real restacking is done
// only after manage() finishes, but the window is shown sooner
// - keep it?
XLowerWindow( qt_xdisplay(), frameId());
XLowerWindow( QX11Info::display(), frameId());
user_time = readUserTimeMapTimestamp( asn_valid ? &asn_id : NULL, asn_valid ? &asn_data : NULL, session );
@ -483,9 +482,9 @@ bool Client::manage( Window w, bool isMapped )
if( user_time == CurrentTime || user_time == -1U ) // no known user time, set something old
{
user_time = qt_x_time - 1000000;
user_time = QX11Info::appTime() - 1000000;
if( user_time == CurrentTime || user_time == -1U ) // let's be paranoid
user_time = qt_x_time - 1000000 + 10;
user_time = QX11Info::appTime() - 1000000 + 10;
}
updateWorkareaDiffs();
@ -515,30 +514,30 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
assert( wrapper == None );
client = w;
// we don't want the window to be destroyed when we are destroyed
XAddToSaveSet( qt_xdisplay(), client );
XSelectInput( qt_xdisplay(), client, NoEventMask );
XUnmapWindow( qt_xdisplay(), client );
XAddToSaveSet( QX11Info::display(), client );
XSelectInput( QX11Info::display(), client, NoEventMask );
XUnmapWindow( QX11Info::display(), client );
XWindowChanges wc; // set the border width to 0
wc.border_width = 0; // TODO possibly save this, and also use it for initial configuring of the window
XConfigureWindow( qt_xdisplay(), client, CWBorderWidth, &wc );
XConfigureWindow( QX11Info::display(), client, CWBorderWidth, &wc );
XSetWindowAttributes swa;
swa.colormap = attr.colormap;
swa.background_pixmap = None;
swa.border_pixel = 0;
frame = XCreateWindow( qt_xdisplay(), qt_xrootwin(), 0, 0, 1, 1, 0,
frame = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), 0, 0, 1, 1, 0,
attr.depth, InputOutput, attr.visual,
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
wrapper = XCreateWindow( qt_xdisplay(), frame, 0, 0, 1, 1, 0,
wrapper = XCreateWindow( QX11Info::display(), frame, 0, 0, 1, 1, 0,
attr.depth, InputOutput, attr.visual,
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
XDefineCursor( qt_xdisplay(), frame, arrowCursor.handle());
XDefineCursor( QX11Info::display(), frame, QCursor( Qt::arrowCursor ).handle());
// some apps are stupid and don't define their own cursor - set the arrow one for them
XDefineCursor( qt_xdisplay(), wrapper, arrowCursor.handle());
XReparentWindow( qt_xdisplay(), client, wrapper, 0, 0 );
XSelectInput( qt_xdisplay(), frame,
XDefineCursor( QX11Info::display(), wrapper, QCursor( Qt::arrowCursor ).handle());
XReparentWindow( QX11Info::display(), client, wrapper, 0, 0 );
XSelectInput( QX11Info::display(), frame,
KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask |
KeymapStateMask |
@ -550,8 +549,8 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
PropertyChangeMask |
StructureNotifyMask | SubstructureRedirectMask |
VisibilityChangeMask );
XSelectInput( qt_xdisplay(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( qt_xdisplay(), client,
XSelectInput( QX11Info::display(), wrapper, ClientWinMask | SubstructureNotifyMask );
XSelectInput( QX11Info::display(), client,
FocusChangeMask |
PropertyChangeMask |
ColormapChangeMask |

View file

@ -99,7 +99,7 @@ bool Notify::raise( Event e, const QString& message, Client* c )
return false; // no connection was possible, don't try each time
QString event = eventToName( e );
if ( !event )
if ( event.isNull() )
return false;
forgetIt= !KNotifyClient::event( c ? c->window() : 0, event, message );
@ -110,7 +110,7 @@ bool Notify::raise( Event e, const QString& message, Client* c )
bool Notify::makeDemandAttention( Event e )
{
QString event = eventToName( e );
if( !event )
if( event.isNull() )
return false;
int rep = KNotifyClient::getPresentation( event );
if( rep == -1 )

View file

@ -20,6 +20,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kglobal.h>
#include <kglobalsettings.h>
#include <qtooltip.h>
#include <QDesktopWidget>
#include "client.h"
@ -210,8 +211,9 @@ unsigned long Options::updateSettings()
desktop_topmenu = kdesktopcfg.readBoolEntry( "ShowMenubar", false );
if( desktop_topmenu )
topmenus = true;
QToolTip::setGloballyEnabled( d->show_tooltips );
// QToolTip::setGloballyEnabled( d->show_tooltips );
// KDE4 this probably needs to be done manually in clients
return changed;
}

View file

@ -14,7 +14,8 @@ License. See the file "COPYING" for the exact licensing terms.
#define KWIN_PLACEMENT_H
#include <qpoint.h>
#include <qvaluelist.h>
#include <QRect>
#include <QList>
namespace KWinInternal
{
@ -77,7 +78,7 @@ class Placement
int row;
};
QValueList<DesktopCascadingInfo> cci;
QList<DesktopCascadingInfo> cci;
Workspace* m_WorkspacePtr;
};

View file

@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include <qcursor.h>
#include <kstringhandler.h>
#include <kglobalsettings.h>
#include <QX11Info>
// specify externals before namespace
@ -75,8 +76,8 @@ void PopupInfo::reset()
void PopupInfo::paintEvent( QPaintEvent* )
{
QPainter p( this );
style().drawPrimitive( QStyle::PE_Panel, &p, QRect( 0, 0, width(), height() ),
colorGroup(), QStyle::Style_Default );
#warning Somebody with QStyle knowledge, please fix.
// style()->drawPrimitive( QStyle::PE_Frame, &p, QRect( 0, 0, width(), height() ), colorGroup(), QStyle::Style_Default );
paintContents();
}
@ -100,7 +101,7 @@ void PopupInfo::paintContents()
p.drawText( r, AlignCenter, m_infoString );
r.moveBy( -1, 0 );
*/
p.drawText( r, AlignCenter, m_infoString );
p.drawText( r, Qt::AlignCenter, m_infoString );
}
void PopupInfo::hide()
@ -109,7 +110,7 @@ void PopupInfo::hide()
QWidget::hide();
QApplication::syncX();
XEvent otherEvent;
while (XCheckTypedEvent (qt_xdisplay(), EnterNotify, &otherEvent ) )
while (XCheckTypedEvent (QX11Info::display(), EnterNotify, &otherEvent ) )
;
m_shown = false;
}

View file

@ -13,7 +13,6 @@ License. See the file "COPYING" for the exact licensing terms.
#define KWIN_POPUPINFO_H
#include <qwidget.h>
#include <qtimer.h>
#include <qvaluelist.h>
namespace KWinInternal
{

View file

@ -70,7 +70,7 @@ Rules::Rules( const QString& str, bool temporary )
QFile* f = file.file();
if( f != NULL )
{
QCString s = str.utf8();
QByteArray s = str.utf8();
f->writeBlock( s.data(), s.length());
}
file.close();
@ -83,7 +83,8 @@ Rules::Rules( const QString& str, bool temporary )
#define READ_MATCH_STRING( var, func ) \
var = cfg.readEntry( #var ) func; \
var##match = (StringMatch) QMAX( FirstStringMatch, QMIN( LastStringMatch, cfg.readNumEntry( #var "match" )));
var##match = (StringMatch) QMAX( FirstStringMatch, \
QMIN( LastStringMatch, static_cast< StringMatch >( cfg.readNumEntry( #var "match" ))));
#define READ_SET_RULE( var, type, func ) \
var = func ( cfg.read##type##Entry( #var )); \
@ -323,11 +324,11 @@ bool Rules::matchType( NET::WindowType match_type ) const
return true;
}
bool Rules::matchWMClass( const QCString& match_class, const QCString& match_name ) const
bool Rules::matchWMClass( const QByteArray& match_class, const QByteArray& match_name ) const
{
if( wmclassmatch != UnimportantMatch )
{ // TODO optimize?
QCString cwmclass = wmclasscomplete
QByteArray cwmclass = wmclasscomplete
? match_name + ' ' + match_class : match_class;
if( wmclassmatch == RegExpMatch && QRegExp( wmclass ).search( cwmclass ) == -1 )
return false;
@ -339,7 +340,7 @@ bool Rules::matchWMClass( const QCString& match_class, const QCString& match_nam
return true;
}
bool Rules::matchRole( const QCString& match_role ) const
bool Rules::matchRole( const QByteArray& match_role ) const
{
if( windowrolematch != UnimportantMatch )
{
@ -367,7 +368,7 @@ bool Rules::matchTitle( const QString& match_title ) const
return true;
}
bool Rules::matchClientMachine( const QCString& match_machine ) const
bool Rules::matchClientMachine( const QByteArray& match_machine ) const
{
if( clientmachinematch != UnimportantMatch )
{
@ -679,8 +680,8 @@ kdbgstream& operator<<( kdbgstream& stream, const Rules* r )
#ifndef KCMRULES
void WindowRules::discardTemporary()
{
QValueVector< Rules* >::Iterator it2 = rules.begin();
for( QValueVector< Rules* >::Iterator it = rules.begin();
QVector< Rules* >::Iterator it2 = rules.begin();
for( QVector< Rules* >::Iterator it = rules.begin();
it != rules.end();
)
{
@ -697,7 +698,7 @@ void WindowRules::discardTemporary()
void WindowRules::update( Client* c )
{
bool updated = false;
for( QValueVector< Rules* >::ConstIterator it = rules.begin();
for( QVector< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
if( (*it)->update( c )) // no short-circuiting here
@ -712,7 +713,7 @@ type WindowRules::check##rule( type arg, bool init ) const \
if( rules.count() == 0 ) \
return arg; \
type ret = arg; \
for( QValueVector< Rules* >::ConstIterator it = rules.begin(); \
for( QVector< Rules* >::ConstIterator it = rules.begin(); \
it != rules.end(); \
++it ) \
{ \
@ -728,7 +729,7 @@ type WindowRules::check##rule( type arg ) const \
if( rules.count() == 0 ) \
return arg; \
type ret = arg; \
for( QValueVector< Rules* >::ConstIterator it = rules.begin(); \
for( QVector< Rules* >::ConstIterator it = rules.begin(); \
it != rules.end(); \
++it ) \
{ \
@ -888,8 +889,8 @@ void Client::checkAndSetInitialRuledOpacity()
WindowRules Workspace::findWindowRules( const Client* c, bool ignore_temporary )
{
QValueVector< Rules* > ret;
for( QValueList< Rules* >::Iterator it = rules.begin();
QVector< Rules* > ret;
for( QList< Rules* >::Iterator it = rules.begin();
it != rules.end();
)
{
@ -947,7 +948,7 @@ void Workspace::writeWindowRules()
cfg.setGroup( "General" );
cfg.writeEntry( "count", rules.count());
int i = 1;
for( QValueList< Rules* >::ConstIterator it = rules.begin();
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
{
@ -962,7 +963,7 @@ void Workspace::writeWindowRules()
void Workspace::gotTemporaryRulesMessage( const QString& message )
{
bool was_temporary = false;
for( QValueList< Rules* >::ConstIterator it = rules.begin();
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
++it )
if( (*it)->isTemporary())
@ -976,7 +977,7 @@ void Workspace::gotTemporaryRulesMessage( const QString& message )
void Workspace::cleanupTemporaryRules()
{
bool has_temporary = false;
for( QValueList< Rules* >::Iterator it = rules.begin();
for( QList< Rules* >::Iterator it = rules.begin();
it != rules.end();
)
{
@ -995,7 +996,7 @@ void Workspace::cleanupTemporaryRules()
void Workspace::discardUsedWindowRules( Client* c, bool withdrawn )
{
for( QValueList< Rules* >::Iterator it = rules.begin();
for( QList< Rules* >::Iterator it = rules.begin();
it != rules.end();
)
{

23
rules.h
View file

@ -14,7 +14,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include <qstring.h>
#include <netwm_def.h>
#include <qrect.h>
#include <qvaluevector.h>
#include <kdebug.h>
#include "placement.h"
@ -36,7 +35,7 @@ class WindowRules
: public KDecorationDefines
{
public:
WindowRules( const QValueVector< Rules* >& rules );
WindowRules( const QVector< Rules* >& rules );
WindowRules();
void update( Client* );
void discardTemporary();
@ -72,7 +71,7 @@ class WindowRules
private:
MaximizeMode checkMaximizeVert( MaximizeMode mode, bool init ) const;
MaximizeMode checkMaximizeHoriz( MaximizeMode mode, bool init ) const;
QValueVector< Rules* > rules;
QVector< Rules* > rules;
};
#endif
@ -122,10 +121,10 @@ class Rules
private:
#endif
bool matchType( NET::WindowType match_type ) const;
bool matchWMClass( const QCString& match_class, const QCString& match_name ) const;
bool matchRole( const QCString& match_role ) const;
bool matchWMClass( const QByteArray& match_class, const QByteArray& match_name ) const;
bool matchRole( const QByteArray& match_role ) const;
bool matchTitle( const QString& match_title ) const;
bool matchClientMachine( const QCString& match_machine ) const;
bool matchClientMachine( const QByteArray& match_machine ) const;
// All these values are saved to the cfg file, and are also used in kstart!
enum
{
@ -168,16 +167,16 @@ class Rules
#endif
int temporary_state; // e.g. for kstart
QString description;
QCString wmclass;
QByteArray wmclass;
StringMatch wmclassmatch;
bool wmclasscomplete;
QCString windowrole;
QByteArray windowrole;
StringMatch windowrolematch;
QString title; // TODO "caption" ?
StringMatch titlematch;
QCString extrarole;
QByteArray extrarole;
StringMatch extrarolematch;
QCString clientmachine;
QByteArray clientmachine;
StringMatch clientmachinematch;
unsigned long types; // types for matching
Placement::Policy placement;
@ -267,7 +266,7 @@ bool Rules::checkForceStop( ForceRule rule )
}
inline
WindowRules::WindowRules( const QValueVector< Rules* >& r )
WindowRules::WindowRules( const QVector< Rules* >& r )
: rules( r )
{
}
@ -286,7 +285,7 @@ bool WindowRules::contains( const Rules* rule ) const
inline
void WindowRules::remove( Rules* rule )
{
QValueVector< Rules* >::Iterator pos = qFind( rules.begin(), rules.end(), rule );
QVector< Rules* >::Iterator pos = qFind( rules.begin(), rules.end(), rule );
if( pos != rules.end())
rules.erase( pos );
}

81
sm.cpp
View file

@ -11,8 +11,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include "sm.h"
#include <qsocketnotifier.h>
#include <qsessionmanager.h>
#include <kdebug.h>
#include <unistd.h>
#include <stdlib.h>
@ -23,6 +21,8 @@ License. See the file "COPYING" for the exact licensing terms.
#include "workspace.h"
#include "client.h"
#include <qsocketnotifier.h>
#include <qsessionmanager.h>
namespace KWinInternal
{
@ -75,8 +75,8 @@ void Workspace::storeSession( KConfig* config, SMSavePhase phase )
for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it)
{
Client* c = (*it);
QCString sessionId = c->sessionId();
QCString wmCommand = c->wmCommand();
QByteArray sessionId = c->sessionId();
QByteArray wmCommand = c->wmCommand();
if ( sessionId.isEmpty() )
// remember also applications that are not XSMP capable
// and use the obsolete WM_COMMAND / WM_SAVE_YOURSELF
@ -195,44 +195,53 @@ void Workspace::loadSessionInfo()
SessionInfo* Workspace::takeSessionInfo( Client* c )
{
SessionInfo *realInfo = 0;
QCString sessionId = c->sessionId();
QCString windowRole = c->windowRole();
QCString wmCommand = c->wmCommand();
QCString wmClientMachine = c->wmClientMachine( true );
QCString resourceName = c->resourceName();
QCString resourceClass = c->resourceClass();
QByteArray sessionId = c->sessionId();
QByteArray windowRole = c->windowRole();
QByteArray wmCommand = c->wmCommand();
QByteArray wmClientMachine = c->wmClientMachine( true );
QByteArray resourceName = c->resourceName();
QByteArray resourceClass = c->resourceClass();
// First search ``session''
if (! sessionId.isEmpty() )
{
// look for a real session managed client (algorithm suggested by ICCCM)
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
if ( info->sessionId == sessionId && sessionInfoWindowTypeMatch( c, info ))
{
if ( ! windowRole.isEmpty() )
{
if ( info->windowRole == windowRole )
realInfo = session.take();
}
else
{
if ( info->windowRole.isEmpty() &&
info->resourceName == resourceName &&
info->resourceClass == resourceClass )
realInfo = session.take();
}
}
// look for a real session managed client (algorithm suggested by ICCCM)
foreach( SessionInfo* info, session ) {
if ( realInfo )
break;
if ( info->sessionId == sessionId && sessionInfoWindowTypeMatch( c, info ))
{
if ( ! windowRole.isEmpty() )
{
if ( info->windowRole == windowRole )
realInfo = info;
session.remove(info);
}
else
{
if ( info->windowRole.isEmpty() &&
info->resourceName == resourceName &&
info->resourceClass == resourceClass )
realInfo = info;
session.remove(info);
}
}
}
}
else
{
// look for a sessioninfo with matching features.
for (SessionInfo* info = session.first(); info && !realInfo; info = session.next() )
if ( info->resourceName == resourceName &&
info->resourceClass == resourceClass &&
info->wmClientMachine == wmClientMachine &&
sessionInfoWindowTypeMatch( c, info ))
if ( wmCommand.isEmpty() || info->wmCommand == wmCommand )
realInfo = session.take();
// look for a sessioninfo with matching features.
foreach( SessionInfo* info, session ) {
if ( realInfo ) break;
if ( info->resourceName == resourceName &&
info->resourceClass == resourceClass &&
info->wmClientMachine == wmClientMachine &&
sessionInfoWindowTypeMatch( c, info ))
if ( wmCommand.isEmpty() || info->wmCommand == wmCommand ) {
realInfo = info;
session.remove( info );
}
}
}
return realInfo;
@ -253,7 +262,7 @@ bool Workspace::sessionInfoWindowTypeMatch( Client* c, SessionInfo* info )
// of <appname>-mainwindow#<number>
// when comparing them for fake session info, it's probably better to check
// them without the trailing number
bool Workspace::windowRoleMatch( const QCString& role1, const QCString& role2 )
bool Workspace::windowRoleMatch( const QByteArray& role1, const QByteArray& role2 )
{
if( role1.isEmpty() && role2.isEmpty())
return true;

13
sm.h
View file

@ -12,6 +12,7 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_SM_H
#define KWIN_SM_H
#include <QDataStream>
#include <X11/SM/SMlib.h>
#include <kapplication.h>
#include <netwm_def.h>
@ -23,12 +24,12 @@ namespace KWinInternal
struct SessionInfo
{
QCString sessionId;
QCString windowRole;
QCString wmCommand;
QCString wmClientMachine;
QCString resourceName;
QCString resourceClass;
QByteArray sessionId;
QByteArray windowRole;
QByteArray wmCommand;
QByteArray wmClientMachine;
QByteArray resourceName;
QByteArray resourceClass;
QRect geometry;
QRect restore;

View file

@ -33,18 +33,17 @@ License. See the file "COPYING" for the exact licensing terms.
#include <kiconeffect.h>
#include <X11/keysym.h>
#include <X11/keysymdef.h>
#include <QX11Info>
// specify externals before namespace
extern Time qt_x_time;
namespace KWinInternal
{
extern QPixmap* kwin_get_menu_pix_hack();
TabBox::TabBox( Workspace *ws, const char *name )
: QFrame( 0, name, Qt::WNoAutoErase ), client(0), wspace(ws)
: Q3Frame( 0, name, Qt::WNoAutoErase ), client(0), wspace(ws)
{
setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
setLineWidth(2);
@ -347,7 +346,7 @@ void TabBox::drawContents( QPainter * )
f.setPointSize( 14 );
p.setFont(f);
p.drawText( r, AlignCenter, no_tasks);
p.drawText( r, Qt::AlignCenter, no_tasks);
}
else
{
@ -483,14 +482,14 @@ void TabBox::drawContents( QPainter * )
ClientList list;
createClientList(list, iDesktop, 0, false);
// clients are in reversed stacking order
for (ClientList::ConstIterator it = list.fromLast(); it != list.end(); --it)
for ( int i = list.size() - 1; i>=0; i-- )
{
if ( !(*it)->miniIcon().isNull() )
if ( !list.at( i )->miniIcon().isNull() )
{
if ( x1+18 >= x+r.width() ) // only show full icons
break;
p.drawPixmap( x1, y + (lineHeight - 16)/2, (*it)->miniIcon() );
p.drawPixmap( x1, y + (lineHeight - 16)/2, list.at( i )->miniIcon() );
x1 += 18;
}
}
@ -515,7 +514,7 @@ void TabBox::hide()
QWidget::hide();
QApplication::syncX();
XEvent otherEvent;
while (XCheckTypedEvent (qt_xdisplay(), EnterNotify, &otherEvent ) )
while (XCheckTypedEvent (QX11Info::display(), EnterNotify, &otherEvent ) )
;
}
@ -564,7 +563,7 @@ void TabBox::delayedShow()
void TabBox::handleMouseEvent( XEvent* e )
{
XAllowEvents( qt_xdisplay(), AsyncPointer, qt_x_time );
XAllowEvents( QX11Info::display(), AsyncPointer, QX11Info::appTime() );
if( e->type != ButtonPress )
return;
QPoint pos( e->xbutton.x_root, e->xbutton.y_root );
@ -629,12 +628,12 @@ bool areKeySymXsDepressed( bool bAll, const uint keySyms[], int nKeySyms )
kdDebug(125) << "areKeySymXsDepressed: " << (bAll ? "all of " : "any of ") << nKeySyms << endl;
XQueryKeymap( qt_xdisplay(), keymap );
XQueryKeymap( QX11Info::display(), keymap );
for( int iKeySym = 0; iKeySym < nKeySyms; iKeySym++ )
{
uint keySymX = keySyms[ iKeySym ];
uchar keyCodeX = XKeysymToKeycode( qt_xdisplay(), keySymX );
uchar keyCodeX = XKeysymToKeycode( QX11Info::display(), keySymX );
int i = keyCodeX / 8;
char mask = 1 << (keyCodeX - (i * 8));
@ -721,7 +720,7 @@ void TabBox::updateKeyMapping()
{
const int size = 6;
uint keysyms[ size ] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, XK_Meta_L, XK_Meta_R };
XModifierKeymap* map = XGetModifierMapping( qt_xdisplay() );
XModifierKeymap* map = XGetModifierMapping( QX11Info::display() );
int altpos = 0;
int winpos = 0;
int winmodpos = -1;
@ -739,7 +738,7 @@ void TabBox::updateKeyMapping()
i < size;
++i )
{
KeyCode keycode = XKeysymToKeycode( qt_xdisplay(), keysyms[ i ] );
KeyCode keycode = XKeysymToKeycode( QX11Info::display(), keysyms[ i ] );
for( int j = 0;
j < map->max_keypermod;
++j )
@ -757,13 +756,13 @@ void TabBox::updateKeyMapping()
void Workspace::slotWalkThroughWindows()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if ( tab_grab || control_grab )
return;
if ( options->altTabStyle == Options::CDE )
{
//XUngrabKeyboard(qt_xdisplay(), qt_x_time); // need that because of accelerator raw mode
//XUngrabKeyboard(QX11Info::display(), QX11Info::appTime()); // need that because of accelerator raw mode
// CDE style raise / lower
CDEWalkThroughWindows( true );
}
@ -783,7 +782,7 @@ void Workspace::slotWalkThroughWindows()
void Workspace::slotWalkBackThroughWindows()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -808,7 +807,7 @@ void Workspace::slotWalkBackThroughWindows()
void Workspace::slotWalkThroughDesktops()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -825,7 +824,7 @@ void Workspace::slotWalkThroughDesktops()
void Workspace::slotWalkBackThroughDesktops()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -842,7 +841,7 @@ void Workspace::slotWalkBackThroughDesktops()
void Workspace::slotWalkThroughDesktopList()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -859,7 +858,7 @@ void Workspace::slotWalkThroughDesktopList()
void Workspace::slotWalkBackThroughDesktopList()
{
if ( root != qt_xrootwin() )
if ( root != QX11Info::appRootWindow() )
return;
if( tab_grab || control_grab )
return;
@ -1078,7 +1077,7 @@ void Workspace::tabBoxKeyRelease( const XKeyEvent& ev )
release = true;
else
{
XModifierKeymap* xmk = XGetModifierMapping(qt_xdisplay());
XModifierKeymap* xmk = XGetModifierMapping(QX11Info::display());
for (int i=0; i<xmk->max_keypermod; i++)
if (xmk->modifiermap[xmk->max_keypermod * mod_index + i]
== ev.keycode)
@ -1118,7 +1117,7 @@ void Workspace::tabBoxKeyRelease( const XKeyEvent& ev )
int Workspace::nextDesktopFocusChain( int iDesktop ) const
{
int i = desktop_focus_chain.find( iDesktop );
int i = desktop_focus_chain.indexOf( iDesktop );
if( i >= 0 && i+1 < (int)desktop_focus_chain.size() )
return desktop_focus_chain[i+1];
else if( desktop_focus_chain.size() > 0 )
@ -1129,7 +1128,7 @@ int Workspace::nextDesktopFocusChain( int iDesktop ) const
int Workspace::previousDesktopFocusChain( int iDesktop ) const
{
int i = desktop_focus_chain.find( iDesktop );
int i = desktop_focus_chain.indexOf( iDesktop );
if( i-1 >= 0 )
return desktop_focus_chain[i-1];
else if( desktop_focus_chain.size() > 0 )
@ -1207,8 +1206,8 @@ Client* Workspace::previousStaticClient( Client* c ) const
bool Workspace::establishTabBoxGrab()
{
if( XGrabKeyboard( qt_xdisplay(), root, FALSE,
GrabModeAsync, GrabModeAsync, qt_x_time) != GrabSuccess )
if( XGrabKeyboard( QX11Info::display(), root, FALSE,
GrabModeAsync, GrabModeAsync, QX11Info::appTime()) != GrabSuccess )
return false;
// Don't try to establish a global mouse grab using XGrabPointer, as that would prevent
// using Alt+Tab while DND (#44972). However force passive grabs on all windows
@ -1224,7 +1223,7 @@ bool Workspace::establishTabBoxGrab()
void Workspace::removeTabBoxGrab()
{
XUngrabKeyboard(qt_xdisplay(), qt_x_time);
XUngrabKeyboard(QX11Info::display(), QX11Info::appTime());
assert( forced_global_mouse_grab );
forced_global_mouse_grab = false;
if( active_client != NULL )

View file

@ -12,9 +12,8 @@ License. See the file "COPYING" for the exact licensing terms.
#ifndef KWIN_TABBOX_H
#define KWIN_TABBOX_H
#include <qframe.h>
#include <Q3Frame>
#include <qtimer.h>
#include <qvaluelist.h>
#include "utils.h"
class QLabel;
@ -25,7 +24,7 @@ namespace KWinInternal
class Workspace;
class Client;
class TabBox : public QFrame
class TabBox : public Q3Frame
{
Q_OBJECT
public:

View file

@ -34,6 +34,7 @@
#include <kdecorationfactory.h>
#include <kdecoration_plugins_p.h>
#include <QX11Info>
// FRAME the preview doesn't update to reflect the changes done in the kcm
@ -140,7 +141,7 @@ void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode )
// FRAME duped from client.cpp
if( mode == Unsorted )
{
XShapeCombineRegion( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
XShapeCombineRegion( QX11Info::display(), widget->winId(), ShapeBounding, 0, 0,
reg.handle(), ShapeSet );
}
else
@ -156,7 +157,7 @@ void KDecorationPreview::setPreviewMask( const QRegion& reg, int mode )
xrects[ i ].width = rects[ i ].width();
xrects[ i ].height = rects[ i ].height();
}
XShapeCombineRectangles( qt_xdisplay(), widget->winId(), ShapeBounding, 0, 0,
XShapeCombineRectangles( QX11Info::display(), widget->winId(), ShapeBounding, 0, 0,
xrects, rects.count(), ShapeSet, mode );
delete[] xrects;
}

Some files were not shown because too many files have changed in this diff Show more