summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/src/kernel/tqwidget_x11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tqtinterface/qt4/src/kernel/tqwidget_x11.cpp')
-rw-r--r--tqtinterface/qt4/src/kernel/tqwidget_x11.cpp163
1 files changed, 163 insertions, 0 deletions
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