summaryrefslogtreecommitdiffstats
path: root/kickermenu/menuapplet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kickermenu/menuapplet.cpp')
-rw-r--r--kickermenu/menuapplet.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/kickermenu/menuapplet.cpp b/kickermenu/menuapplet.cpp
index 97e35de..6ff5d75 100644
--- a/kickermenu/menuapplet.cpp
+++ b/kickermenu/menuapplet.cpp
@@ -24,13 +24,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _MENUAPPLET_CPP_
-#include <qdir.h>
-#include <qdesktopwidget.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-#include <qtimer.h>
-#include <qvariant.h> // avoid X11 #define's
+#include <tqdir.h>
+#include <tqdesktopwidget.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqtooltip.h>
+#include <tqtimer.h>
+#include <tqvariant.h> // avoid X11 #define's
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
@@ -49,9 +49,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/*
KMenuBar from KDE3.1 and older won't work very well with this applet.
- This is because QMenuBar tries really hard to keep its preffered size,
+ This is because TQMenuBar tries really hard to keep its preffered size,
se even if the X window for the menubar has the size enforced by this
- applet, Qt thinks it has the size Qt wants. This results in parts
+ applet, TQt thinks it has the size TQt wants. This results in parts
of the menubar not being repainted. Also, old KMenuBar always forced
with to be the width of the screen, so even if the menubar has only
few entries, this applet will still indicate the menubar doesn't
@@ -61,11 +61,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-extern Time qt_x_time;
+extern Time tqt_x_time;
extern "C"
{
- KDE_EXPORT KPanelApplet* init( QWidget* parent_P, const QString& configFile_P )
+ KDE_EXPORT KPanelApplet* init( TQWidget* parent_P, const TQString& configFile_P )
{
KGlobal::locale()->insertCatalogue("kmenuapplet");
return new KickerMenuApplet::Applet( configFile_P, parent_P );
@@ -85,25 +85,25 @@ const long SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::Do
| NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask
| NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
-Applet::Applet( const QString& configFile_P, QWidget* parent_P ) : KPanelApplet( configFile_P, Normal, 0, parent_P, "menuapplet" ), DCOPObject( "menuapplet" ), module( NULL ), active_menu( NULL ), selection( NULL ), selection_watcher( NULL ), desktop_menu( false ), topEdgeOffset( 0 )
+Applet::Applet( const TQString& configFile_P, TQWidget* parent_P ) : KPanelApplet( configFile_P, Normal, 0, parent_P, "menuapplet" ), DCOPObject( "menuapplet" ), module( NULL ), active_menu( NULL ), selection( NULL ), selection_watcher( NULL ), desktop_menu( false ), topEdgeOffset( 0 )
{
- KConfig config(QDir::homeDirPath() + "/.qt/baghirarc");
+ KConfig config(TQDir::homeDirPath() + "/.qt/baghirarc");
config.setGroup("Menubar");
- _maxWidth = config.readNumEntry("Width", QDesktopWidget().availableGeometry().width());
- _menuMover = new QLabel("<<|>>", this );
+ _maxWidth = config.readNumEntry("Width", TQDesktopWidget().availableGeometry().width());
+ _menuMover = new TQLabel("<<|>>", this );
_menuMover->adjustSize();
_menuMover->setFixedSize(_menuMover->size());
_menuMover->move(_maxWidth - _menuMover->width(),0);
_menuMover->hide();
_menuMover->installEventFilter(this);
- windowIndicator = new QMenuBar(this);
+ windowIndicator = new TQMenuBar(this);
windowIndicator->installEventFilter(this);
- windowIndicator->setBackgroundOrigin(QWidget::WidgetOrigin);
+ windowIndicator->setBackgroundOrigin(TQWidget::WidgetOrigin);
windowIndicator->setLineWidth(0);
windowList = new KWindowListMenu(windowIndicator);
connect(windowList, SIGNAL(aboutToShow()), this, SLOT(initPopup()));
windowIndicator->insertItem( "KDE", windowList, 0);
- QFont tmpFont = KGlobalSettings::menuFont();
+ TQFont tmpFont = KGlobalSettings::menuFont();
windowIndicator->setFont(tmpFont);
// windowIndicator->adjustSize();
// int tmpHeight = windowIndicator->height();
@@ -136,7 +136,7 @@ void Applet::fontChanged()
{
if (!windowIndicator)
return;
- QFont tmpFont = KGlobalSettings::menuFont();
+ TQFont tmpFont = KGlobalSettings::menuFont();
// windowIndicator->setFont(tmpFont);
// windowIndicator->adjustSize();
// int tmpHeight = windowIndicator->height();
@@ -167,32 +167,32 @@ void Applet::moveMenu()
if (!wannaMove)
return;
active_menu->move( active_menu->x() + menuDX, active_menu->y());
- QTimer::singleShot(100, this, SLOT(moveMenu()));
+ TQTimer::singleShot(100, this, SLOT(moveMenu()));
}
-bool Applet::eventFilter(QObject *o, QEvent *ev)
+bool Applet::eventFilter(TQObject *o, TQEvent *ev)
{
if (o == _menuMover)
{
- if (ev->type() == QEvent::MouseButtonPress && active_menu)
+ if (ev->type() == TQEvent::MouseButtonPress && active_menu)
{
- if (((QMouseEvent*)ev)->x() < _menuMover->width()/2)
+ if (((TQMouseEvent*)ev)->x() < _menuMover->width()/2)
{
menuDX = -5;
wannaMove = true;
active_menu->move( active_menu->x() - 5, active_menu->y());
- QTimer::singleShot(200, this, SLOT(moveMenu()));
+ TQTimer::singleShot(200, this, SLOT(moveMenu()));
}
else
{
menuDX = 5;
wannaMove = true;
active_menu->move( active_menu->x() + 5, active_menu->y());
- QTimer::singleShot(200, this, SLOT(moveMenu()));
+ TQTimer::singleShot(200, this, SLOT(moveMenu()));
}
return false;
}
- if (ev->type() == QEvent::MouseButtonRelease)
+ if (ev->type() == TQEvent::MouseButtonRelease)
{
wannaMove = false;
return false;
@@ -201,8 +201,8 @@ bool Applet::eventFilter(QObject *o, QEvent *ev)
}
#if 0
// to fake menu consistency - doesn't work to good so far
- if (o == windowIndicator && ev->type() == QEvent::MouseMove &&
- (((QMouseEvent*)ev)->x() == windowIndicator->width()-1) &&
+ if (o == windowIndicator && ev->type() == TQEvent::MouseMove &&
+ (((TQMouseEvent*)ev)->x() == windowIndicator->width()-1) &&
windowIndicator->isItemActive( 0 ))
// moving out to the right
{
@@ -212,25 +212,25 @@ bool Applet::eventFilter(QObject *o, QEvent *ev)
}
else
// #endif
- if (ev->type() == QEvent::PaletteChange)
+ if (ev->type() == TQEvent::PaletteChange)
{ // this is necessary as the background origin is set from somwhere outside - it's no kmenubar - so we set it back
- QWidget *w = (QWidget*)o;
+ TQWidget *w = (TQWidget*)o;
// #if 0
if (w == windowIndicator)
// #endif
{
- if (w->backgroundOrigin() != QWidget::WidgetOrigin)
+ if (w->backgroundOrigin() != TQWidget::WidgetOrigin)
{
w->blockSignals(TRUE); // to avoid loops
- w->setBackgroundOrigin(QWidget::WidgetOrigin);
+ w->setBackgroundOrigin(TQWidget::WidgetOrigin);
w->blockSignals(FALSE);
}
}
// #if 0
- else if (w->backgroundOrigin() != QWidget::ParentOrigin)
+ else if (w->backgroundOrigin() != TQWidget::ParentOrigin)
{
w->blockSignals(TRUE);
- w->setBackgroundOrigin(QWidget::ParentOrigin);
+ w->setBackgroundOrigin(TQWidget::ParentOrigin);
w->blockSignals(FALSE);
}
return FALSE;
@@ -241,7 +241,7 @@ bool Applet::eventFilter(QObject *o, QEvent *ev)
void Applet::windowAdded( WId w_P )
{
- NETWinInfo info( qt_xdisplay(), w_P, qt_xrootwin(), NET::WMWindowType );
+ NETWinInfo info( tqt_xdisplay(), w_P, tqt_xrootwin(), NET::WMWindowType );
Window transient_for = KWin::transientFor( w_P );
if( info.windowType( SUPPORTED_WINDOW_TYPES ) != NET::TopMenu )
@@ -251,7 +251,7 @@ void Applet::windowAdded( WId w_P )
return;
MenuEmbed* embed;
- if( transient_for == qt_xrootwin())
+ if( transient_for == tqt_xrootwin())
{
embed = new MenuEmbed( transient_for, true, this );
}
@@ -260,11 +260,11 @@ void Applet::windowAdded( WId w_P )
KWin::WindowInfo info2 = KWin::windowInfo( transient_for, NET::WMWindowType | NET::WMName );
embed = new MenuEmbed( transient_for, info2.windowType( SUPPORTED_WINDOW_TYPES ) == NET::Desktop, this );
// ========= NAMING ===================
- QString title(info2.name());
+ TQString title(info2.name());
XClassHint classHint;
- if (XGetClassHint( qt_xdisplay(), w_P, &classHint ) )
+ if (XGetClassHint( tqt_xdisplay(), w_P, &classHint ) )
{ // much better way to get a nice name!
- QString name( classHint.res_class );
+ TQString name( classHint.res_class );
if (name.contains("SDL_App"))
goto titlejump; // mainly for scummvm apps - jumps to netwm caption parsing
XFree( classHint.res_name );
@@ -333,7 +333,7 @@ void Applet::activeWindowChanged( WId w_P )
window != None;
window = tryTransientFor( window ))
{
- for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin();
+ for( TQValueList< MenuEmbed* >::ConstIterator it = menus.begin();
it != menus.end();
++it )
{
@@ -372,7 +372,7 @@ void Applet::activeWindowChanged( WId w_P )
if( try_desktop )
#endif
{
- for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin();
+ for( TQValueList< MenuEmbed* >::ConstIterator it = menus.begin();
it != menus.end();
++it )
{
@@ -440,14 +440,14 @@ WId Applet::tryTransientFor( WId w_P )
if( info.state() & NET::Modal )
return None;*/
WId ret = KWin::transientFor( w_P );
- if( ret == qt_xrootwin())
+ if( ret == tqt_xrootwin())
ret = None;
return ret;
}
void Applet::menuLost( MenuEmbed* embed )
{
- for( QValueList< MenuEmbed* >::Iterator it = menus.begin(); it != menus.end(); ++it )
+ for( TQValueList< MenuEmbed* >::Iterator it = menus.begin(); it != menus.end(); ++it )
{
if( *it == embed )
{
@@ -471,16 +471,16 @@ void Applet::positionChange( Position )
}
// Detect mouse movement at the top screen edge also if the menubar
-// has a popup open - in such case, Qt has a grab, and this avoids
+// has a popup open - in such case, TQt has a grab, and this avoids
// Kicker's FittsLawFrame. Therefore move the menubar a bit higher,
// so that it actually is positioned exactly at the screen edge
// (i.e. at a negative y coordinate within this applet, due to
// Kicker's frame).
void Applet::updateTopEdgeOffset()
{
- QPoint p = topLevelWidget()->mapToGlobal( QPoint( 0, 0 ));
+ TQPoint p = topLevelWidget()->mapToGlobal( TQPoint( 0, 0 ));
if( p.y() <= 2 ) // 2 = work also when running in appletproxy
- topEdgeOffset = mapToGlobal( QPoint( 0, 0 )).y() - p.y();
+ topEdgeOffset = mapToGlobal( TQPoint( 0, 0 )).y() - p.y();
else
topEdgeOffset = 0;
if( active_menu != NULL )
@@ -492,7 +492,7 @@ void Applet::updateTopEdgeOffset()
// }
}
-void Applet::paletteChange(const QPalette & /* oldPalette */)
+void Applet::paletteChange(const TQPalette & /* oldPalette */)
{
if( active_menu != NULL )
{
@@ -504,7 +504,7 @@ void Applet::paletteChange(const QPalette & /* oldPalette */)
void Applet::claimSelection()
{
assert( selection == NULL );
- selection = new KSelectionOwner( makeSelectionAtom(), DefaultScreen( qt_xdisplay()));
+ selection = new KSelectionOwner( makeSelectionAtom(), DefaultScreen( tqt_xdisplay()));
// force taking the selection, but don't kill previous owner
if( selection->claim( true, false ))
{
@@ -514,8 +514,8 @@ void Applet::claimSelection()
module = new KWinModule;
connect( module, SIGNAL( windowAdded( WId )), this, SLOT( windowAdded( WId )));
connect( module, SIGNAL( activeWindowChanged( WId )), this, SLOT( activeWindowChanged( WId )));
- QValueList< WId > windows = module->windows();
- for( QValueList< WId >::ConstIterator it = windows.begin(); it != windows.end(); ++it )
+ TQValueList< WId > windows = module->windows();
+ for( TQValueList< WId >::ConstIterator it = windows.begin(); it != windows.end(); ++it )
windowAdded( *it );
activeWindowChanged( module->activeWindow());
}
@@ -528,7 +528,7 @@ void Applet::lostSelection()
if( selection == NULL )
return;
// kdDebug() << "lost selection" << endl;
- for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin();
+ for( TQValueList< MenuEmbed* >::ConstIterator it = menus.begin();
it != menus.end();
++it )
delete (*it); // delete all MenuEmbed's = release all menus
@@ -536,7 +536,7 @@ void Applet::lostSelection()
active_menu = NULL;
if( selection_watcher == NULL )
{
- selection_watcher = new KSelectionWatcher( makeSelectionAtom(), DefaultScreen( qt_xdisplay()));
+ selection_watcher = new KSelectionWatcher( makeSelectionAtom(), DefaultScreen( tqt_xdisplay()));
connect( selection_watcher, SIGNAL( lostOwner()), this, SLOT( claimSelection()));
}
delete module;
@@ -553,9 +553,9 @@ void Applet::readSettings()
desktop_menu = cfg.readBoolEntry( "ShowMenubar", false );
cfg.setGroup( "KDE" );
if( cfg.readBoolEntry( "macStyle", false ) || desktop_menu )
- QToolTip::remove( this );
+ TQToolTip::remove( this );
else
- QToolTip::add( this, i18n(
+ TQToolTip::add( this, i18n(
"You do not appear to have enabled the standalone menubar; "
"enable it in the Behavior control module for desktop." ));
if( !isDisabled() && active_menu == NULL )
@@ -591,11 +591,11 @@ static
void initAtoms()
{
char nm[ 100 ];
- sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( qt_xdisplay()));
+ sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( tqt_xdisplay()));
char nm2[] = "_KDE_TOPMENU_MINSIZE";
char* names[ 2 ] = { nm, nm2 };
Atom atoms[ 2 ];
- XInternAtoms( qt_xdisplay(), names, 2, False, atoms );
+ XInternAtoms( tqt_xdisplay(), names, 2, False, atoms );
selection_atom = atoms[ 0 ];
msg_type_atom = atoms[ 1 ];
}
@@ -608,7 +608,7 @@ Atom Applet::makeSelectionAtom()
}
MenuEmbed::MenuEmbed( WId mainwindow_P, bool desktop_P,
- QWidget* parent_P, const char* name_P )
+ TQWidget* parent_P, const char* name_P )
: QXEmbed( parent_P, name_P ),
main_window( mainwindow_P ),
desktop( desktop_P )
@@ -629,7 +629,7 @@ bool MenuEmbed::x11Event( XEvent* ev_P )
&& ev_P->xconfigurerequest.value_mask & ( CWWidth | CWHeight ))
{
XConfigureRequestEvent& ev = ev_P->xconfigurerequest;
- QSize new_size = size();
+ TQSize new_size = size();
if( ev.value_mask & CWWidth )
new_size.setWidth( ev.width );
if( ev.value_mask & CWHeight )
@@ -646,7 +646,7 @@ bool MenuEmbed::x11Event( XEvent* ev_P )
// int x, y;
// unsigned int w, h, d, b;
// Window root;
-// XGetGeometry( qt_xdisplay(), embeddedWinId(), &root, &x, &y, &w, &h, &b, &d );
+// XGetGeometry( tqt_xdisplay(), embeddedWinId(), &root, &x, &y, &w, &h, &b, &d );
// kdDebug() << "RES3:" << width() << ":" << height() << ":" << w << ":" << h << endl;
return true;
}
@@ -655,12 +655,12 @@ bool MenuEmbed::x11Event( XEvent* ev_P )
void MenuEmbed::sendSyntheticConfigureNotifyEvent()
{
- QPoint globalPos = mapToGlobal(QPoint(0,0));
+ TQPoint globalPos = mapToGlobal(TQPoint(0,0));
if (embeddedWinId()) {
XConfigureEvent c;
memset(&c, 0, sizeof(c));
c.type = ConfigureNotify;
- c.display = qt_xdisplay();
+ c.display = tqt_xdisplay();
c.send_event = True;
c.event = embeddedWinId();
c.window = winId();
@@ -671,7 +671,7 @@ void MenuEmbed::sendSyntheticConfigureNotifyEvent()
c.border_width = 0;
c.above = None;
c.override_redirect = 0;
- XSendEvent( qt_xdisplay(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c );
+ XSendEvent( tqt_xdisplay(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c );
}
}
@@ -684,18 +684,18 @@ void MenuEmbed::setMinimumSize( int w, int h )
{
// kdDebug() << "RES2:" << width() << ":" << height() << ":" << minimumWidth() << ":" << minimumHeight() << endl;
XEvent ev;
- ev.xclient.display = qt_xdisplay();
+ ev.xclient.display = tqt_xdisplay();
ev.xclient.type = ClientMessage;
ev.xclient.window = embeddedWinId();
assert( msg_type_atom != None );
ev.xclient.message_type = msg_type_atom;
ev.xclient.format = 32;
- ev.xclient.data.l[0] = qt_x_time;
+ ev.xclient.data.l[0] = tqt_x_time;
ev.xclient.data.l[1] = minimumWidth();
ev.xclient.data.l[2] = minimumHeight();
ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0;
- XSendEvent( qt_xdisplay(), embeddedWinId(), False, NoEventMask, &ev );
+ XSendEvent( tqt_xdisplay(), embeddedWinId(), False, NoEventMask, &ev );
}
}