Put stuff in KWinInternal namespace.

Export client.h, workspace.h and options.h so that people can write plugins.

svn path=/trunk/kdebase/kwin/; revision=83707
icc-effect-5.14.5
Waldo Bastian 2001-02-20 01:20:38 +00:00
parent 7ba861c71d
commit 2f90225543
35 changed files with 142 additions and 70 deletions

View File

@ -13,6 +13,9 @@ kwin_la_LDFLAGS = $(all_libraries) -module -avoid-version
include_HEADERS = KWinInterface.h
kwinincludedir = $(includedir)/kwin
kwininclude_HEADERS = options.h client.h workspace.h
kwin_SOURCES = kwin_main.cpp
kwin_LDADD = kwin.la
kwin_LDFLAGS = $(all_libraries) $(KDE_RPATH)

View File

@ -33,23 +33,16 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <X11/Xatom.h>
#include <X11/extensions/shape.h>
extern Atom qt_wm_state;
extern Time kwin_time;
static bool resizeHorizontalDirectionFixed = FALSE;
static bool resizeVerticalDirectionFixed = FALSE;
static bool blockAnimation = FALSE;
static QRect* visible_bound = 0;
namespace KWinInternal {
// NET WM Protocol handler class
class WinInfo : public NETWinInfo {
class WinInfo : public NETWinInfo
{
public:
WinInfo(::Client * c, Display * display, Window window,
WinInfo(KWinInternal::Client * c, Display * display, Window window,
Window rwin, unsigned long pr )
: NETWinInfo( display, window, rwin, pr, NET::WindowManager ) {
m_client = c;
m_client = c;
}
virtual void changeDesktop(int desktop) {
@ -70,9 +63,9 @@ public:
if ( (mask & NET::Max) == NET::Max ) {
m_client->maximizeRaw( state & NET::MaxVert, state & NET::MaxHoriz );
} else if ( mask & NET::MaxVert ) {
m_client->maximizeRaw( state & NET::MaxVert, m_client->maximizeMode() & Client::MaximizeHorizontal );
m_client->maximizeRaw( state & NET::MaxVert, m_client->maximizeMode() & KWinInternal::Client::MaximizeHorizontal );
} else if ( mask & NET::MaxHoriz ) {
m_client->maximizeRaw( m_client->maximizeMode() & Client::MaximizeVertical, state & NET::MaxHoriz );
m_client->maximizeRaw( m_client->maximizeMode() & KWinInternal::Client::MaximizeVertical, state & NET::MaxHoriz );
}
if ( mask & NET::StaysOnTop) {
m_client->setStaysOnTop( (state & NET::StaysOnTop) != 0 );
@ -81,9 +74,21 @@ public:
}
}
private:
::Client * m_client;
KWinInternal::Client * m_client;
};
};
using namespace KWinInternal;
extern Atom qt_wm_state;
extern Time kwin_time;
static bool resizeHorizontalDirectionFixed = FALSE;
static bool resizeVerticalDirectionFixed = FALSE;
static bool blockAnimation = FALSE;
static QRect* visible_bound = 0;
void Client::drawbound( const QRect& geom )
{
@ -2950,4 +2955,3 @@ QPixmap * kwin_get_menu_pix_hack()
#include "client.moc"

View File

@ -16,10 +16,13 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
class NETWinInfo;
namespace KWinInternal {
class Workspace;
class Client;
class WinInfo;
class NETWinInfo;
class WindowWrapper : public QWidget
{
@ -452,4 +455,6 @@ public:
void setShade( bool , int ){}
};
};
#endif

View File

@ -13,6 +13,8 @@
#include "../../options.h"
#include "bitmaps.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -10,6 +10,8 @@ class QLabel;
//class QHBoxLayout;
class QGridLayout;
namespace KWinInternal {
class B2Button : public QButton
{
Q_OBJECT
@ -71,7 +73,7 @@ protected:
B2Client *client;
};
class B2Client : public Client
class B2Client : public KWinInternal::Client
{
Q_OBJECT
friend class B2Titlebar;
@ -113,7 +115,6 @@ private:
};
};
#endif

View File

@ -20,6 +20,8 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include "kde1client_bitmaps.h"
using namespace KWinInternal;
extern "C"
{
Client * allocate(Workspace * workSpace, WId winId, int tool )

View File

@ -10,7 +10,9 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
class QLabel;
class QSpacerItem;
class StdClient : public Client
namespace KWinInternal {
class StdClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -106,5 +108,6 @@ private:
};
};
#endif

View File

@ -11,6 +11,8 @@
#include "../../workspace.h"
#include "../../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int )

View File

@ -8,6 +8,7 @@
class QLabel;
class QSpacerItem;
namespace KWinInternal {
// get rid of autohide :P
class NextButton : public QButton
@ -25,7 +26,7 @@ protected:
Client *client;
};
class NextClient : public Client
class NextClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -50,7 +51,6 @@ private:
QSpacerItem* titlebar;
};
};
#endif

View File

@ -17,6 +17,8 @@
#include "../../workspace.h"
#include "../../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w)
@ -26,7 +28,6 @@ extern "C"
}
enum FramePixmap{FrameTop=0, FrameBottom, FrameLeft, FrameRight, FrameTopLeft,
FrameTopRight, FrameBottomLeft, FrameBottomRight};

View File

@ -8,6 +8,8 @@
class QLabel;
class QSpacerItem;
namespace KWinInternal {
// QToolButton uses a 1 pixel border :P
class MyButton : public QToolButton
{
@ -18,7 +20,7 @@ protected:
void drawButtonLabel(QPainter *p);
};
class KWMThemeClient : public Client
class KWMThemeClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -46,5 +48,7 @@ private:
QSpacerItem *titlebar;
};
};
#endif

View File

@ -16,6 +16,8 @@
#include "../../workspace.h"
#include "../../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -9,6 +9,7 @@ class QLabel;
class QSpacerItem;
class QHBoxLayout;
namespace KWinInternal {
// get rid of autohide :P
class LaptopClientButton : public QButton
@ -41,7 +42,7 @@ protected:
Client *client;
};
class LaptopClient : public Client
class LaptopClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -80,7 +81,6 @@ private:
int lastBufferWidth;
};
};
#endif

View File

@ -16,6 +16,8 @@
#include "buttondata.h"
#include "btnhighcolor.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -8,6 +8,7 @@
class QLabel;
class QSpacerItem;
namespace KWinInternal {
// get rid of autohide :P
class ModernButton : public QButton
@ -31,7 +32,7 @@ public:
int last_button;
};
class ModernSys : public Client
class ModernSys : public KWinInternal::Client
{
Q_OBJECT
public:
@ -62,5 +63,6 @@ private:
QString oldTitle;
};
};
#endif

View File

@ -11,6 +11,8 @@
#include "../../workspace.h"
#include "../../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w)

View File

@ -8,6 +8,7 @@
class QLabel;
class QSpacerItem;
namespace KWinInternal {
// get rid of autohide :P
class MwmButton : public QButton
@ -24,7 +25,7 @@ protected:
QBitmap deco;
};
class MwmClient : public Client
class MwmClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -45,8 +46,7 @@ private:
QSpacerItem* titlebar;
};
};
#endif

View File

@ -45,7 +45,7 @@
extern "C"
{
Client * allocate(Workspace * workSpace, WId winId, int tool)
KWinInternal::Client * allocate(KWinInternal::Workspace * workSpace, WId winId, int tool)
{
if (tool)
return new RiscOS::ToolManager(workSpace, winId);
@ -59,12 +59,12 @@ namespace RiscOS
Manager::Manager(
Workspace * workSpace,
KWinInternal::Workspace * workSpace,
WId id,
QWidget * parent,
const char * name
)
: Client(workSpace, id, parent, name)
: KWinInternal::Client(workSpace, id, parent, name)
{
setBackgroundMode(NoBackground);
@ -192,7 +192,7 @@ Manager::paintEvent(QPaintEvent * e)
void
Manager::resizeEvent(QResizeEvent * e)
{
Client::resizeEvent(e);
KWinInternal::Client::resizeEvent(e);
updateButtonVisibility();
updateTitleBuffer();
repaint();
@ -292,7 +292,7 @@ Manager::updateTitleBuffer()
p.drawPixmap(tr.width() - 3, 0, s->titleTextRight(active));
}
Client::MousePosition
KWinInternal::Client::MousePosition
Manager::mousePosition(const QPoint & p) const
{
MousePosition m = Center;
@ -580,7 +580,7 @@ void Manager::animate(bool iconify, int style)
ToolManager::ToolManager(
Workspace * workSpace,
KWinInternal::Workspace * workSpace,
WId id,
QWidget * parent,
const char * name

View File

@ -40,13 +40,13 @@ class StickyButton;
class HelpButton;
class Button;
class Manager : public Client
class Manager : public KWinInternal::Client
{
Q_OBJECT
public:
Manager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
Manager(KWinInternal::Workspace *, WId, QWidget * parent = 0, const char * name = 0);
~Manager();
signals:
@ -65,7 +65,7 @@ class Manager : public Client
protected:
Client::MousePosition mousePosition(const QPoint &) const;
KWinInternal::Client::MousePosition mousePosition(const QPoint &) const;
void paletteChange(const QPalette &);
void activeChange(bool);
void maximizeChange(bool);
@ -105,7 +105,7 @@ class ToolManager : public Manager
public:
ToolManager(Workspace *, WId, QWidget * parent = 0, const char * name = 0);
ToolManager(KWinInternal::Workspace *, WId, QWidget * parent = 0, const char * name = 0);
~ToolManager();
};

View File

@ -13,6 +13,8 @@
#include "../../workspace.h"
#include "../../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -12,6 +12,8 @@
class QLabel;
class QSpacerItem;
namespace KWinInternal {
class SystemButton : public QToolButton
{
Q_OBJECT
@ -40,7 +42,7 @@ private:
};
class SystemClient : public Client
class SystemClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -72,5 +74,6 @@ private:
QString oldTitle;
};
};
#endif

View File

@ -25,6 +25,8 @@
#include "../../options.h"
#include <stdio.h>
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -19,6 +19,7 @@ class QLabel;
class QSpacerItem;
class QHBoxLayout;
namespace KWinInternal {
class GalliumButton : public QButton
{
@ -58,7 +59,7 @@ protected:
};
class GalliumClient : public Client
class GalliumClient : public KWinInternal::Client
{
Q_OBJECT
@ -92,5 +93,6 @@ private:
QHBoxLayout* hb;
};
};
#endif

View File

@ -20,6 +20,8 @@ Matthias Ettrich <ettrich@kde.org>
#include "../workspace.h"
#include "../options.h"
using namespace KWinInternal;
extern "C"
{
Client *allocate(Workspace *ws, WId w, int)

View File

@ -9,6 +9,7 @@ class QLabel;
class QSpacerItem;
class QHBoxLayout;
namespace KWinInternal {
// get rid of autohide :P
class KDEDefaultClientButton : public QToolButton
@ -46,7 +47,7 @@ protected:
bool isMouseOver;
};
class KDEClient : public Client
class KDEClient : public KWinInternal::Client
{
Q_OBJECT
public:
@ -87,7 +88,6 @@ private:
KPixmap lightIcon;
};
};
#endif

View File

@ -17,6 +17,8 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#define None 0L
#endif
using namespace KWinInternal;
KillWindow::KillWindow( Workspace* ws )
: workspace( ws ) {}

View File

@ -8,6 +8,8 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include "workspace.h"
namespace KWinInternal {
class KillWindow
{
public:
@ -21,4 +23,6 @@ private:
Workspace* workspace;
};
};
#endif

View File

@ -35,6 +35,8 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <klocale.h>
#include <kcrash.h>
using namespace KWinInternal;
Options* options;
Atoms* atoms;

2
main.h
View File

@ -9,7 +9,7 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <kapp.h>
#include "workspace.h"
typedef QValueList<Workspace*> WorkspaceList;
typedef QValueList<KWinInternal::Workspace*> WorkspaceList;
class Application : public KApplication
{
public:

View File

@ -20,6 +20,8 @@ Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
#include "plugins.h"
#include "kdedefault.h"
using namespace KWinInternal;
PluginMenu::PluginMenu(PluginMgr *manager, QWidget *parent, const char *name)
: QPopupMenu(parent, name)
{
@ -155,7 +157,7 @@ void PluginMgr::loadPlugin(QString nameStr)
// Rikkus: temporary change in semantics.
if (!nameStr)
if (nameStr.isEmpty())
nameStr = "default";
if(!dlregistered){

View File

@ -10,12 +10,13 @@ Copyright (C) 1999, 2000 Daniel M. Duley <mosfet@kde.org>
#include <qstringlist.h>
#include <ltdl.h>
class QFileInfo;
namespace KWinInternal {
class Client;
class Workspace;
class QFileInfo;
class PluginMgr : public QObject
{
Q_OBJECT
@ -51,5 +52,6 @@ protected:
PluginMgr *mgr;
};
};
#endif

View File

@ -15,6 +15,8 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <kconfig.h>
#include <klocale.h>
using namespace KWinInternal;
const bool options_traverse_all = FALSE; // TODO
TabBox::TabBox( Workspace *ws, const char *name )

View File

@ -8,9 +8,12 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qwidget.h>
#include <qtimer.h>
class QLabel;
namespace KWinInternal {
class Workspace;
class Client;
class QLabel;
typedef QValueList<Client*> ClientList;
class TabBox : public QWidget
@ -72,4 +75,6 @@ inline TabBox::Mode TabBox::mode() const
return m;
}
};
#endif

View File

@ -42,15 +42,13 @@ const int XIconicState = IconicState;
#include <kwin.h>
#include <kdebug.h>
extern int kwin_screen_number;
namespace KWinInternal {
// NET WM Protocol handler class
class RootInfo : public NETRootInfo
{
public:
RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr, int scr= -1)
RootInfo( KWinInternal::Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr, int scr= -1)
: NETRootInfo( dpy, w, name, pr, scr ) {
workspace = ws;
}
@ -59,12 +57,12 @@ public:
void changeNumberOfDesktops(int n) { workspace->setNumberOfDesktops( n ); }
void changeCurrentDesktop(int d) { workspace->setCurrentDesktop( d ); }
void changeActiveWindow(Window w) {
::Client* c = workspace->findClient( (WId) w );
KWinInternal::Client* c = workspace->findClient( (WId) w );
if ( c )
workspace->activateClient( c );
}
void closeWindow(Window w) {
::Client* c = workspace->findClient( (WId) w );
KWinInternal::Client* c = workspace->findClient( (WId) w );
if ( c ) {
c->closeWindow();
}
@ -72,9 +70,14 @@ public:
void moveResize(Window, int, int, unsigned long) { }
private:
Workspace* workspace;
KWinInternal::Workspace* workspace;
};
};
using namespace KWinInternal;
extern int kwin_screen_number;
QString Workspace::desktopName( int desk )
{
@ -167,7 +170,7 @@ Client* Workspace::clientFactory( WId w )
}
case NET::Tool:
return ( mgr.allocateClient( this, w, true ) );
return ( mgr->allocateClient( this, w, true ) );
case NET::Menu:
case NET::Dock:
@ -187,7 +190,7 @@ Client* Workspace::clientFactory( WId w )
if ( Shape::hasShape( w ) ){
return new NoBorderClient( this, w );
}
return ( mgr.allocateClient( this, w, false ) );
return ( mgr->allocateClient( this, w, false ) );
}
// Rikkus: This class is too complex. It needs splitting further.
@ -218,6 +221,7 @@ Workspace::Workspace( bool restore )
keys (0),
root (0)
{
mgr = new PluginMgr;
root = qt_xrootwin();
default_colormap = DefaultColormap(qt_xdisplay(), qt_xscreen() );
installed_colormap = default_colormap;
@ -330,7 +334,7 @@ void Workspace::init()
connect(&resetTimer, SIGNAL(timeout()), this,
SLOT(slotResetAllClients()));
connect(&mgr, SIGNAL(resetAllClients()), this,
connect(mgr, SIGNAL(resetAllClients()), this,
SLOT(slotResetAllClients()));
connect(kapp, SIGNAL(appearanceChanged()), this,
SLOT(slotResetAllClientsDelayed()));
@ -406,6 +410,7 @@ Workspace::~Workspace()
delete rootInfo;
delete supportWindow;
delete mgr;
}
@ -1213,7 +1218,7 @@ QPopupMenu* Workspace::clientPopup( Client* c )
connect( popup, SIGNAL( aboutToShow() ), this, SLOT( clientPopupAboutToShow() ) );
connect( popup, SIGNAL( activated(int) ), this, SLOT( clientPopupActivated(int) ) );
PluginMenu *deco = new PluginMenu(&mgr, popup);
PluginMenu *deco = new PluginMenu(mgr, popup);
deco->setFont(KGlobalSettings::menuFont());
desk_popup = new QPopupMenu( popup );
@ -1625,7 +1630,7 @@ void Workspace::unclutterDesktop()
void Workspace::reconfigure()
{
KGlobal::config()->reparseConfiguration();
if ( mgr.updatePlugin() )
if ( mgr->updatePlugin() )
slotResetAllClientsDelayed();
options->reload();
keys->readSettings();

View File

@ -14,18 +14,19 @@ Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
#include <qlist.h>
#include <qtimer.h>
#include "options.h"
#include "plugins.h"
#include "KWinInterface.h"
#include <X11/Xlib.h>
class KConfig;
class KGlobalAccel;
namespace KWinInternal {
class Client;
class TabBox;
class KConfig;
class KGlobalAccel;
class RootInfo;
class PluginMgr;
typedef QValueList<Client*> ClientList;
@ -341,7 +342,7 @@ private:
KGlobalAccel *keys;
WId root;
PluginMgr mgr;
PluginMgr *mgr;
RootInfo *rootInfo;
QWidget* supportWindow;
@ -386,5 +387,6 @@ inline const ClientList& Workspace::stackingOrder() const
return stacking_order;
}
};
#endif