From 596c6587c8e5263027705426647b43a5105f3bcd Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 24 Jul 2011 03:10:05 -0500 Subject: Fixed FTBFS due to prior commit --- tqtinterface/qt4/src/kernel/tqapplication_x11.cpp | 24 ++- tqtinterface/qt4/src/kernel/tqdnd_x11.cpp | 2 +- tqtinterface/qt4/src/kernel/tqinputcontext.cpp | 11 +- tqtinterface/qt4/src/kernel/tqinputcontext.h | 13 +- tqtinterface/qt4/src/kernel/tqinputcontext_x11.cpp | 7 +- tqtinterface/qt4/src/kernel/tqnamespace.h | 7 +- tqtinterface/qt4/src/kernel/tqpixmap_x11.cpp | 26 +--- tqtinterface/qt4/src/kernel/tqwidget.h | 24 +++ tqtinterface/qt4/src/kernel/tqwidget_x11.cpp | 163 +++++++++++++++++++++ 9 files changed, 223 insertions(+), 54 deletions(-) (limited to 'tqtinterface/qt4/src/kernel') diff --git a/tqtinterface/qt4/src/kernel/tqapplication_x11.cpp b/tqtinterface/qt4/src/kernel/tqapplication_x11.cpp index e7cf92f..aaa9faf 100644 --- a/tqtinterface/qt4/src/kernel/tqapplication_x11.cpp +++ b/tqtinterface/qt4/src/kernel/tqapplication_x11.cpp @@ -1791,8 +1791,8 @@ void qt_init_internal( int *argcptr, char **argv, #ifndef TQT_NO_XSYNC // Try to initialize SYNC extension on the connected display int xsync_major, xsync_minor; - if ( XSyncQueryExtension( appDpy, &xsync_eventbase, &xsync_errorbase ) && - XSyncInitialize( appDpy, &xsync_major, &xsync_minor ) ) { + if ( XSyncQueryExtension( QX11Info::display(), &xsync_eventbase, &xsync_errorbase ) && + XSyncInitialize( QX11Info::display(), &xsync_major, &xsync_minor ) ) { qt_use_xsync = TRUE; } #endif @@ -2758,6 +2758,26 @@ void qt_leave_modal( TQWidget *widget ) } } +int qt_x11_translateButtonState( int s ) +{ + int bst = 0; + if ( s & Button1Mask ) + bst |= Qt::LeftButton; + if ( s & Button2Mask ) + bst |= Qt::MidButton; + if ( s & Button3Mask ) + bst |= Qt::RightButton; + if ( s & ShiftMask ) + bst |= TQt::ShiftButton; + if ( s & ControlMask ) + bst |= TQt::ControlButton; + if ( s & qt_alt_mask ) + bst |= TQt::AltButton; + if ( s & qt_meta_mask ) + bst |= TQt::MetaButton; + return bst; +} + #else // USE_QT4 /***************************************************************************** diff --git a/tqtinterface/qt4/src/kernel/tqdnd_x11.cpp b/tqtinterface/qt4/src/kernel/tqdnd_x11.cpp index 3ba66b9..56d00d4 100644 --- a/tqtinterface/qt4/src/kernel/tqdnd_x11.cpp +++ b/tqtinterface/qt4/src/kernel/tqdnd_x11.cpp @@ -293,7 +293,7 @@ public: pm.setMask( tqmask ); setMask( tqmask ); } else if ( pm.tqmask() ) { - setMask( *mask ); + setMask( *pm.tqmask() ); } else { clearMask(); } diff --git a/tqtinterface/qt4/src/kernel/tqinputcontext.cpp b/tqtinterface/qt4/src/kernel/tqinputcontext.cpp index dfb38f7..79d9542 100644 --- a/tqtinterface/qt4/src/kernel/tqinputcontext.cpp +++ b/tqtinterface/qt4/src/kernel/tqinputcontext.cpp @@ -518,7 +518,7 @@ void TQInputContext::sendIMEventInternal( TQEvent::Type type, TQIMEvent *event = 0; #if defined(TQ_WS_X11) - receiver = d->composingWidget; + receiver = TQT_TQOBJECT(d->composingWidget); #elif defined(TQ_WS_TQWS) // just a placeholder #endif @@ -793,14 +793,6 @@ TQString TQInputContext::language() } -#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000) -/*! - This is a preliminary interface for TQt4 - */ -TQList TQInputContext::actions() -{ -} -#else /*! This function can be reimplemented in a subclass to provide input method dependent popup menus. Return 0 if the menus are @@ -817,7 +809,6 @@ TQPtrList *TQInputContext::menus() { return 0; } -#endif /*! Appends input method dependent submenus into \a popup. A separator diff --git a/tqtinterface/qt4/src/kernel/tqinputcontext.h b/tqtinterface/qt4/src/kernel/tqinputcontext.h index 9dbd9bf..14a1a7e 100644 --- a/tqtinterface/qt4/src/kernel/tqinputcontext.h +++ b/tqtinterface/qt4/src/kernel/tqinputcontext.h @@ -43,13 +43,8 @@ #include "tqglobal.h" #include "tqevent.h" #include "tqstring.h" -#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000) -#include "tqlist.h" -#include "tqaction.h" -#else #include "tqptrlist.h" #endif -#endif class TQWidget; class TQFont; @@ -62,15 +57,14 @@ struct TQInputContextMenu { NoSeparator, InsertSeparator }; -#if !([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000) TQString title; TQPopupMenu *popup; -#endif }; class TQInputContext : public TQObject { + Q_OBJECT TQ_OBJECT public: TQInputContext( TQObject *tqparent = 0 ); @@ -94,13 +88,8 @@ public: virtual bool isComposing() const; virtual bool isPreeditRelocationEnabled(); -#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000) - virtual TQList actions(); - void addActionsTo( TQMenu *menu, TQInputContextMenu::Action action = TQInputContextMenu::InsertSeparator ); -#else virtual TQPtrList *menus(); void addMenusTo( TQPopupMenu *popup, TQInputContextMenu::Action action = TQInputContextMenu::InsertSeparator ); -#endif #if defined(TQ_WS_X11) // these functions are not recommended for ordinary use diff --git a/tqtinterface/qt4/src/kernel/tqinputcontext_x11.cpp b/tqtinterface/qt4/src/kernel/tqinputcontext_x11.cpp index e96c75c..7f7b68e 100644 --- a/tqtinterface/qt4/src/kernel/tqinputcontext_x11.cpp +++ b/tqtinterface/qt4/src/kernel/tqinputcontext_x11.cpp @@ -66,4 +66,9 @@ \sa filterEvent() */ -#endif //TQ_NO_IM \ No newline at end of file +bool TQInputContext::x11FilterEvent( TQWidget *keywidget, XEvent *event ) +{ + return FALSE; +} + +#endif //TQ_NO_IM diff --git a/tqtinterface/qt4/src/kernel/tqnamespace.h b/tqtinterface/qt4/src/kernel/tqnamespace.h index d3919c9..6c0f05a 100644 --- a/tqtinterface/qt4/src/kernel/tqnamespace.h +++ b/tqtinterface/qt4/src/kernel/tqnamespace.h @@ -491,7 +491,8 @@ typedef Qt::Orientation Orientation; WindowsStyle, Win3Style, PMStyle, - MotifStyle + MotifStyle, + GtkStyle = 6 // Gtk compability mode }; #else // USE_QT4 @@ -513,7 +514,7 @@ typedef Qt::Orientation Orientation; enum GUIStyle { WindowsStyle = 1, // ### TQt 4.0: either remove the obsolete enums or clean up compat vs. MotifStyle = 4, // ### TQT_NO_COMPAT by reordering or combination into one enum. - GtkStyle = 6 // Gtk compability mode + GtkStyle = 6 // Gtk compability mode }; #else enum GUIStyle { @@ -522,7 +523,7 @@ typedef Qt::Orientation Orientation; Win3Style, // OBSOLETE PMStyle, // OBSOLETE MotifStyle, - GtkStyle = 6 // Gtk compability mode + GtkStyle = 6 // Gtk compability mode }; #endif diff --git a/tqtinterface/qt4/src/kernel/tqpixmap_x11.cpp b/tqtinterface/qt4/src/kernel/tqpixmap_x11.cpp index 2a497e5..a16235c 100644 --- a/tqtinterface/qt4/src/kernel/tqpixmap_x11.cpp +++ b/tqtinterface/qt4/src/kernel/tqpixmap_x11.cpp @@ -42,30 +42,6 @@ #include "tqplatformdefs.h" -#if defined(Q_OS_WIN32) && defined(TQT_MITSHM) -#undef TQT_MITSHM -#endif - -#ifdef TQT_MITSHM - -// Use the MIT Shared Memory extension for pixmap<->image conversions -#define TQT_MITSHM_CONVERSIONS - -// Uncomment the next line to enable the MIT Shared Memory extension -// for TQPixmap::xForm() -// -// WARNING: This has some problems: -// -// 1. Consumes a 800x600 pixmap -// 2. TQt does not handle the ShmCompletion message, so you will -// get strange effects if you xForm() repeatedly. -// -// #define TQT_MITSHM_XFORM - -#if defined(TQ_OS_WIN32) && defined(TQT_MITSHM) -#undef TQT_MITSHM -#endif - #include "tqplatformdefs.h" #include "tqbitmap.h" @@ -2515,4 +2491,4 @@ TQ_EXPORT void copyBlt( TQPixmap *dst, int dx, int dy, #endif // TQT_NO_XFTFREETYPE } -#endif // USE_QT4 \ No newline at end of file +#endif // USE_QT4 diff --git a/tqtinterface/qt4/src/kernel/tqwidget.h b/tqtinterface/qt4/src/kernel/tqwidget.h index 65b424e..0a75dad 100644 --- a/tqtinterface/qt4/src/kernel/tqwidget.h +++ b/tqtinterface/qt4/src/kernel/tqwidget.h @@ -351,6 +351,9 @@ public: void setMask( const QBitmap ); void setMask( const QRegion ); + void sendMouseEventToInputContext( int x, TQEvent::Type type, TQt::ButtonState button, TQt::ButtonState state ); + TQInputContext *getInputContext(); + #ifndef TQT_NO_STYLE void setStyle( TQStyle * ); TQStyle* setStyle( const TQString& ); @@ -541,6 +544,12 @@ private: friend class TQObject; +protected: + virtual TQWidget *icHolderWidget(); + +private: + void createInputContext(); + public Q_SLOTS: virtual void tqsetUpdatesEnabled( bool enable ); void tqrepaint(); @@ -570,6 +579,21 @@ public Q_SLOTS: Q_SIGNALS: void destroyed( TQObject* obj ); + +public: +#if defined(TQ_WS_X11) + enum X11WindowType { + X11WindowTypeSelect, + X11WindowTypeCombo, + X11WindowTypeDND, + X11WindowTypeTooltip, + X11WindowTypeMenu, // torn-off + X11WindowTypeDropdown, + X11WindowTypePopup + }; + void x11SetWindowType( X11WindowType type = X11WindowTypeSelect ); + void x11SetWindowTransient( TQWidget* tqparent ); +#endif }; inline void TQWidget::drawText( const TQPoint &p, const TQString &s ) diff --git a/tqtinterface/qt4/src/kernel/tqwidget_x11.cpp b/tqtinterface/qt4/src/kernel/tqwidget_x11.cpp index c6e7abb..0a60833 100644 --- a/tqtinterface/qt4/src/kernel/tqwidget_x11.cpp +++ b/tqtinterface/qt4/src/kernel/tqwidget_x11.cpp @@ -291,6 +291,169 @@ void TQWidget::drawText( int x, int y, const TQString &str ) } } +void TQWidget::createInputContext() +{ +#if 0 +// #if !defined(TQT_NO_IM_EXTENSIONS) + if( !isInputMethodEnabled() || TQApplication::closingDown() ) + return; +// #endif + + TQWidget *icWidget = icHolderWidget(); +#ifndef TQT_NO_IM +#if !defined(TQT_NO_IM_EXTENSIONS) + TQInputContext **qicp = &icWidget->ic; +#else + TQInputContext **qicp = (TQInputContext **)&icWidget->topData()->xic; +#endif + + if ( ! *qicp ) { + // an input context of the default input method is generated. + TQInputContext *qic = TQInputContextFactory::create( TQApplication::defaultInputMethod(), icWidget ); + + *qicp = qic; + if ( qic ) { + TQObject::connect( TQT_TQOBJECT(qic), TQT_SIGNAL(imEventGenerated(TQObject *,TQIMEvent *)), + tqApp, TQT_SLOT(postIMEvent(TQObject *,TQIMEvent *)) ); + TQObject::connect( TQT_TQOBJECT(qic), TQT_SIGNAL(deletionRequested()), + icWidget, TQT_SLOT(destroyInputContext()) ); + } + } +#endif // TQT_NO_IM +#else + printf("[WARNING] TQWidget::createInputContext() UNIMPLEMENTED\n\r"); fflush(stdout); +#endif +} + +/*! + This function returns the TQInputContext instance for this widget. + This instance is used for text input to this widget, etc. + It is simply the accessor function. +*/ +TQInputContext *TQWidget::getInputContext() +{ +#if 0 + TQInputContext *qic = 0; + +// #if !defined(TQT_NO_IM_EXTENSIONS) + if ( isInputMethodEnabled() ) { +#if !defined(TQT_NO_IM_EXTENSIONS) + qic = icHolderWidget()->ic; +#else +// { + // icHolderWidget is always tqtopLevelWidget + TQTLWExtra *topdata = icHolderWidget()->topData(); + qic = (TQInputContext *)topdata->xic; +#endif + } + + return qic; +#else + printf("[WARNING] TQWidget::getInputContext() UNIMPLEMENTED\n\r"); fflush(stdout); + return 0; +#endif +} + +/*! + This function returns the widget holding the TQInputContext + instance for this widget. The instance is used for text input to + this widget, switching input method, etc. + + By default, this function delegates the role of returning input + context holder widget to TQApplication::locateICHolderWidget(). + + This definition enables application developer to change the + mapping of widgets to TQInputContext instance simply by overriding + TQApplication::locateICHolderWidget(). + + \sa TQApplication::locateICHolderWidget() +*/ +TQWidget *TQWidget::icHolderWidget() +{ +#if 0 + return tqApp->locateICHolderWidget(this); +#else + printf("[WARNING] TQWidget::icHolderWidget() UNIMPLEMENTED\n\r"); fflush(stdout); + return 0; +#endif +} + +void TQWidget::sendMouseEventToInputContext( int x, TQEvent::Type type, TQt::ButtonState button, TQt::ButtonState state ) { +#if 0 +#ifndef TQT_NO_IM + // trigger input context creation if it hasn't happened already + createInputContext(); + + TQInputContext *qic = getInputContext(); + if ( qic ) { + // may be causing reset() in some input methods + qic->mouseHandler( x, type, button, state ); + } +#endif // TQT_NO_IM +#else + printf("[WARNING] TQWidget::sendMouseEventToInputContext() UNIMPLEMENTED\n\r"); fflush(stdout); +#endif +} + +void TQWidget::x11SetWindowTransient( TQWidget* tqparent ) +{ + XSetTransientForHint( x11Display(), winId(), tqparent->winId()); +} + +// Sets the EWMH (netwm) window type. Needed as a separate function +// because create() may be too soon in some cases. +void TQWidget::x11SetWindowType( X11WindowType type ) +{ + // NET window types + long net_wintypes[7] = { 0, 0, 0, 0, 0, 0, 0 }; + int curr_wintype = 0; + if( testWFlags(WType_Desktop)) + return; + if( type == X11WindowTypeSelect ) { + if ( testWFlags(WStyle_Splash)) { + if (qt_net_supports(qt_net_wm_window_type_splash)) { + net_wintypes[curr_wintype++] = qt_net_wm_window_type_splash; + } + } else if (inherits(TQTOOLBAR_OBJECT_NAME_STRING)) { + // toolbar netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_toolbar; + } else if (testWFlags(WStyle_Customize) && testWFlags(WStyle_Tool)) { + // utility netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_utility; + } else if (testWFlags(WType_Dialog)) { + // dialog netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_dialog; + } + } else if( type == X11WindowTypeCombo ) { + // combo netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_combo; + } else if( type == X11WindowTypeDND ) { + // dnd netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_dnd; + } else if( type == X11WindowTypeDropdown ) { + // dropdown netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_dropdown_menu; + } else if( type == X11WindowTypePopup ) { + // popup netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_popup_menu; + } else if( type == X11WindowTypeMenu ) { + // menu netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_menu; + } else if( type == X11WindowTypeTooltip ) { + // tooltip netwm type + net_wintypes[curr_wintype++] = qt_net_wm_window_type_tooltip; + } + + // normal netwm type - default + net_wintypes[curr_wintype++] = qt_net_wm_window_type_normal; + // set _NET_WM_WINDOW_TYPE + if (curr_wintype > 0) + XChangeProperty(x11Display(), winId(), qt_net_wm_window_type, XA_ATOM, 32, PropModeReplace, + (unsigned char *) net_wintypes, curr_wintype); + else + XDeleteProperty(x11Display(), winId(), qt_net_wm_window_type); +} + #else // USE_QT4 // NOT REVISED -- cgit v1.2.1