diff --git a/README b/README index ab4a847699..70ba517470 100644 --- a/README +++ b/README @@ -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. diff --git a/activation.cpp b/activation.cpp index 44e5b004e7..135b1da8a1 100644 --- a/activation.cpp +++ b/activation.cpp @@ -20,7 +20,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "workspace.h" #include -#include #include #include #include @@ -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 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 diff --git a/atoms.cpp b/atoms.cpp index 334afe5266..179f70adf5 100644 --- a/atoms.cpp +++ b/atoms.cpp @@ -13,6 +13,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include "atoms.h" #include +#include 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]; } diff --git a/atoms.h b/atoms.h index caed47b79f..966a8d324e 100644 --- a/atoms.h +++ b/atoms.h @@ -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; diff --git a/bridge.cpp b/bridge.cpp index 6b37c0eaad..4457c3da08 100644 --- a/bridge.cpp +++ b/bridge.cpp @@ -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 diff --git a/client.cpp b/client.cpp index a159459216..d10afdf676 100644 --- a/client.cpp +++ b/client.cpp @@ -30,15 +30,11 @@ License. See the file "COPYING" for the exact licensing terms. #include "rules.h" #include +#include // 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 diff --git a/client.h b/client.h index bcc1794e79..7b26d91d50 100644 --- a/client.h +++ b/client.h @@ -13,7 +13,6 @@ License. See the file "COPYING" for the exact licensing terms. #define KWIN_CLIENT_H #include -#include #include #include #include @@ -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; } diff --git a/clients/b2/Makefile.am b/clients/b2/Makefile.am index 88a9b16080..9264b2ba7f 100644 --- a/clients/b2/Makefile.am +++ b/clients/b2/Makefile.am @@ -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 diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp index aaa11aa6f5..238d5862dc 100644 --- a/clients/b2/b2client.cpp +++ b/clients/b2/b2client.cpp @@ -14,6 +14,17 @@ #include #include #include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -26,6 +37,7 @@ #include #include +#include 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 { diff --git a/clients/b2/b2client.h b/clients/b2/b2client.h index eb987f24e4..59bc5720cb 100644 --- a/clients/b2/b2client.h +++ b/clients/b2/b2client.h @@ -11,8 +11,16 @@ #include #include -#include +#include #include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -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; }; } diff --git a/clients/b2/config/config.cpp b/clients/b2/config/config.cpp index d16a903070..5a71a54df1 100644 --- a/clients/b2/config/config.cpp +++ b/clients/b2/config/config.cpp @@ -8,8 +8,10 @@ #include "config.h" #include -#include -#include + +#include +//Added by qt3to4: +#include #include @@ -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.")); diff --git a/clients/b2/config/config.h b/clients/b2/config/config.h index 9985f3f4f6..dac46c7ea0 100644 --- a/clients/b2/config/config.h +++ b/clients/b2/config/config.h @@ -10,8 +10,7 @@ #define _KDE_B2CONFIG_H #include -#include -#include +#include #include #include #include @@ -40,7 +39,7 @@ class B2Config: public QObject KConfig* b2Config; QCheckBox* cbColorBorder; QCheckBox* showGrabHandleCb; - QHGroupBox* actionsGB; + Q3GroupBox* actionsGB; QComboBox* menuDblClickOp; QWidget* gb; }; diff --git a/clients/default/Makefile.am b/clients/default/Makefile.am index 3f9b1e7e78..2cd0895d28 100644 --- a/clients/default/Makefile.am +++ b/clients/default/Makefile.am @@ -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 diff --git a/clients/default/config/config.cpp b/clients/default/config/config.cpp index 2ad494fa91..f562d7eb03 100644 --- a/clients/default/config/config.cpp +++ b/clients/default/config/config.cpp @@ -13,7 +13,6 @@ #include #include #include -#include 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 ); diff --git a/clients/default/config/config.h b/clients/default/config/config.h index 248d851dff..68991e26f7 100644 --- a/clients/default/config/config.h +++ b/clients/default/config/config.h @@ -13,9 +13,8 @@ #include #include #include -#include #include -#include +#include class KDEDefaultConfig: public QObject { @@ -41,7 +40,7 @@ class KDEDefaultConfig: public QObject QCheckBox* cbShowStipple; QCheckBox* cbShowGrabBar; QCheckBox* cbUseGradients; - QVBox* gb; + Q3VBox* gb; bool highcolor; }; diff --git a/clients/default/kdedefault.cpp b/clients/default/kdedefault.cpp index 243d364569..357de37b45 100644 --- a/clients/default/kdedefault.cpp +++ b/clients/default/kdedefault.cpp @@ -26,6 +26,7 @@ #include #include #include +#include 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 ); diff --git a/clients/default/kdedefault.h b/clients/default/kdedefault.h index 53ad23fa2e..e37f225002 100644 --- a/clients/default/kdedefault.h +++ b/clients/default/kdedefault.h @@ -13,7 +13,6 @@ #ifndef _KDE_DEFAULT_H #define _KDE_DEFAULT_H -#include #include #include #include @@ -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: diff --git a/clients/keramik/Makefile.am b/clients/keramik/Makefile.am index d5969643c2..a06593f69d 100644 --- a/clients/keramik/Makefile.am +++ b/clients/keramik/Makefile.am @@ -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 diff --git a/clients/keramik/config/keramikconfig.ui b/clients/keramik/config/keramikconfig.ui index f074a00b8a..42f020075a 100644 --- a/clients/keramik/config/keramikconfig.ui +++ b/clients/keramik/config/keramikconfig.ui @@ -68,9 +68,5 @@ - - kdialog.h - - diff --git a/clients/keramik/embedtool.cpp b/clients/keramik/embedtool.cpp deleted file mode 100644 index 01972be1cc..0000000000 --- a/clients/keramik/embedtool.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Keramik KWin embed tool (version 1.0) - * - * Copyright (C) 2002 Fredrik Höglund - * - * 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 -#include -#include -#include -#include -#include - -#include - -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 *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 \n"; - stream << "#include \n\n"; - stream << "namespace Keramik {\n\n"; - - index = new QPtrList; - 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( 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 *db;\n\n"; - stream << "\t\tKeramikImageDb() {\n"; - stream << "\t\t\tdb = new QDict( " << 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: - diff --git a/clients/keramik/keramik.cpp b/clients/keramik/keramik.cpp index 933f1949fc..c03c4d2560 100644 --- a/clients/keramik/keramik.cpp +++ b/clients/keramik/keramik.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include @@ -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(); } diff --git a/clients/keramik/keramik.h b/clients/keramik/keramik.h index 6a6744981c..dc5ceb3a32 100644 --- a/clients/keramik/keramik.h +++ b/clients/keramik/keramik.h @@ -24,12 +24,10 @@ #ifndef __KERAMIK_H #define __KERAMIK_H -#include +#include #include #include -#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 diff --git a/clients/keramik/tiles.qrc b/clients/keramik/tiles.qrc new file mode 100644 index 0000000000..e6a12e4169 --- /dev/null +++ b/clients/keramik/tiles.qrc @@ -0,0 +1,27 @@ + + + pics/border-left.png + pics/border-right.png + pics/bottom-center.png + pics/bottom-left.png + pics/bottom-right.png + pics/caption-large-center.png + pics/caption-large-left.png + pics/caption-large-right.png + pics/caption-small-center.png + pics/caption-small-left.png + pics/caption-small-right.png + pics/grabbar-center.png + pics/grabbar-left.png + pics/grabbar-right.png + pics/titlebar-center.png + pics/titlebar-left.png + pics/titlebar-right.png + pics/titlebutton-round-huge.png + pics/titlebutton-round-large.png + pics/titlebutton-round.png + pics/titlebutton-square-huge.png + pics/titlebutton-square-large.png + pics/titlebutton-square.png + + diff --git a/clients/laptop/Makefile.am b/clients/laptop/Makefile.am index eb870720aa..0c134fd557 100644 --- a/clients/laptop/Makefile.am +++ b/clients/laptop/Makefile.am @@ -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 diff --git a/clients/laptop/laptopclient.cpp b/clients/laptop/laptopclient.cpp index 1ff51694e9..7463f7dabd 100644 --- a/clients/laptop/laptopclient.cpp +++ b/clients/laptop/laptopclient.cpp @@ -9,6 +9,9 @@ #include // up here to avoid X11 header conflict :P #include "laptopclient.h" #include +//Added by qt3to4: +#include +#include #include #include #include @@ -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; } diff --git a/clients/laptop/laptopclient.h b/clients/laptop/laptopclient.h index dae83236f1..f09fd5e747 100644 --- a/clients/laptop/laptopclient.h +++ b/clients/laptop/laptopclient.h @@ -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(); }; diff --git a/clients/modernsystem/Makefile.am b/clients/modernsystem/Makefile.am index 75e0249f8e..2d9e5c5260 100644 --- a/clients/modernsystem/Makefile.am +++ b/clients/modernsystem/Makefile.am @@ -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 diff --git a/clients/modernsystem/config/config.cpp b/clients/modernsystem/config/config.cpp index 542494d28f..e66cb7ccd2 100644 --- a/clients/modernsystem/config/config.cpp +++ b/clients/modernsystem/config/config.cpp @@ -6,7 +6,11 @@ #include #include #include -#include + +//Added by qt3to4: +#include +#include +#include #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)); } diff --git a/clients/modernsystem/config/config.h b/clients/modernsystem/config/config.h index 4f4b97123c..6ae0567187 100644 --- a/clients/modernsystem/config/config.h +++ b/clients/modernsystem/config/config.h @@ -2,11 +2,13 @@ #define __KDE_MODSYSTEMCONFIG_H #include -#include +#include #include -#include +#include #include #include +//Added by qt3to4: +#include 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; diff --git a/clients/modernsystem/modernsys.cpp b/clients/modernsystem/modernsys.cpp index d758163432..ded060b0be 100644 --- a/clients/modernsystem/modernsys.cpp +++ b/clients/modernsystem/modernsys.cpp @@ -6,6 +6,9 @@ #include #include #include +//Added by qt3to4: +#include +#include #include #include #include @@ -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 diff --git a/clients/modernsystem/modernsys.h b/clients/modernsystem/modernsys.h index d185be0480..8baf861621 100644 --- a/clients/modernsystem/modernsys.h +++ b/clients/modernsystem/modernsys.h @@ -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(); }; diff --git a/clients/plastik/plastik.cpp b/clients/plastik/plastik.cpp index ffedae56c9..e40d022acd 100644 --- a/clients/plastik/plastik.cpp +++ b/clients/plastik/plastik.cpp @@ -33,6 +33,7 @@ #include "plastik.moc" #include "plastikclient.h" #include "plastikbutton.h" +#include 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; } diff --git a/clients/plastik/plastik.h b/clients/plastik/plastik.h index 48251e6601..a5cda7d59d 100644 --- a/clients/plastik/plastik.h +++ b/clients/plastik/plastik.h @@ -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... diff --git a/clients/plastik/plastikbutton.cpp b/clients/plastik/plastikbutton.cpp index 6bad77dbaf..b2bc30d7cc 100644 --- a/clients/plastik/plastikbutton.cpp +++ b/clients/plastik/plastikbutton.cpp @@ -22,6 +22,7 @@ // #include +#include #include #include #include @@ -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(); diff --git a/clients/plastik/plastikbutton.h b/clients/plastik/plastikbutton.h index bfe762f313..265de94d5c 100644 --- a/clients/plastik/plastikbutton.h +++ b/clients/plastik/plastikbutton.h @@ -23,7 +23,6 @@ #ifndef PLASTIKBUTTON_H #define PLASTIKBUTTON_H -#include #include #include "plastik.h" diff --git a/clients/plastik/plastikclient.cpp b/clients/plastik/plastikclient.cpp index 4698ded19f..0073c402a5 100644 --- a/clients/plastik/plastikclient.cpp +++ b/clients/plastik/plastikclient.cpp @@ -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); diff --git a/clients/quartz/config/config.cpp b/clients/quartz/config/config.cpp index 8c7070b9d0..04d2230b3c 100644 --- a/clients/quartz/config/config.cpp +++ b/clients/quartz/config/config.cpp @@ -9,7 +9,7 @@ #include "config.h" #include -#include + #include @@ -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 ); diff --git a/clients/quartz/config/config.h b/clients/quartz/config/config.h index 815cc96440..426e3b806e 100644 --- a/clients/quartz/config/config.h +++ b/clients/quartz/config/config.h @@ -11,7 +11,7 @@ #define __KDE_QUARTZCONFIG_H #include -#include +#include #include class QuartzConfig: public QObject @@ -38,7 +38,7 @@ class QuartzConfig: public QObject KConfig* quartzConfig; QCheckBox* cbColorBorder; QCheckBox* cbExtraSmall; - QVBox* gb; + Q3VBox* gb; }; diff --git a/clients/quartz/quartz.cpp b/clients/quartz/quartz.cpp index 8579717801..fffd07873d 100644 --- a/clients/quartz/quartz.cpp +++ b/clients/quartz/quartz.cpp @@ -25,6 +25,9 @@ #include #include "quartz.h" +//Added by qt3to4: +#include +#include 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 ); diff --git a/clients/quartz/quartz.h b/clients/quartz/quartz.h index 37f3dff6e1..4ca0dd6f15 100644 --- a/clients/quartz/quartz.h +++ b/clients/quartz/quartz.h @@ -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(); diff --git a/clients/redmond/Makefile.am b/clients/redmond/Makefile.am index 85d0236d20..86115be9c1 100644 --- a/clients/redmond/Makefile.am +++ b/clients/redmond/Makefile.am @@ -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 diff --git a/clients/redmond/redmond.cpp b/clients/redmond/redmond.cpp index e41eb63532..913beb11fa 100644 --- a/clients/redmond/redmond.cpp +++ b/clients/redmond/redmond.cpp @@ -16,6 +16,9 @@ #include #include +//Added by qt3to4: +#include +#include #include #include #include @@ -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; } diff --git a/clients/redmond/redmond.h b/clients/redmond/redmond.h index 340fdd1b00..8844e3bedc 100644 --- a/clients/redmond/redmond.h +++ b/clients/redmond/redmond.h @@ -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(); }; diff --git a/clients/web/Web.cpp b/clients/web/Web.cpp index 568978a96d..8f41dbf5cd 100644 --- a/clients/web/Web.cpp +++ b/clients/web/Web.cpp @@ -21,6 +21,8 @@ */ #include +//Added by qt3to4: +#include #include @@ -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; } diff --git a/clients/web/Web.h b/clients/web/Web.h index 2dde0029c2..1506c31adc 100644 --- a/clients/web/Web.h +++ b/clients/web/Web.h @@ -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; }; } diff --git a/clients/web/WebButton.cpp b/clients/web/WebButton.cpp index f06928a3b3..75fce5de52 100644 --- a/clients/web/WebButton.cpp +++ b/clients/web/WebButton.cpp @@ -20,6 +20,8 @@ */ #include +//Added by qt3to4: +#include #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_); diff --git a/data/update_window_settings.cpp b/data/update_window_settings.cpp index 694ce8264b..2be4b3a4bc 100644 --- a/data/update_window_settings.cpp +++ b/data/update_window_settings.cpp @@ -14,15 +14,19 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +//Added by qt3to4: +#include +#include 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 fakeSession; +Q3PtrList 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()); } diff --git a/events.cpp b/events.cpp index 401a377054..582b737f46 100644 --- a/events.cpp +++ b/events.cpp @@ -28,9 +28,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include - -extern Time qt_x_time; -extern Atom qt_window_role; +#include 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 ); diff --git a/geometry.cpp b/geometry.cpp index ac57a5bfb6..69262caf99 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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 +#include namespace KWinInternal { @@ -326,7 +326,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos ) snap = options->windowSnapZone; if (snap) { - QValueList::ConstIterator l; + QList::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::ConstIterator l; + QList::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()); } diff --git a/geometrytip.cpp b/geometrytip.cpp index c8a046950b..6c60ac5b26 100644 --- a/geometrytip.cpp +++ b/geometrytip.cpp @@ -9,6 +9,7 @@ License. See the file "COPYING" for the exact licensing terms. ******************************************************************/ #include "geometrytip.h" +#include 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 ); } } diff --git a/group.cpp b/group.cpp index 0d47a6a917..3d82a324b3 100644 --- a/group.cpp +++ b/group.cpp @@ -24,6 +24,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#include /* @@ -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; } diff --git a/kcmkwin/kwindecoration/buttons.cpp b/kcmkwin/kwindecoration/buttons.cpp index 5619d1b249..70dc0a96be 100644 --- a/kcmkwin/kwindecoration/buttons.cpp +++ b/kcmkwin/kwindecoration/buttons.cpp @@ -28,11 +28,21 @@ */ -#include +#include #include #include #include #include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -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(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(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(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 drag 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(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) { diff --git a/kcmkwin/kwindecoration/buttons.h b/kcmkwin/kwindecoration/buttons.h index a8c23a9863..7e9e247658 100644 --- a/kcmkwin/kwindecoration/buttons.h +++ b/kcmkwin/kwindecoration/buttons.h @@ -33,8 +33,17 @@ #include #include -#include -#include +#include +#include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -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 ButtonList; +typedef Q3ValueList ButtonList; /** * This class renders and handles the demo titlebar dropsite */ -class ButtonDropSite: public QFrame +class ButtonDropSite: public Q3Frame { Q_OBJECT diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index edfe474b84..c6f84f8f39 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -31,14 +31,19 @@ #include #include #include -#include -#include + +#include #include #include -#include +#include #include #include #include +//Added by qt3to4: +#include +#include +#include +#include #include #include @@ -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::ConstIterator it; + Q3ValueList::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::Iterator it; + Q3ValueList::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::Iterator it; + Q3ValueList::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::const_iterator it = sizes.begin(); it != sizes.end(); ++it) { + for (Q3ValueList::const_iterator it = sizes.begin(); it != sizes.end(); ++it) { BorderSize size = *it; cBorder->insertItem(i18n(border_names[size]), borderSizeToIndex(size,sizes) ); } diff --git a/kcmkwin/kwindecoration/kwindecoration.h b/kcmkwin/kwindecoration/kwindecoration.h index a3c109958d..e4b3bceff9 100644 --- a/kcmkwin/kwindecoration/kwindecoration.h +++ b/kcmkwin/kwindecoration/kwindecoration.h @@ -39,12 +39,15 @@ #include #include "kwindecorationIface.h" +//Added by qt3to4: +#include +#include 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 decorations; + Q3ValueList decorations; KDecorationPreview* preview; KDecorationPlugins* plugins; @@ -126,7 +129,7 @@ class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface // Page 2 ButtonPositionWidget *buttonPositionWidget; - QVBox* buttonPage; + Q3VBox* buttonPage; }; diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index e32faa584a..250e6b0950 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -25,6 +25,10 @@ #include #include #include +//Added by qt3to4: +#include +#include +#include #include #include @@ -32,6 +36,7 @@ #include #include +#include // 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" ); } diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index d8414cfb2d..7d2dcec384 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -21,6 +21,10 @@ #define KWINDECORATION_PREVIEW_H #include +//Added by qt3to4: +#include +#include +#include #include #include @@ -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 &); diff --git a/kcmkwin/kwinoptions/main.cpp b/kcmkwin/kwinoptions/main.cpp index 24c69d6ac6..c6aa4475bf 100644 --- a/kcmkwin/kwinoptions/main.cpp +++ b/kcmkwin/kwinoptions/main.cpp @@ -18,6 +18,8 @@ */ #include +//Added by qt3to4: +#include #include @@ -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()); } diff --git a/kcmkwin/kwinoptions/mouse.cpp b/kcmkwin/kwinoptions/mouse.cpp index 7edca39436..d8d58487a9 100644 --- a/kcmkwin/kwinoptions/mouse.cpp +++ b/kcmkwin/kwinoptions/mouse.cpp @@ -19,14 +19,17 @@ #include #include -#include + #include -#include -#include +#include #include #include -#include #include +#include +//Added by qt3to4: +#include +#include +#include #include #include @@ -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 double click into the titlebar.")); + combo->setWhatsThis( i18n("Behavior on double 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 middle click into the titlebar or frame of an active window.")); + combo->setWhatsThis( i18n("Behavior on middle click into the titlebar or frame of an active 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 left click into the titlebar or frame of an " "inactive 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 middle click into the titlebar or frame of an inactive window.")); + combo->setWhatsThis( i18n("Behavior on middle click into the titlebar or frame of an inactive 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()); } } diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index 7ca253fd4e..b45b8b8683 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -26,12 +26,17 @@ #include #include #include -#include -#include + +#include #include #include #include #include +//Added by qt3to4: +#include +#include +#include +#include #include #include @@ -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( "

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 "

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.

" ); - 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 "
  • Zero-Cornered will place the window in the top-left corner
  • " "") ; - 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); } diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h index 17b8bb10aa..601857b362 100644 --- a/kcmkwin/kwinoptions/windows.h +++ b/kcmkwin/kwinoptions/windows.h @@ -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; diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp index 687b523bc0..79657bb5e3 100644 --- a/kcmkwin/kwinrules/detectwidget.cpp +++ b/kcmkwin/kwinrules/detectwidget.cpp @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Steet, Fifth Floor, Cambridge, MA 02110-1301, USA. */ +#include #include "detectwidget.h" #include @@ -25,11 +26,16 @@ #include #include #include +//Added by qt3to4: +#include +#include +#include #include #include #include #include +#include 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 ) diff --git a/kcmkwin/kwinrules/detectwidget.h b/kcmkwin/kwinrules/detectwidget.h index e27bac7b07..34bcf12e28 100644 --- a/kcmkwin/kwinrules/detectwidget.h +++ b/kcmkwin/kwinrules/detectwidget.h @@ -24,8 +24,12 @@ #include #include +#include #include "../../rules.h" +//Added by qt3to4: +#include +#include 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; diff --git a/kcmkwin/kwinrules/detectwidgetbase.ui b/kcmkwin/kwinrules/detectwidgetbase.ui index 31cae3ef3b..433c1b1f69 100644 --- a/kcmkwin/kwinrules/detectwidgetbase.ui +++ b/kcmkwin/kwinrules/detectwidgetbase.ui @@ -2,7 +2,7 @@ KWinInternal::DetectWidgetBase - Form3 + DetectWidgetBase @@ -24,7 +24,7 @@ spacer1 - Vertical + Qt::Vertical Expanding @@ -143,7 +143,7 @@ Sunken - Horizontal + Qt::Horizontal diff --git a/kcmkwin/kwinrules/editshortcutbase.ui b/kcmkwin/kwinrules/editshortcutbase.ui index 3813ae589e..0256a15644 100644 --- a/kcmkwin/kwinrules/editshortcutbase.ui +++ b/kcmkwin/kwinrules/editshortcutbase.ui @@ -26,7 +26,7 @@ It is possible to have several possible shortcuts, and the first available short For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try <b>Shift+Alt+1</b>, then others with <b>Shift+Ctrl+C</b> as the last one. - RichText + Qt::RichText @@ -40,7 +40,7 @@ For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try Sunken - Horizontal + Qt::Horizontal @@ -61,7 +61,7 @@ For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try spacer1 - Horizontal + Qt::Horizontal Expanding @@ -86,7 +86,7 @@ For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try spacer2 - Horizontal + Qt::Horizontal Expanding @@ -111,7 +111,7 @@ For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try spacer3 - Horizontal + Qt::Horizontal Expanding @@ -136,7 +136,7 @@ For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try Sunken - Horizontal + Qt::Horizontal diff --git a/kcmkwin/kwinrules/kcm.cpp b/kcmkwin/kwinrules/kcm.cpp index 23fb9a3662..67783548d8 100644 --- a/kcmkwin/kwinrules/kcm.cpp +++ b/kcmkwin/kwinrules/kcm.cpp @@ -20,6 +20,8 @@ #include #include +//Added by qt3to4: +#include #include #include #include @@ -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() diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp index 1f0ba0fee9..32c3550afd 100644 --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -28,11 +28,14 @@ #include "ruleswidget.h" #include "../../rules.h" +//Added by qt3to4: +#include +#include 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 ) { diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp index 476004497d..4cd774569f 100644 --- a/kcmkwin/kwinrules/ruleslist.cpp +++ b/kcmkwin/kwinrules/ruleslist.cpp @@ -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 ) { diff --git a/kcmkwin/kwinrules/ruleslist.h b/kcmkwin/kwinrules/ruleslist.h index b4261edf09..d754aa0874 100644 --- a/kcmkwin/kwinrules/ruleslist.h +++ b/kcmkwin/kwinrules/ruleslist.h @@ -22,11 +22,11 @@ #include "ruleslistbase.h" -#include +#include #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 diff --git a/kcmkwin/kwinrules/ruleslistbase.ui b/kcmkwin/kwinrules/ruleslistbase.ui index c2abdaa9d2..269fee7a76 100644 --- a/kcmkwin/kwinrules/ruleslistbase.ui +++ b/kcmkwin/kwinrules/ruleslistbase.ui @@ -2,7 +2,7 @@ KWinInternal::KCMRulesListBase - Form1 + KCMRulesListBase @@ -88,4 +88,8 @@ + + kdialog.h + + diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 5da17b657e..489a003b45 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -27,7 +27,7 @@ #include #include #include -#include + #include #include #include @@ -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(); diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 58126c1ce7..a1f6c3b908 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -2,7 +2,7 @@ KWinInternal::RulesWidgetBase - Form2 + RulesWidgetBase @@ -82,7 +82,7 @@ spacer29 - Vertical + Qt::Vertical Expanding @@ -124,7 +124,7 @@ spacer1 - Horizontal + Qt::Horizontal Expanding @@ -152,7 +152,7 @@ spacer4 - Horizontal + Qt::Horizontal Expanding @@ -194,7 +194,7 @@ spacer2 - Horizontal + Qt::Horizontal Expanding @@ -225,7 +225,7 @@ spacer5 - Horizontal + Qt::Horizontal Expanding @@ -266,7 +266,7 @@ spacer27 - Horizontal + Qt::Horizontal Expanding @@ -291,7 +291,7 @@ spacer28 - Horizontal + Qt::Horizontal Expanding @@ -347,7 +347,7 @@ - Dock (panel) + Qt::ToolBarDock (panel) @@ -465,7 +465,7 @@ spacer2_2 - Horizontal + Qt::Horizontal Expanding @@ -496,7 +496,7 @@ spacer5_2 - Horizontal + Qt::Horizontal Expanding @@ -538,7 +538,7 @@ spacer2_2_2 - Horizontal + Qt::Horizontal Expanding @@ -569,7 +569,7 @@ spacer5_2_2 - Horizontal + Qt::Horizontal Expanding @@ -611,7 +611,7 @@ spacer2_2_3 - Horizontal + Qt::Horizontal Expanding @@ -642,7 +642,7 @@ spacer5_2_3 - Horizontal + Qt::Horizontal Expanding @@ -1138,7 +1138,7 @@ - Top-Left Corner + Qt::DockTop-Qt::DockLeft Qt::Corner @@ -1171,7 +1171,7 @@ spacer31 - Vertical + Qt::Vertical Expanding @@ -1337,7 +1337,7 @@ spacer24 - Horizontal + Qt::Horizontal Expanding @@ -1354,7 +1354,7 @@ spacer36_7 - Horizontal + Qt::Horizontal Expanding @@ -1371,7 +1371,7 @@ spacer36_6 - Horizontal + Qt::Horizontal Expanding @@ -1388,7 +1388,7 @@ spacer36_5 - Horizontal + Qt::Horizontal Expanding @@ -1405,7 +1405,7 @@ spacer36_4 - Horizontal + Qt::Horizontal Expanding @@ -1422,7 +1422,7 @@ spacer36_3 - Horizontal + Qt::Horizontal Expanding @@ -1439,7 +1439,7 @@ spacer36_2 - Horizontal + Qt::Horizontal Expanding @@ -1456,7 +1456,7 @@ spacer36 - Horizontal + Qt::Horizontal Expanding @@ -1786,7 +1786,7 @@ spacer33 - Vertical + Qt::Vertical Expanding @@ -1837,7 +1837,7 @@ spacer25 - Horizontal + Qt::Horizontal Expanding @@ -1984,7 +1984,7 @@ - Dock (panel) + Qt::ToolBarDock (panel) @@ -2257,7 +2257,7 @@ spacer35 - Vertical + Qt::Vertical Expanding @@ -2336,43 +2336,43 @@ detect1 clicked() - Form2 + RulesWidgetBase detectClicked() wmclass_match activated(int) - Form2 + RulesWidgetBase wmclassMatchChanged() role_match activated(int) - Form2 + RulesWidgetBase roleMatchChanged() title_match activated(int) - Form2 + RulesWidgetBase titleMatchChanged() extra_match activated(int) - Form2 + RulesWidgetBase extraMatchChanged() machine_match activated(int) - Form2 + RulesWidgetBase machineMatchChanged() shortcut_edit clicked() - Form2 + RulesWidgetBase shortcutEditClicked() diff --git a/killer/killer.cpp b/killer/killer.cpp index eed473cf54..e5c6a878c1 100644 --- a/killer/killer.cpp +++ b/killer/killer.cpp @@ -30,6 +30,9 @@ DEALINGS IN THE SOFTWARE. #include #include #include +//Added by qt3to4: +#include +#include 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[] ) "Window with title \"%2\" is not responding. " "This window belongs to application %1 (PID=%3, hostname=%4).

    " "Do you wish to terminate this application? (All unsaved data in this application will be lost.)" ) - .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 ); } } diff --git a/killwindow.cpp b/killwindow.cpp index bd39e48bc8..65ff98f0cb 100644 --- a/killwindow.cpp +++ b/killwindow.cpp @@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include 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); } } diff --git a/kwinbindings.cpp b/kwinbindings.cpp index ca06b769a3..9e1c9d733a 100644 --- a/kwinbindings.cpp +++ b/kwinbindings.cpp @@ -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 diff --git a/layers.cpp b/layers.cpp index c3caad32d3..81cb6e5774 100644 --- a/layers.cpp +++ b/layers.cpp @@ -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 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; diff --git a/lib/kcommondecoration.cpp b/lib/kcommondecoration.cpp index 41086e27e1..1a3e8238dc 100644 --- a/lib/kcommondecoration.cpp +++ b/lib/kcommondecoration.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #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(*it) ); + x += layoutMetric(LM_ButtonWidth, true, qobject_cast(*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(*it) );; + x += layoutMetric(LM_ButtonWidth, true, qobject_cast(*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); } diff --git a/lib/kcommondecoration.h b/lib/kcommondecoration.h index c3c23bf654..9dc38b62b5 100644 --- a/lib/kcommondecoration.h +++ b/lib/kcommondecoration.h @@ -25,9 +25,7 @@ #ifndef KCOMMONDECORATION_H #define KCOMMONDECORATION_H -#include -#include - +#include #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 ButtonContainer; ///< If the entry is 0, it's a spacer. + typedef QVector 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; diff --git a/lib/kdecoration.cpp b/lib/kdecoration.cpp index c7b3d69291..fa91739e20 100644 --- a/lib/kdecoration.cpp +++ b/lib/kdecoration.cpp @@ -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 )); } diff --git a/lib/kdecoration.h b/lib/kdecoration.h index eae4622a34..b4d5209093 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -31,6 +31,7 @@ DEALINGS IN THE SOFTWARE. #include #include #include +#include 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. diff --git a/lib/kdecoration_p.cpp b/lib/kdecoration_p.cpp index c43a197fc5..04c7dda717 100644 --- a/lib/kdecoration_p.cpp +++ b/lib/kdecoration_p.cpp @@ -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 diff --git a/lib/kdecoration_p.h b/lib/kdecoration_p.h index 8d0e5e15af..433d08375a 100644 --- a/lib/kdecoration_p.h +++ b/lib/kdecoration_p.h @@ -31,7 +31,6 @@ DEALINGS IN THE SOFTWARE. #include "kdecoration.h" #include -#include 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]; diff --git a/lib/kdecoration_plugins_p.cpp b/lib/kdecoration_plugins_p.cpp index 85d4961053..07fde37eba 100644 --- a/lib/kdecoration_plugins_p.cpp +++ b/lib/kdecoration_plugins_p.cpp @@ -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()) diff --git a/lib/kdecoration_plugins_p.h b/lib/kdecoration_plugins_p.h index b82f7f914d..ae6276c5d5 100644 --- a/lib/kdecoration_plugins_p.h +++ b/lib/kdecoration_plugins_p.h @@ -30,7 +30,6 @@ DEALINGS IN THE SOFTWARE. // This header file is internal. I mean it. // -#include #include #include @@ -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; diff --git a/lib/kdecorationfactory.cpp b/lib/kdecorationfactory.cpp index 74508501b1..9e8d7e34ca 100644 --- a/lib/kdecorationfactory.cpp +++ b/lib/kdecorationfactory.cpp @@ -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 ); diff --git a/lib/kdecorationfactory.h b/lib/kdecorationfactory.h index 08e733c8bb..670c619b5d 100644 --- a/lib/kdecorationfactory.h +++ b/lib/kdecorationfactory.h @@ -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; }; diff --git a/main.cpp b/main.cpp index 49f3312687..4781bc1144 100644 --- a/main.cpp +++ b/main.cpp @@ -22,6 +22,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +#include #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(); diff --git a/manage.cpp b/manage.cpp index 80c3d27ff8..82ae57cac4 100644 --- a/manage.cpp +++ b/manage.cpp @@ -22,10 +22,9 @@ License. See the file "COPYING" for the exact licensing terms. #include #include "notifications.h" +#include #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 | diff --git a/notifications.cpp b/notifications.cpp index 53a804c3ef..528668b65d 100644 --- a/notifications.cpp +++ b/notifications.cpp @@ -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 ) diff --git a/options.cpp b/options.cpp index 9ceca89a5e..415c5a19e7 100644 --- a/options.cpp +++ b/options.cpp @@ -20,6 +20,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include #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; } diff --git a/placement.h b/placement.h index 842f790ccc..0b51f13b27 100644 --- a/placement.h +++ b/placement.h @@ -14,7 +14,8 @@ License. See the file "COPYING" for the exact licensing terms. #define KWIN_PLACEMENT_H #include -#include +#include +#include namespace KWinInternal { @@ -77,7 +78,7 @@ class Placement int row; }; - QValueList cci; + QList cci; Workspace* m_WorkspacePtr; }; diff --git a/popupinfo.cpp b/popupinfo.cpp index 4ccdcb3ee9..45131065f0 100644 --- a/popupinfo.cpp +++ b/popupinfo.cpp @@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include // 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; } diff --git a/popupinfo.h b/popupinfo.h index 11936fcfb1..82998a4ae2 100644 --- a/popupinfo.h +++ b/popupinfo.h @@ -13,7 +13,6 @@ License. See the file "COPYING" for the exact licensing terms. #define KWIN_POPUPINFO_H #include #include -#include namespace KWinInternal { diff --git a/rules.cpp b/rules.cpp index 41768509fd..58635cedb8 100644 --- a/rules.cpp +++ b/rules.cpp @@ -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(); ) { diff --git a/rules.h b/rules.h index 666009e364..6f4ed5a241 100644 --- a/rules.h +++ b/rules.h @@ -14,7 +14,6 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include #include #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 ); } diff --git a/sm.cpp b/sm.cpp index aae54a3750..05681a4452 100644 --- a/sm.cpp +++ b/sm.cpp @@ -11,8 +11,6 @@ License. See the file "COPYING" for the exact licensing terms. #include "sm.h" -#include -#include #include #include #include @@ -23,6 +21,8 @@ License. See the file "COPYING" for the exact licensing terms. #include "workspace.h" #include "client.h" +#include +#include 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 -mainwindow# // 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; diff --git a/sm.h b/sm.h index 0a23b7badd..2832be90eb 100644 --- a/sm.h +++ b/sm.h @@ -12,6 +12,7 @@ License. See the file "COPYING" for the exact licensing terms. #ifndef KWIN_SM_H #define KWIN_SM_H +#include #include #include #include @@ -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; diff --git a/tabbox.cpp b/tabbox.cpp index ef53b998c4..3897bbe1df 100644 --- a/tabbox.cpp +++ b/tabbox.cpp @@ -33,18 +33,17 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include // 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; imax_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 ) diff --git a/tabbox.h b/tabbox.h index e5a37b5290..ac9e077bf5 100644 --- a/tabbox.h +++ b/tabbox.h @@ -12,9 +12,8 @@ License. See the file "COPYING" for the exact licensing terms. #ifndef KWIN_TABBOX_H #define KWIN_TABBOX_H -#include +#include #include -#include #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: diff --git a/tools/decobenchmark/preview.cpp b/tools/decobenchmark/preview.cpp index e6d558a2c4..536ff468ab 100644 --- a/tools/decobenchmark/preview.cpp +++ b/tools/decobenchmark/preview.cpp @@ -34,6 +34,7 @@ #include #include +#include // 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; } diff --git a/useractions.cpp b/useractions.cpp index a9d3ad1472..f424e76abf 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -21,11 +21,9 @@ License. See the file "COPYING" for the exact licensing terms. #include "workspace.h" #include -#include #include #include #include -#include #include #include #include @@ -33,6 +31,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +#include #include "killwindow.h" #include "tabbox.h" @@ -44,17 +44,17 @@ namespace KWinInternal // Workspace //**************************************** -QPopupMenu* Workspace::clientPopup() +Q3PopupMenu* Workspace::clientPopup() { if ( !popup ) { - popup = new QPopupMenu; + popup = new Q3PopupMenu; popup->setCheckable( TRUE ); popup->setFont(KGlobalSettings::menuFont()); connect( popup, SIGNAL( aboutToShow() ), this, SLOT( clientPopupAboutToShow() ) ); connect( popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) ); - advanced_popup = new QPopupMenu( popup ); + advanced_popup = new Q3PopupMenu( popup ); advanced_popup->setCheckable( TRUE ); advanced_popup->setFont(KGlobalSettings::menuFont()); connect( advanced_popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) ); @@ -73,18 +73,18 @@ QPopupMenu* Workspace::clientPopup() desk_popup_index = popup->count(); if (options->useTranslucency){ - QPopupMenu *trans_popup = new QPopupMenu( popup ); - QVBox *transBox = new QVBox(trans_popup); - transButton = new QPushButton(transBox, "transButton"); + Q3PopupMenu *trans_popup = new Q3PopupMenu( popup ); + QVBoxLayout *transLayout = new QVBoxLayout(trans_popup); + trans_popup->setLayout( transLayout ); + transButton = new QPushButton(trans_popup, "transButton"); QToolTip::add(transButton, i18n("Reset opacity to default value")); - transSlider = new QSlider(0, 100, 1, 100, Qt::Vertical, transBox, "transSlider"); + transSlider = new QSlider(0, 100, 1, 100, Qt::Vertical, trans_popup, "transSlider"); QToolTip::add(transSlider, i18n("Slide this to set the window's opacity")); connect(transButton, SIGNAL(clicked()), SLOT(resetClientOpacity())); connect(transButton, SIGNAL(clicked()), trans_popup, SLOT(hide())); connect(transSlider, SIGNAL(valueChanged(int)), SLOT(setTransButtonText(int))); connect(transSlider, SIGNAL(valueChanged(int)), this, SLOT(setPopupClientOpacity(int))); // connect(transSlider, SIGNAL(sliderReleased()), trans_popup, SLOT(hide())); - trans_popup->insertItem(transBox); popup->insertItem(i18n("&Opacity"), trans_popup ); } @@ -186,7 +186,7 @@ void Workspace::initDesktopPopup() if (desk_popup) return; - desk_popup = new QPopupMenu( popup ); + desk_popup = new Q3PopupMenu( popup ); desk_popup->setCheckable( TRUE ); desk_popup->setFont(KGlobalSettings::menuFont()); connect( desk_popup, SIGNAL( activated(int) ), @@ -973,7 +973,7 @@ void Workspace::showWindowMenu( const QRect &pos, Client* cl ) return; active_popup_client = cl; - QPopupMenu* p = clientPopup(); + Q3PopupMenu* p = clientPopup(); active_popup = p; int x = pos.left(); int y = pos.bottom(); @@ -1038,7 +1038,7 @@ void Client::setShortcut( const QString& _cut ) setShortcutInternal( KShortcut()); return; } - QValueList< KShortcut > keys; + QList< KShortcut > keys; QStringList groups = QStringList::split( ' ', cut ); for( QStringList::ConstIterator it = groups.begin(); it != groups.end(); @@ -1049,7 +1049,7 @@ void Client::setShortcut( const QString& _cut ) { QString base = reg.cap( 1 ); QString list = reg.cap( 2 ); - for( unsigned int i = 0; + for( int i = 0; i < list.length(); ++i ) { @@ -1059,14 +1059,14 @@ void Client::setShortcut( const QString& _cut ) } } } - for( QValueList< KShortcut >::ConstIterator it = keys.begin(); + for( QList< KShortcut >::ConstIterator it = keys.begin(); it != keys.end(); ++it ) { if( _shortcut == *it ) // current one is in the list return; } - for( QValueList< KShortcut >::ConstIterator it = keys.begin(); + for( QList< KShortcut >::ConstIterator it = keys.begin(); it != keys.end(); ++it ) { diff --git a/utils.cpp b/utils.cpp index 19d147b9d8..c3fb0732e7 100644 --- a/utils.cpp +++ b/utils.cpp @@ -28,11 +28,11 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include +#include #include "atoms.h" -extern Time qt_x_time; - #endif namespace KWinInternal @@ -54,7 +54,7 @@ bool Shape::hasShape( WId w) int boundingShaped = 0, clipShaped = 0; if (!kwin_has_shape) return FALSE; - XShapeQueryExtents(qt_xdisplay(), w, + XShapeQueryExtents(QX11Info::display(), w, &boundingShaped, &xws, &yws, &wws, &hws, &clipShaped, &xbs, &ybs, &wbs, &hbs); return boundingShaped != 0; @@ -69,7 +69,7 @@ void Shape::init() { int dummy; kwin_has_shape = - XShapeQueryExtension(qt_xdisplay(), &kwin_shape_event, &dummy); + XShapeQueryExtension(QX11Info::display(), &kwin_shape_event, &dummy); } void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, @@ -80,7 +80,7 @@ void Motif::readFlags( WId w, bool& noborder, bool& resize, bool& move, unsigned long length, after; unsigned char* data; MwmHints* hints = 0; - if ( XGetWindowProperty( qt_xdisplay(), w, atoms->motif_wm_hints, 0, 5, + if ( XGetWindowProperty( QX11Info::display(), w, atoms->motif_wm_hints, 0, 5, FALSE, atoms->motif_wm_hints, &type, &format, &length, &after, &data ) == Success ) { @@ -133,10 +133,10 @@ KWinSelectionOwner::KWinSelectionOwner( int screen_P ) Atom KWinSelectionOwner::make_selection_atom( int screen_P ) { if( screen_P < 0 ) - screen_P = DefaultScreen( qt_xdisplay()); + screen_P = DefaultScreen( QX11Info::display()); char tmp[ 30 ]; sprintf( tmp, "WM_S%d", screen_P ); - return XInternAtom( qt_xdisplay(), tmp, False ); + return XInternAtom( QX11Info::display(), tmp, False ); } void KWinSelectionOwner::getAtoms() @@ -147,7 +147,7 @@ void KWinSelectionOwner::getAtoms() Atom atoms[ 1 ]; const char* const names[] = { "VERSION" }; - XInternAtoms( qt_xdisplay(), const_cast< char** >( names ), 1, False, atoms ); + XInternAtoms( QX11Info::display(), const_cast< char** >( names ), 1, False, atoms ); xa_version = atoms[ 0 ]; } } @@ -157,7 +157,7 @@ void KWinSelectionOwner::replyTargets( Atom property_P, Window requestor_P ) KSelectionOwner::replyTargets( property_P, requestor_P ); Atom atoms[ 1 ] = { xa_version }; // PropModeAppend ! - XChangeProperty( qt_xdisplay(), requestor_P, property_P, XA_ATOM, 32, PropModeAppend, + XChangeProperty( QX11Info::display(), requestor_P, property_P, XA_ATOM, 32, PropModeAppend, reinterpret_cast< unsigned char* >( atoms ), 1 ); } @@ -166,7 +166,7 @@ bool KWinSelectionOwner::genericReply( Atom target_P, Atom property_P, Window re if( target_P == xa_version ) { long version[] = { 2, 0 }; - XChangeProperty( qt_xdisplay(), requestor_P, property_P, XA_INTEGER, 32, + XChangeProperty( QX11Info::display(), requestor_P, property_P, XA_INTEGER, 32, PropModeReplace, reinterpret_cast< unsigned char* >( &version ), 2 ); } else @@ -177,16 +177,16 @@ bool KWinSelectionOwner::genericReply( Atom target_P, Atom property_P, Window re Atom KWinSelectionOwner::xa_version = None; -QCString getStringProperty(WId w, Atom prop, char separator) +QByteArray getStringProperty(WId w, Atom prop, char separator) { Atom type; int format, status; unsigned long nitems = 0; unsigned long extra = 0; unsigned char *data = 0; - QCString result = ""; + QByteArray result = ""; KXErrorHandler handler; // ignore errors - status = XGetWindowProperty( qt_xdisplay(), w, prop, 0, 10000, + status = XGetWindowProperty( QX11Info::display(), w, prop, 0, 10000, FALSE, XA_STRING, &type, &format, &nitems, &extra, &data ); if ( status == Success) @@ -241,8 +241,8 @@ static Bool update_x_time_predicate( Display*, XEvent* event, XPointer ) } /* - Updates qt_x_time. This used to simply fetch current timestamp from the server, - but that can cause qt_x_time to be newer than timestamp of events that are + Updates QX11Info::appTime(). This used to simply fetch current timestamp from the server, + but that can cause QX11Info::appTime() to be newer than timestamp of events that are still in our events queue, thus e.g. making XSetInputFocus() caused by such event to be ignored. Therefore events queue is searched for first event with timestamp, and extra PropertyNotify is generated in order to make @@ -254,20 +254,20 @@ void updateXTime() if ( !w ) w = new QWidget; long data = 1; - XChangeProperty(qt_xdisplay(), w->winId(), atoms->kwin_running, atoms->kwin_running, 32, + XChangeProperty(QX11Info::display(), w->winId(), atoms->kwin_running, atoms->kwin_running, 32, PropModeAppend, (unsigned char*) &data, 1); next_x_time = CurrentTime; XEvent dummy; - XCheckIfEvent( qt_xdisplay(), &dummy, update_x_time_predicate, NULL ); + XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL ); if( next_x_time == CurrentTime ) { - XSync( qt_xdisplay(), False ); - XCheckIfEvent( qt_xdisplay(), &dummy, update_x_time_predicate, NULL ); + XSync( QX11Info::display(), False ); + XCheckIfEvent( QX11Info::display(), &dummy, update_x_time_predicate, NULL ); } assert( next_x_time != CurrentTime ); - qt_x_time = next_x_time; + QX11Info::setAppTime( next_x_time ); XEvent ev; // remove the PropertyNotify event from the events queue - XWindowEvent( qt_xdisplay(), w->winId(), PropertyChangeMask, &ev ); + XWindowEvent( QX11Info::display(), w->winId(), PropertyChangeMask, &ev ); } static int server_grab_count = 0; @@ -275,18 +275,18 @@ static int server_grab_count = 0; void grabXServer() { if( ++server_grab_count == 1 ) - XGrabServer( qt_xdisplay()); + XGrabServer( QX11Info::display()); } void ungrabXServer() { assert( server_grab_count > 0 ); if( --server_grab_count == 0 ) - XUngrabServer( qt_xdisplay()); + XUngrabServer( QX11Info::display()); } #endif -bool isLocalMachine( const QCString& host ) +bool isLocalMachine( const QByteArray& host ) { #ifdef HOST_NAME_MAX char hostnamebuf[HOST_NAME_MAX]; @@ -312,8 +312,8 @@ ShortcutDialog::ShortcutDialog( const KShortcut& cut ) // make it a popup, so that it has the grab XSetWindowAttributes attrs; attrs.override_redirect = True; - XChangeWindowAttributes( qt_xdisplay(), winId(), CWOverrideRedirect, &attrs ); - setWFlags( WType_Popup ); + XChangeWindowAttributes( QX11Info::display(), winId(), CWOverrideRedirect, &attrs ); + setWindowFlags( Qt::Popup ); } void ShortcutDialog::accept() @@ -325,12 +325,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(); diff --git a/utils.h b/utils.h index 73bdc3c5f5..38828f5e09 100644 --- a/utils.h +++ b/utils.h @@ -12,11 +12,11 @@ License. See the file "COPYING" for the exact licensing terms. #ifndef KWIN_UTILS_H #define KWIN_UTILS_H -#include #include #include #include #include +#include namespace KWinInternal { @@ -42,11 +42,11 @@ class Client; class Group; class Options; -typedef QValueList< Client* > ClientList; -typedef QValueList< const Client* > ConstClientList; +typedef QList< Client* > ClientList; +typedef QList< const Client* > ConstClientList; -typedef QValueList< Group* > GroupList; -typedef QValueList< const Group* > ConstGroupList; +typedef QList< Group* > GroupList; +typedef QList< const Group* > ConstGroupList; extern Options* options; @@ -184,7 +184,7 @@ class TemporaryAssign T orig; }; -QCString getStringProperty(WId w, Atom prop, char separator=0); +QByteArray getStringProperty(WId w, Atom prop, char separator=0); void updateXTime(); void grabXServer(); void ungrabXServer(); @@ -243,7 +243,7 @@ Time timestampDiff( Time time1, Time time2 ) // returns time2 - time1 return time2 - time1; } -bool isLocalMachine( const QCString& host ); +bool isLocalMachine( const QByteArray& host ); #ifndef KCMRULES // Qt dialogs emit no signal when closed :( diff --git a/workspace.cpp b/workspace.cpp index e0c729efd9..3d50828c12 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -18,7 +18,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include -#include +#include #include #include #include @@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include +#include #include "plugins.h" #include "client.h" @@ -43,8 +44,8 @@ License. See the file "COPYING" for the exact licensing terms. #include #include #include - -extern Time qt_x_time; +#include +#include namespace KWinInternal { @@ -121,10 +122,10 @@ Workspace::Workspace( bool restore ) { _self = this; mgr = new PluginMgr; - root = qt_xrootwin(); - default_colormap = DefaultColormap(qt_xdisplay(), qt_xscreen() ); + root = QX11Info::appRootWindow(); + QX11Info info; + default_colormap = DefaultColormap(QX11Info::display(), info.screen() ); installed_colormap = default_colormap; - session.setAutoDelete( TRUE ); connect( &temporaryRulesMessages, SIGNAL( gotMessage( const QString& )), this, SLOT( gotTemporaryRulesMessage( const QString& ))); @@ -134,8 +135,8 @@ Workspace::Workspace( bool restore ) delayFocusTimer = 0; - electric_time_first = qt_x_time; - electric_time_last = qt_x_time; + electric_time_first = QX11Info::appTime(); + electric_time_last = QX11Info::appTime(); if ( restore ) loadSessionInfo(); @@ -148,8 +149,8 @@ Workspace::Workspace( bool restore ) new QWidget( 0, "desktop_widget", - Qt::WType_Desktop | Qt::WPaintUnclipped - ); + Qt::Desktop ); + desktop_widget->setAttribute( Qt::WA_PaintUnclipped ); kapp->setGlobalMouseTracking( true ); // so that this doesn't mess eventmask on root window later // call this before XSelectInput() on the root window @@ -157,7 +158,7 @@ Workspace::Workspace( bool restore ) KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this ); // select windowmanager privileges - XSelectInput(qt_xdisplay(), root, + XSelectInput(QX11Info::display(), root, KeyPressMask | PropertyChangeMask | ColormapChangeMask | @@ -172,8 +173,8 @@ Workspace::Workspace( bool restore ) long data = 1; XChangeProperty( - qt_xdisplay(), - qt_xrootwin(), + QX11Info::display(), + QX11Info::appRootWindow(), atoms->kwin_running, atoms->kwin_running, 32, @@ -203,7 +204,6 @@ Workspace::Workspace( bool restore ) } } - void Workspace::init() { checkElectricBorders(); @@ -213,13 +213,13 @@ void Workspace::init() // maximizedWindowCounter = 0; supportWindow = new QWidget; - XLowerWindow( qt_xdisplay(), supportWindow->winId()); // see usage in layers.cpp + XLowerWindow( QX11Info::display(), supportWindow->winId()); // see usage in layers.cpp XSetWindowAttributes attr; attr.override_redirect = 1; - null_focus_window = XCreateWindow( qt_xdisplay(), qt_xrootwin(), -1,-1, 1, 1, 0, CopyFromParent, + null_focus_window = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), -1,-1, 1, 1, 0, CopyFromParent, InputOnly, CopyFromParent, CWOverrideRedirect, &attr ); - XMapWindow(qt_xdisplay(), null_focus_window); + XMapWindow(QX11Info::display(), null_focus_window); unsigned long protocols[ 5 ] = { @@ -300,12 +300,13 @@ void Workspace::init() , }; - rootInfo = new RootInfo( this, qt_xdisplay(), supportWindow->winId(), "KWin", - protocols, 5, qt_xscreen() ); + QX11Info info; + rootInfo = new RootInfo( this, QX11Info::display(), supportWindow->winId(), "KWin", + protocols, 5, info.screen() ); loadDesktopSettings(); // extra NETRootInfo instance in Client mode is needed to get the values of the properties - NETRootInfo client_info( qt_xdisplay(), NET::ActiveWindow | NET::CurrentDesktop ); + NETRootInfo client_info( QX11Info::display(), NET::ActiveWindow | NET::CurrentDesktop ); int initial_desktop; if( !kapp->isSessionRestored()) initial_desktop = client_info.currentDesktop(); @@ -336,8 +337,8 @@ void Workspace::init() ++block_focus; // because it will be set below char nm[ 100 ]; - sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( qt_xdisplay())); - Atom topmenu_atom = XInternAtom( qt_xdisplay(), nm, False ); + sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( QX11Info::display())); + Atom topmenu_atom = XInternAtom( QX11Info::display(), nm, False ); topmenu_selection = new KSelectionOwner( topmenu_atom ); topmenu_watcher = new KSelectionWatcher( topmenu_atom ); // TODO grabXServer(); - where exactly put this? topmenu selection claiming down belong must be before @@ -352,11 +353,11 @@ void Workspace::init() unsigned int i, nwins; Window root_return, parent_return, *wins; - XQueryTree(qt_xdisplay(), root, &root_return, &parent_return, &wins, &nwins); + XQueryTree(QX11Info::display(), root, &root_return, &parent_return, &wins, &nwins); for (i = 0; i < nwins; i++) { XWindowAttributes attr; - XGetWindowAttributes(qt_xdisplay(), wins[i], &attr); + XGetWindowAttributes(QX11Info::display(), wins[i], &attr); if (attr.override_redirect ) continue; if( topmenu_space && topmenu_space->winId() == wins[ i ] ) @@ -366,10 +367,10 @@ void Workspace::init() if ( addSystemTrayWin( wins[i] ) ) continue; Client* c = createClient( wins[i], true ); - 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 ); c->move(0,0); } } @@ -438,8 +439,8 @@ Workspace::~Workspace() delete tab_box; delete popupinfo; delete popup; - if ( root == qt_xrootwin() ) - XDeleteProperty(qt_xdisplay(), qt_xrootwin(), atoms->kwin_running); + if ( root == QX11Info::appRootWindow() ) + XDeleteProperty(QX11Info::display(), QX11Info::appRootWindow(), atoms->kwin_running); writeWindowRules(); KGlobal::config()->sync(); @@ -460,7 +461,9 @@ Workspace::~Workspace() delete rules.front(); rules.pop_front(); } - XDestroyWindow( qt_xdisplay(), null_focus_window ); + foreach ( SessionInfo* s, session ) + delete s; + XDestroyWindow( QX11Info::display(), null_focus_window ); // TODO ungrabXServer(); _self = 0; } @@ -759,11 +762,11 @@ void Workspace::updateToolWindows( bool also_hide ) to_show.append( *it ); } } // first show new ones, then hide - for( ClientList::ConstIterator it = to_show.fromLast(); - it != to_show.end(); - --it ) // from topmost + for( int i = to_show.size() - 1; + i >= 0; + --i ) //from topmost // TODO since this is in stacking order, the order of taskbar entries changes :( - (*it)->hideClient( false ); + to_show.at( i )->hideClient( false ); if( also_hide ) { for( ClientList::ConstIterator it = to_hide.begin(); @@ -793,7 +796,7 @@ void Workspace::updateColormap() cmap = activeClient()->colormap(); if ( cmap != installed_colormap ) { - XInstallColormap(qt_xdisplay(), cmap ); + XInstallColormap(QX11Info::display(), cmap ); installed_colormap = cmap; } } @@ -893,7 +896,7 @@ void Workspace::slotReconfigure() void Workspace::loadDesktopSettings() { KConfig* c = KGlobal::config(); - QCString groupname; + QString groupname; if (screen_number == 0) groupname = "Desktops"; else @@ -920,7 +923,7 @@ void Workspace::loadDesktopSettings() void Workspace::saveDesktopSettings() { KConfig* c = KGlobal::config(); - QCString groupname; + QString groupname; if (screen_number == 0) groupname = "Desktops"; else @@ -1017,18 +1020,18 @@ class ObscuringWindows ~ObscuringWindows(); void create( Client* c ); private: - QValueList obscuring_windows; - static QValueList* cached; + QList obscuring_windows; + static QList* cached; static unsigned int max_cache_size; }; -QValueList* ObscuringWindows::cached = 0; +QList* ObscuringWindows::cached = 0; unsigned int ObscuringWindows::max_cache_size = 0; void ObscuringWindows::create( Client* c ) { if( cached == 0 ) - cached = new QValueList; + cached = new QList; Window obs_win; XWindowChanges chngs; int mask = CWSibling | CWStackMode; @@ -1046,29 +1049,29 @@ void ObscuringWindows::create( Client* c ) XSetWindowAttributes a; a.background_pixmap = None; a.override_redirect = True; - obs_win = XCreateWindow( qt_xdisplay(), qt_xrootwin(), c->x(), c->y(), + obs_win = XCreateWindow( QX11Info::display(), QX11Info::appRootWindow(), c->x(), c->y(), c->width(), c->height(), 0, CopyFromParent, InputOutput, CopyFromParent, CWBackPixmap | CWOverrideRedirect, &a ); } chngs.sibling = c->frameId(); chngs.stack_mode = Below; - XConfigureWindow( qt_xdisplay(), obs_win, mask, &chngs ); - XMapWindow( qt_xdisplay(), obs_win ); + XConfigureWindow( QX11Info::display(), obs_win, mask, &chngs ); + XMapWindow( QX11Info::display(), obs_win ); obscuring_windows.append( obs_win ); } ObscuringWindows::~ObscuringWindows() { - max_cache_size = QMAX( max_cache_size, obscuring_windows.count() + 4 ) - 1; - for( QValueList::ConstIterator it = obscuring_windows.begin(); + max_cache_size = qMax( ( int )max_cache_size, obscuring_windows.count() + 4 ) - 1; + for( QList::ConstIterator it = obscuring_windows.begin(); it != obscuring_windows.end(); ++it ) { - XUnmapWindow( qt_xdisplay(), *it ); - if( cached->count() < max_cache_size ) + XUnmapWindow( QX11Info::display(), *it ); + if( cached->count() < ( int )max_cache_size ) cached->prepend( *it ); else - XDestroyWindow( qt_xdisplay(), *it ); + XDestroyWindow( QX11Info::display(), *it ); } } @@ -1116,9 +1119,9 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if( movingClient && !movingClient->isOnDesktop( new_desktop )) movingClient->setDesktop( new_desktop ); - for ( ClientList::ConstIterator it = stacking_order.fromLast(); it != stacking_order.end(); --it) - if ( (*it)->isOnDesktop( new_desktop ) ) - (*it)->updateVisibility(); + for( int i = stacking_order.size() - 1; i >= 0 ; --i ) + if ( stacking_order.at( i )->isOnDesktop( new_desktop ) ) + stacking_order.at( i )->updateVisibility(); --block_showing_desktop; if( showingDesktop()) // do this only after desktop change to avoid flicker @@ -1141,11 +1144,13 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if ( !c ) { - 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)->isOnAllDesktops() && (*it)->isOnCurrentDesktop()) + if ( focus_chain.at( i )->isShown( false ) && !focus_chain.at( i )->isOnAllDesktops() && focus_chain.at( i )->isOnCurrentDesktop()) { - c = *it; + c = focus_chain.at( i ); break; } } @@ -1153,11 +1158,13 @@ bool Workspace::setCurrentDesktop( int new_desktop ) if ( !c ) { - 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()) { - c = *it; + c = focus_chain.at( i ); break; } } @@ -1182,7 +1189,7 @@ bool Workspace::setCurrentDesktop( int new_desktop ) { Window w_tmp; int i_tmp; - XGetInputFocus( qt_xdisplay(), &w_tmp, &i_tmp ); + XGetInputFocus( QX11Info::display(), &w_tmp, &i_tmp ); if( w_tmp == null_focus_window ) // CHECKME? requestFocus( findDesktop( true, currentDesktop())); } @@ -1194,7 +1201,7 @@ bool Workspace::setCurrentDesktop( int new_desktop ) // Output: chain = { 3, 1, 2, 4 }. // kdDebug(1212) << QString("Switching to desktop #%1, at focus_chain index %2\n") // .arg(current_desktop).arg(desktop_focus_chain.find( current_desktop )); - for( int i = desktop_focus_chain.find( current_desktop ); i > 0; i-- ) + for( int i = desktop_focus_chain.indexOf( current_desktop ); i > 0; i-- ) desktop_focus_chain[i] = desktop_focus_chain[i-1]; desktop_focus_chain[0] = current_desktop; @@ -1469,15 +1476,15 @@ bool Workspace::addSystemTrayWin( WId w ) if ( systemTrayWins.contains( w ) ) return TRUE; - NETWinInfo ni( qt_xdisplay(), w, root, NET::WMKDESystemTrayWinFor ); + NETWinInfo ni( QX11Info::display(), w, root, NET::WMKDESystemTrayWinFor ); WId trayWinFor = ni.kdeSystemTrayWinFor(); if ( !trayWinFor ) return FALSE; systemTrayWins.append( SystemTrayWindow( w, trayWinFor ) ); - XSelectInput( qt_xdisplay(), w, + XSelectInput( QX11Info::display(), w, StructureNotifyMask ); - XAddToSaveSet( qt_xdisplay(), w ); + XAddToSaveSet( QX11Info::display(), w ); propagateSystemTrayWins(); return TRUE; } @@ -1500,7 +1507,7 @@ bool Workspace::removeSystemTrayWin( WId w, bool check ) // embedding it, allowing KWin to figure out. Kicker just mustn't // crash before removing it again ... *shrug* . int num_props; - Atom* props = XListProperties( qt_xdisplay(), w, &num_props ); + Atom* props = XListProperties( QX11Info::display(), w, &num_props ); if( props != NULL ) { for( int i = 0; @@ -1552,7 +1559,7 @@ void Workspace::killWindowId( Window window_to_kill ) Window parent, root; Window* children; unsigned int children_count; - XQueryTree( qt_xdisplay(), window, &root, &parent, &children, &children_count ); + XQueryTree( QX11Info::display(), window, &root, &parent, &children, &children_count ); if( children != NULL ) XFree( children ); if( window == root ) // we didn't find the client, probably an override-redirect window @@ -1562,7 +1569,7 @@ void Workspace::killWindowId( Window window_to_kill ) if( client != NULL ) client->killWindow(); else - XKillClient( qt_xdisplay(), window_to_kill ); + XKillClient( QX11Info::display(), window_to_kill ); } @@ -1592,7 +1599,7 @@ void Workspace::slotGrabWindow() { //As the first step, get the mask from XShape. int count, order; - XRectangle* rects = XShapeGetRectangles( qt_xdisplay(), active_client->frameId(), + XRectangle* rects = XShapeGetRectangles( QX11Info::display(), active_client->frameId(), ShapeBounding, &count, &order); //The ShapeBounding region is the outermost shape of the window; //ShapeBounding - ShapeClipping is defined to be the border. @@ -1612,13 +1619,13 @@ void Workspace::slotGrabWindow() //Get the masked away area. QRegion maskedAway = bbox - contents; - QMemArray maskedAwayRects = maskedAway.rects(); + QVector maskedAwayRects = maskedAway.rects(); //Construct a bitmap mask from the rectangles QBitmap mask( snapshot.width(), snapshot.height()); QPainter p(&mask); p.fillRect(0, 0, mask.width(), mask.height(), Qt::color1); - for (uint pos = 0; pos < maskedAwayRects.count(); pos++) + for (int pos = 0; pos < maskedAwayRects.count(); pos++) p.fillRect(maskedAwayRects[pos], Qt::color0); p.end(); snapshot.setMask(mask); @@ -1637,7 +1644,7 @@ void Workspace::slotGrabWindow() */ void Workspace::slotGrabDesktop() { - QPixmap p = QPixmap::grabWindow( qt_xrootwin() ); + QPixmap p = QPixmap::grabWindow( QX11Info::appRootWindow() ); QClipboard *cb = QApplication::clipboard(); cb->setPixmap( p ); } @@ -1651,15 +1658,15 @@ void Workspace::slotMouseEmulation() if ( mouse_emulation ) { - XUngrabKeyboard(qt_xdisplay(), qt_x_time); + XUngrabKeyboard(QX11Info::display(), QX11Info::appTime()); mouse_emulation = FALSE; return; } - if ( XGrabKeyboard(qt_xdisplay(), + if ( XGrabKeyboard(QX11Info::display(), root, FALSE, GrabModeAsync, GrabModeAsync, - qt_x_time) == GrabSuccess ) + QX11Info::appTime()) == GrabSuccess ) { mouse_emulation = TRUE; mouse_emulation_state = 0; @@ -1676,7 +1683,7 @@ void Workspace::slotMouseEmulation() WId Workspace::getMouseEmulationWindow() { Window root; - Window child = qt_xrootwin(); + Window child = QX11Info::appRootWindow(); int root_x, root_y, lx, ly; uint state; Window w; @@ -1686,7 +1693,7 @@ WId Workspace::getMouseEmulationWindow() w = child; if (!c) c = findClient( FrameIdMatchPredicate( w )); - XQueryPointer( qt_xdisplay(), w, &root, &child, + XQueryPointer( QX11Info::display(), w, &root, &child, &root_x, &root_y, &lx, &ly, &state ); } while ( child != None && child != w ); @@ -1707,38 +1714,38 @@ unsigned int Workspace::sendFakedMouseEvent( QPoint pos, WId w, MouseEmulation t { int x, y; Window xw; - XTranslateCoordinates( qt_xdisplay(), qt_xrootwin(), w, pos.x(), pos.y(), &x, &y, &xw ); + XTranslateCoordinates( QX11Info::display(), QX11Info::appRootWindow(), w, pos.x(), pos.y(), &x, &y, &xw ); if ( type == EmuMove ) { // motion notify events XMotionEvent e; e.type = MotionNotify; e.window = w; - e.root = qt_xrootwin(); + e.root = QX11Info::appRootWindow(); e.subwindow = w; - e.time = qt_x_time; + e.time = QX11Info::appTime(); e.x = x; e.y = y; e.x_root = pos.x(); e.y_root = pos.y(); e.state = state; e.is_hint = NotifyNormal; - XSendEvent( qt_xdisplay(), w, TRUE, ButtonMotionMask, (XEvent*)&e ); + XSendEvent( QX11Info::display(), w, TRUE, ButtonMotionMask, (XEvent*)&e ); } else { XButtonEvent e; e.type = type == EmuRelease ? ButtonRelease : ButtonPress; e.window = w; - e.root = qt_xrootwin(); + e.root = QX11Info::appRootWindow(); e.subwindow = w; - e.time = qt_x_time; + e.time = QX11Info::appTime(); e.x = x; e.y = y; e.x_root = pos.x(); e.y_root = pos.y(); e.state = state; e.button = button; - XSendEvent( qt_xdisplay(), w, TRUE, ButtonPressMask, (XEvent*)&e ); + XSendEvent( QX11Info::display(), w, TRUE, ButtonPressMask, (XEvent*)&e ); if ( type == EmuPress ) { @@ -1780,9 +1787,9 @@ unsigned int Workspace::sendFakedMouseEvent( QPoint pos, WId w, MouseEmulation t */ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) { - if ( root != qt_xrootwin() ) + if ( root != QX11Info::appRootWindow() ) return FALSE; - int kc = XKeycodeToKeysym(qt_xdisplay(), ev.keycode, 0); + int kc = XKeycodeToKeysym(QX11Info::display(), ev.keycode, 0); int km = ev.state & (ControlMask | Mod1Mask | ShiftMask); bool is_control = km & ControlMask; @@ -1857,7 +1864,7 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) } // fall through case XK_Escape: - XUngrabKeyboard(qt_xdisplay(), qt_x_time); + XUngrabKeyboard(QX11Info::display(), QX11Info::appTime()); mouse_emulation = FALSE; return TRUE; default: @@ -1943,58 +1950,58 @@ void Workspace::createBorderWindows() attributes.event_mask = (EnterWindowMask | LeaveWindowMask | VisibilityChangeMask); valuemask= (CWOverrideRedirect | CWEventMask | CWCursor ); - attributes.cursor = XCreateFontCursor(qt_xdisplay(), + attributes.cursor = XCreateFontCursor(QX11Info::display(), XC_sb_up_arrow); - electric_top_border = XCreateWindow (qt_xdisplay(), qt_xrootwin(), + electric_top_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(), 0,0, r.width(),1, 0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); - XMapWindow(qt_xdisplay(), electric_top_border); + XMapWindow(QX11Info::display(), electric_top_border); - attributes.cursor = XCreateFontCursor(qt_xdisplay(), + attributes.cursor = XCreateFontCursor(QX11Info::display(), XC_sb_down_arrow); - electric_bottom_border = XCreateWindow (qt_xdisplay(), qt_xrootwin(), + electric_bottom_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(), 0,r.height()-1, r.width(),1, 0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); - XMapWindow(qt_xdisplay(), electric_bottom_border); + XMapWindow(QX11Info::display(), electric_bottom_border); - attributes.cursor = XCreateFontCursor(qt_xdisplay(), + attributes.cursor = XCreateFontCursor(QX11Info::display(), XC_sb_left_arrow); - electric_left_border = XCreateWindow (qt_xdisplay(), qt_xrootwin(), + electric_left_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(), 0,0, 1,r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); - XMapWindow(qt_xdisplay(), electric_left_border); + XMapWindow(QX11Info::display(), electric_left_border); - attributes.cursor = XCreateFontCursor(qt_xdisplay(), + attributes.cursor = XCreateFontCursor(QX11Info::display(), XC_sb_right_arrow); - electric_right_border = XCreateWindow (qt_xdisplay(), qt_xrootwin(), + electric_right_border = XCreateWindow (QX11Info::display(), QX11Info::appRootWindow(), r.width()-1,0, 1,r.height(), 0, CopyFromParent, InputOnly, CopyFromParent, valuemask, &attributes); - XMapWindow(qt_xdisplay(), electric_right_border); + XMapWindow(QX11Info::display(), electric_right_border); // Set XdndAware on the windows, so that DND enter events are received (#86998) Atom version = 4; // XDND version - XChangeProperty( qt_xdisplay(), electric_top_border, atoms->xdnd_aware, XA_ATOM, + XChangeProperty( QX11Info::display(), electric_top_border, atoms->xdnd_aware, XA_ATOM, 32, PropModeReplace, ( unsigned char* )&version, 1 ); - XChangeProperty( qt_xdisplay(), electric_bottom_border, atoms->xdnd_aware, XA_ATOM, + XChangeProperty( QX11Info::display(), electric_bottom_border, atoms->xdnd_aware, XA_ATOM, 32, PropModeReplace, ( unsigned char* )&version, 1 ); - XChangeProperty( qt_xdisplay(), electric_left_border, atoms->xdnd_aware, XA_ATOM, + XChangeProperty( QX11Info::display(), electric_left_border, atoms->xdnd_aware, XA_ATOM, 32, PropModeReplace, ( unsigned char* )&version, 1 ); - XChangeProperty( qt_xdisplay(), electric_right_border, atoms->xdnd_aware, XA_ATOM, + XChangeProperty( QX11Info::display(), electric_right_border, atoms->xdnd_aware, XA_ATOM, 32, PropModeReplace, ( unsigned char* )&version, 1 ); } @@ -2012,13 +2019,13 @@ void Workspace::destroyBorderWindows() electric_have_borders = false; if(electric_top_border) - XDestroyWindow(qt_xdisplay(),electric_top_border); + XDestroyWindow(QX11Info::display(),electric_top_border); if(electric_bottom_border) - XDestroyWindow(qt_xdisplay(),electric_bottom_border); + XDestroyWindow(QX11Info::display(),electric_bottom_border); if(electric_left_border) - XDestroyWindow(qt_xdisplay(),electric_left_border); + XDestroyWindow(QX11Info::display(),electric_left_border); if(electric_right_border) - XDestroyWindow(qt_xdisplay(),electric_right_border); + XDestroyWindow(QX11Info::display(),electric_right_border); electric_top_border = None; electric_bottom_border = None; @@ -2153,7 +2160,7 @@ bool Workspace::electricBorder(XEvent *e) || e->xclient.window == electric_right_border )) { updateXTime(); - clientMoved( QPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), qt_x_time ); + clientMoved( QPoint( e->xclient.data.l[2]>>16, e->xclient.data.l[2]&0xffff), QX11Info::appTime() ); return true; } } @@ -2168,10 +2175,10 @@ void Workspace::raiseElectricBorders() if(electric_have_borders) { - XRaiseWindow(qt_xdisplay(), electric_top_border); - XRaiseWindow(qt_xdisplay(), electric_left_border); - XRaiseWindow(qt_xdisplay(), electric_bottom_border); - XRaiseWindow(qt_xdisplay(), electric_right_border); + XRaiseWindow(QX11Info::display(), electric_top_border); + XRaiseWindow(QX11Info::display(), electric_left_border); + XRaiseWindow(QX11Info::display(), electric_bottom_border); + XRaiseWindow(QX11Info::display(), electric_right_border); } } @@ -2250,7 +2257,7 @@ void Workspace::setupTopMenuHandling() Window stack[ 2 ]; stack[ 0 ] = supportWindow->winId(); stack[ 1 ] = topmenu_space->winId(); - XRestackWindows(qt_xdisplay(), stack, 2); + XRestackWindows(QX11Info::display(), stack, 2); updateTopMenuGeometry(); topmenu_space->show(); updateClientArea(); @@ -2289,7 +2296,7 @@ bool Workspace::checkStartupNotification( Window w, KStartupInfoId& id, KStartup */ void Workspace::focusToNull() { - XSetInputFocus(qt_xdisplay(), null_focus_window, RevertToPointerRoot, qt_x_time ); + XSetInputFocus(QX11Info::display(), null_focus_window, RevertToPointerRoot, QX11Info::appTime() ); } void Workspace::helperDialog( const QString& message, const Client* c ) @@ -2361,7 +2368,7 @@ void Workspace::startKompmgr() allowKompmgrRestart = FALSE; QTimer::singleShot( 60000, this, SLOT(unblockKompmgrRestart()) ); QByteArray ba; - QDataStream arg(ba, IO_WriteOnly); + QDataStream arg(&ba, IO_WriteOnly); arg << ""; kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStarted()", ba); } @@ -2377,7 +2384,7 @@ void Workspace::stopKompmgr() if (popup){ delete popup; popup = 0L; } // to add/remove opacity slider kompmgr->kill(); QByteArray ba; - QDataStream arg(ba, IO_WriteOnly); + QDataStream arg(&ba, IO_WriteOnly); arg << ""; kapp->dcopClient()->emitDCOPSignal("default", "kompmgrStopped()", ba); } diff --git a/workspace.h b/workspace.h index 2a4bf42798..3dab00628f 100644 --- a/workspace.h +++ b/workspace.h @@ -25,7 +25,7 @@ License. See the file "COPYING" for the exact licensing terms. #include -class QPopupMenu; +class Q3PopupMenu; class KConfig; class KGlobalAccel; class KShortcutDialog; @@ -67,7 +67,7 @@ class SystemTrayWindow WId winFor; }; -typedef QValueList SystemTrayWindowList; +typedef QList SystemTrayWindowList; class Workspace : public QObject, public KWinInterface, public KDecorationDefines { @@ -459,7 +459,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine void calcDesktopLayout(int &x, int &y) const; - QPopupMenu* clientPopup(); + Q3PopupMenu* clientPopup(); void closeActivePopup(); void updateClientArea( bool force ); @@ -468,7 +468,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine int current_desktop; int number_of_desktops; - QMemArray desktop_focus_chain; + QVector desktop_focus_chain; QWidget* active_popup; Client* active_popup_client; @@ -479,8 +479,8 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine void loadWindowRules(); void editWindowRules( Client* ); - QPtrList session; - QValueList rules; + QList session; + QList rules; KXMessages temporaryRulesMessages; QTimer rulesUpdatedTimer; static const char* windowTypeToTxt( NET::WindowType type ); @@ -533,9 +533,9 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine TabBox* tab_box; PopupInfo* popupinfo; - QPopupMenu *popup; - QPopupMenu *advanced_popup; - QPopupMenu *desk_popup; + Q3PopupMenu *popup; + Q3PopupMenu *advanced_popup; + Q3PopupMenu *desk_popup; int desk_popup_index; KGlobalAccel *keys;