Apply all Qt3.3.8d patches

NOTE: This will *likely* break compilation of TQt4
Please wait a few days for fixes to be committed as needed!
pull/1/head
Timothy Pearson 14 years ago
parent d7be169483
commit d3f7a9d6f1

File diff suppressed because it is too large Load Diff

@ -0,0 +1,107 @@
immodule for TQt
* What is this?
immodule for TQt is a modular, extensible input method subsystem for
TQt.
This project brings functionality similar to the immodule for GTK+
to the TQt library. The main goal of the project is to extend and
enhance the input method support in the TQt library, in order to
provide a modern and powerful multi-language input system. Our short
term goal is to make TQt (especially TQt/X11) "up-to-date" with other
X11-based toolkits such as GTK+. We are also focusing on what the
input method API should be for future TQt versions.
See our webpage for further information.
http://immodule-qt.freedesktop.org/
* About this release
qt-x11-immodule-unified-qt3.3.3-20040910 is a stable release. Since
it breaks backward compatibility (source and binary) about immodule
with our previous releases qt-x11-immodule-unified-qt3.3.3-20040819
and qt-x11-immodule-bc-qt3.3.2-20040623, optional immodule plugins
must be updated to proper version. See 'Optional immodule plugins'
section of our download page.
http://immodule-qt.freedesktop.org/Software/ImmoduleTQtDownload
However, backward compatibility (source and binary) with normal TQt
3.3.3 is kept in 'Binary Compatible' mode.
* How to install
After extract the TQt archive, perform following instructions
cd qt-x11-free-3.3.3
patch -p0 < qt-x11-immodule-unified-qt3.3.3-20040910.diff
./make-symlinks.sh
./configure
Our patch provides following two configure options. Choose 'Binary
Compatible' for normal use.
Build TQt with 'Binary Compatible' immodule support (default)
configure -inputmethod
Build TQt without binary compatibility, but supports more advanced
immodule extensions. It cannot be used with ordinary application
binaries (i.e. the option is for developers)
configure -inputmethod -inputmethod-ext
* How to use
- See users manual of each input method plugins
- Run qtconfig to choose your favorite XIM input style
* Environment variables
Some environment variables are available for expert users and system
integrators. The specification is preliminary and may be changed
without notification. Be careful.
See following examples to use the variables.
- set "xim" input method as default
export TQT_IM_MODULE=xim
- set "simple" composing input method as default
export TQT_IM_MODULE=simple
- set "xim" input method as default, and disable input method
selection menu in the context menu
export TQT_IM_SWITCHER=imsw-none
export TQT_IM_MODULE=xim
- set "xim" input method as default, and enable input method
selection menu in the context menu (default configuration)
export TQT_IM_SWITCHER=imsw-multi
export TQT_IM_MODULE=xim
- set "iiimqcf" that has its own input method switching framework as
default, and disable input method selection menu in the context
menu. Such configuration is required by some system integrators to
provide unified user interface for global input method switching
over the desktop
export TQT_IM_SWITCHER=imsw-none
export TQT_IM_MODULE=iiimqcf

@ -0,0 +1,248 @@
This file describes significant change from
qt-x11-immodule-bc-qt3.3.2-20040623.
Differences from previous release
(qt-x11-immodule-unified-qt3.3.3-20040819) are itemized with '+'
sign. Search it to track incremental change.
****************************************************************************
* For users *
****************************************************************************
General
-------
+ A strange character inversion problem on some input methods has been
fixed
Input methods
-------------
- Added "simple" input method which provides dead/multi key composing
for latin languages
User Interface
--------------
- Added input method selection menu in the context menu of text
widgets
Configuration
-------------
+ default IM configuration feature of qtconfig has been disabled in BC
mode. This is a political change to avoid the confusion about input
method configuration in accordance with GTK+ environment.
See following discussion for further information.
http://freedesktop.org/pipermail/immodule-qt/2004-August/000416.html
- Added new environment variables TQT_IM_SWITCHER and TQT_IM_MODULE to
set user's favorite input method as default. See README.immodule for
examples.
Build & Install
---------------
+ configure options have been changed for internal reasons. See 'How
to install' section of README.immodule
- This version of immodule requires corresponding version of each
input method plugins (i.e. update your additional input method
plugins)
- Plugin directory has been changed from $TQTDIR/plugins/input/ to
$TQTDIR/plugins/inputmethods/. Delete old directory.
- Some codes have been changed to allow compiling against TQt 3.2.x or
earlier.
****************************************************************************
* For develpers *
****************************************************************************
Documents
---------
- Almost description of TQInputContext and TQInputContextPlugin has been
filled. Feel free to ask obscure things at our mailinglist.
New features
------------
- Pluggable input method switcher
Now we can write input method switcher as an ordinary input method
plugin. The two plugins 'imsw-multi' and 'imsw-none' are provided as
default. But the architecture needs more discussion about whether
the design is right or not. Join the discussion.
- Pluggable popup menu
Any input method can provide its own popup menu. See
http://freedesktop.org/pipermail/immodule-qt/2004-August/000266.html
for further information.
- TQInputContext proxying
Some methods of TQInputContext have been changed to enable
TQInputContext proxying. This feature is required to implement
pluggable input method switcher.
General
-------
+ TQInputContext has been source compatible with TQt4 version. Basic
input method plugin can be source compatible without #ifdef. Only
pluggable popup menu requires #ifdef'ed different code. In addition,
be careful about use of classes that is deprecated in TQt4.
- Our two development tree for TQt3 'Binary Compatible' and 'ALL' have
been merged into this unified source tree. The source tree is called
'Unified' patch.
- 'dead keys' for latin languages have been added into TQt::Key
- Added plugins/src/inputmethods directory to build input method
plugins within the TQt source tree. The directory name 'inputmethods'
is intended to be compatible with TQt/Embedded. Install directory
name is still kept as 'input' for backward compatibility
- Changed XIM input method to a plugin instead of directly link into
libqt
- Plugin directory has been changed from $TQTDIR/plugins/input/ to
$TQTDIR/plugins/inputmethods/. Replace install directory with new
one.
- Fixed some bugs in previous qt-x11-immodule-bc-qt3.3.2-20040623. See
following log for more detail.
* src/kernel/tqwidget_x11.cpp
- (destroyInputContext): Replace the code with original Simplified
API patch. See the comment to recognize the original intention
- (focusInputContext): Fix a condition to call qic->setFocus() as
originally written. See added comment to recognize the original
intention
- TQLocale dependency has been removed to be compiled on TQt 3.2.x or
earlier
- Many internal improvements and cleanups
API Changes in qt-x11-immodule-unified-qt3.3.3-20040910
-------------------------------------------------------
+ TQInputContext
* TQInputContext()
Added 'tqparent' arg to be compatible with TQt4. Since the arg
defaults to 0, no modification of plugins are required.
* language()
* identifierName()
Return type of these two methods have been changed from TQCString
which is deprecated in TQt4 to TQString to make plugins source
compatible with TQt4.
* addActionsTo()
New method for TQt4 text widget developer
API Changes in qt-x11-immodule-unified-qt3.3.3-20040812
-------------------------------------------------------
- TQInputContext proxying
TQInputContext have been changed as follows to enable TQInputContext
proxying.
1. Use signal to deliver TQIMEvent instead of explicit
postEvent(). This enables TQIMEvent proxying and better platform
abstraction. Corresponding slot is created as
TQApplication::imEventReceived().
2. Move some methods of TQInputContext to public from protected or
private. This enables that proxy-IM can access slave methods.
3. Make some methods of TQInputContext virtual. This enables
overriding the methods as proxy
4. Rename TQInputContext::name() to identifierName() to avoid
conflicting with TQObject::name()
- TQInputContext
* language()
New method to indicate current language
* menus()
New method for the pluggable popup menu feature
* addMenusTo()
New method for text widget developer
* deletionRequested()
New signal to request deletion of this instance. This is added for
fatal error handling
* identifierName()
This replaces name() of previous API to avoid conflicting with
TQObject::name(), and to distinguish the role from displayName()
* filterEvent()
Turn the argument into const. See
http://freedesktop.org/pipermail/immodule-qt/2004-August/000335.html
for further information
* isComposing
* isPreeditRelocationEnabled
Move to public from protected to allow proxying
* setFocusWidget
* setHolderWidget
* releaseComposingWidget
Move to public from private to allow proxying
* tqfocusWidget
* holderWidget
- Make public from protected to allow proxying
- Make virtual to allow overriding the method as proxy
- TQInputContextPlugin
* languages()
New method which returns what languages are supported by the
TQInputContext instance
* displayName()
New method which returns a user friendly i18n-ized name of the
TQInputContext instance
* description()
New method which returns a i18n-ized brief description of the
TQInputContext instance

@ -34,7 +34,44 @@ SUPPORTED=
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# need that throughout the script # need that throughout the script
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown DPKG_ARCH=`(dpkg-architecture -qDEB_HOST_ARCH) 2>/dev/null` || UNAME_MACHINE=unknown
case $DPKG_ARCH in
amd64)
UNAME_MACHINE="x86_64"
;;
arm)
UNAME_MACHINE="armv4l"
;;
armel)
UNAME_MACHINE="armv5tel"
;;
hppa)
UNAME_MACHINE="parisc64"
;;
hurd-i386)
UNAME_MACHINE="i686-AT386"
;;
i386)
UNAME_MACHINE="i686"
;;
kfreebsd-amd64)
UNAME_MACHINE="x86_64"
;;
kfreebsd-i386)
UNAME_MACHINE="i586"
;;
mipsel)
UNAME_MACHINE="mips"
;;
powerpc)
UNAME_MACHINE="ppc"
;;
*)
UNAME_MACHINE="$DPKG_ARCH"
;;
esac
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
@ -81,7 +118,7 @@ Edition="free"
Licensee="Free" Licensee="Free"
Products="qt-free" Products="qt-free"
MODULES="styles tools kernel widgets dialogs iconview workspace" MODULES="styles tools kernel widgets dialogs iconview workspace inputmethod"
MODULES="$MODULES network canvas table xml opengl sql" MODULES="$MODULES network canvas table xml opengl sql"
CFG_MODULES_AVAILABLE=$MODULES CFG_MODULES_AVAILABLE=$MODULES
QMAKE_VARS="$QMAKE_VARS \"TQT_PRODUCT=$Products\"" QMAKE_VARS="$QMAKE_VARS \"TQT_PRODUCT=$Products\""
@ -126,6 +163,9 @@ CFG_SQL_AVAILABLE=
CFG_SQL_AUTODETECTED= CFG_SQL_AUTODETECTED=
CFG_GFX_AVAILABLE= CFG_GFX_AVAILABLE=
CFG_STYLE_AVAILABLE= CFG_STYLE_AVAILABLE=
#Keep this position for CFG_IM* to avoid patch rejection
CFG_IM=yes
CFG_IM_EXT=no
CFG_TABLET=auto CFG_TABLET=auto
CFG_XKB=auto CFG_XKB=auto
CFG_NIS=auto CFG_NIS=auto
@ -257,6 +297,12 @@ while [ "$#" -gt 0 ]; do
VAR=fatal_error VAR=fatal_error
VAL=no VAL=no
;; ;;
#TQt style yes options for immodule
#Keep this place to avoid patch rejection
-inputmethod|-inputmethod-ext)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
-embedded) -embedded)
VAR=embedded VAR=embedded
# this option may or may not be followed by an argument # this option may or may not be followed by an argument
@ -876,6 +922,20 @@ while [ "$#" -gt 0 ]; do
dlopen-opengl) dlopen-opengl)
CFG_DLOPEN_OPENGL="$VAL" CFG_DLOPEN_OPENGL="$VAL"
;; ;;
inputmethod)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_IM="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
inputmethod-ext)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_IM_EXT="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
*) *)
UNKNOWN_OPT=yes UNKNOWN_OPT=yes
;; ;;
@ -1181,7 +1241,7 @@ if [ "$CFG_EMBEDDED" != "no" ]; then
XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++" XPLATFORM="qws/solaris-$CFG_EMBEDDED-g++"
fi fi
;; ;;
Linux:*) Linux:*|GNU:*|GNU/*:*)
if [ -z "$PLATFORM" ]; then if [ -z "$PLATFORM" ]; then
case "$UNAME_MACHINE" in case "$UNAME_MACHINE" in
*86) *86)
@ -1236,9 +1296,6 @@ if [ -z "$PLATFORM" ]; then
QNX:*) QNX:*)
PLATFORM=qnx-g++ PLATFORM=qnx-g++
;; ;;
GNU:*)
PLATFORM=hurd-g++
;;
dgux:*) dgux:*)
PLATFORM=dgux-g++ PLATFORM=dgux-g++
;; ;;
@ -1285,7 +1342,7 @@ if [ -z "$PLATFORM" ]; then
- Also available for Tru64: tru64-g++ - Also available for Tru64: tru64-g++
" "
;; ;;
Linux:*) Linux:*|GNU:*|GNU/*:*)
PLATFORM=linux-g++ PLATFORM=linux-g++
PLATFORM_NOTES=" PLATFORM_NOTES="
- Also available for Linux: linux-kcc linux-icc linux-cxx - Also available for Linux: linux-kcc linux-icc linux-cxx
@ -1482,7 +1539,7 @@ if echo $MODULES | grep sql >/dev/null; then
ODBC_REQ="-lodbc sql.h sqlext.h" ODBC_REQ="-lodbc sql.h sqlext.h"
TDS_REQ="-lsybdb sybfront.h sybdb.h" TDS_REQ="-lsybdb sybfront.h sybdb.h"
DB2_REQ="-ldb2 sqlcli.h sqlcli1.h" DB2_REQ="-ldb2 sqlcli.h sqlcli1.h"
IBASE_REQ="-lgds ibase.h" IBASE_REQ="-lfbclient ibase.h"
for _SQLDR in $CFG_SQL_AVAILABLE; do for _SQLDR in $CFG_SQL_AVAILABLE; do
case $_SQLDR in case $_SQLDR in
mysql) mysql)
@ -1755,6 +1812,13 @@ if [ "$PLATFORM_QWS" = "yes" ]; then
CFG_GFX_AVAILABLE=`echo $CFG_GFX_AVAILABLE` CFG_GFX_AVAILABLE=`echo $CFG_GFX_AVAILABLE`
fi fi
# immodule extensions
if [ "$CFG_IM" = "no" ]; then
CFG_IM_EXT=no
fi
if [ "$CFG_IM_EXT" = "yes" ]; then
CFG_IM=yes
fi
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# help - interactive parts of the script _after_ this section please # help - interactive parts of the script _after_ this section please
@ -2062,6 +2126,20 @@ if [ "$PLATFORM_X11" = "yes" ]; then
XKY="*" XKY="*"
XKN=" " XKN=" "
fi fi
if [ "$CFG_IM" = "no" ]; then
IMY=" "
IMN="*"
else
IMY="*"
IMN=" "
fi
if [ "$CFG_IM_EXT" = "no" ]; then
IXY=" "
IXN="*"
else
IXY="*"
IXN=" "
fi
cat << EOF cat << EOF
Qt/X11 only: Qt/X11 only:
@ -2110,6 +2188,14 @@ Qt/X11 only:
-dlopen-opengl ..... Qt uses dlopen(3) to resolve OpenGL functions -dlopen-opengl ..... Qt uses dlopen(3) to resolve OpenGL functions
(instead of linking with OpenGL libraries directly). (instead of linking with OpenGL libraries directly).
$IMN -no-inputmethod .... Do not compile immodule (extensible input method)
support.
$IMY -inputmethod ....... Compile immodule support.
$IXN -no-inputmethod-ext Do not compile more immodule extensions support.
$IXY -inputmethod-ext ... Compile more immodule extensions support.
(breaks ABI with standard TQt3).
EOF EOF
fi fi
@ -2665,6 +2751,16 @@ if [ "$PLATFORM_X11" = "yes" ]; then
if [ "$CFG_XKB" = "yes" ]; then if [ "$CFG_XKB" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG xkb" QMAKE_CONFIG="$QMAKE_CONFIG xkb"
fi fi
if [ "$CFG_IM" = "yes" ]; then
TQMAKE_CONFIG="$TQMAKE_CONFIG inputmethod"
elif [ "$CFG_IM" = "no" ]; then
TQCONFIG_FLAGS="$TQCONFIG_FLAGS TQT_NO_IM"
fi
if [ "$CFG_IM_EXT" = "yes" ]; then
TQMAKE_CONFIG="$TQMAKE_CONFIG inputmethod-ext"
elif [ "$CFG_IM_EXT" = "no" ]; then
TQCONFIG_FLAGS="$TQCONFIG_FLAGS TQT_NO_IM_EXTENSIONS"
fi
elif [ "$PLATFORM_MAC" = "yes" ]; then elif [ "$PLATFORM_MAC" = "yes" ]; then
if [ "$CFG_TABLET" = "yes" ]; then if [ "$CFG_TABLET" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG tablet" QMAKE_CONFIG="$QMAKE_CONFIG tablet"
@ -2760,15 +2856,15 @@ case "$COMPILER" in
g++*) g++*)
# GNU C++ # GNU C++
QMAKE_CONF_COMPILER=`grep "QMAKE_CXX[^_A-Z0-9a-z]" $QMAKESPEC/qmake.conf | sed "s,.* *= *\(.*\)$,\1,"` QMAKE_CONF_COMPILER=`grep "QMAKE_CXX[^_A-Z0-9a-z]" $QMAKESPEC/qmake.conf | sed "s,.* *= *\(.*\)$,\1,"`
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} --version 2>/dev/null` COMPILER_VERSION=`${QMAKE_CONF_COMPILER} --version 2>/dev/null | sed 's,^[^0-9]*,,g'`
case "$COMPILER_VERSION" in case "$COMPILER_VERSION" in
*2.95.*) 2.95.*)
COMPILER_VERSION="2.95.*" COMPILER_VERSION="2.95.*"
;; ;;
*3.*) 3.*)
COMPILER_VERSION="3.*" COMPILER_VERSION="3.*"
;; ;;
*4.*) 4.*)
COMPILER_VERSION="4" COMPILER_VERSION="4"
;; ;;
*) *)
@ -2789,7 +2885,7 @@ esac
# minimal-config small-config medium-config large-config full-config # minimal-config small-config medium-config large-config full-config
# #
# Modules: # Modules:
# styles tools kernel widgets dialogs iconview workspace # styles tools kernel widgets dialogs iconview workspace inputmethod
# #
# Enterprise/Open Source edition modules: # Enterprise/Open Source edition modules:
# network canvas table xml opengl sql # network canvas table xml opengl sql
@ -2797,6 +2893,8 @@ esac
# Options: # Options:
# stl # stl
# #
# X11 : inputmethod-ext
#
# Things that do not affect the Qt API/ABI: # Things that do not affect the Qt API/ABI:
# system-jpeg no-jpeg jpeg # system-jpeg no-jpeg jpeg
# system-mng no-mng mng # system-mng no-mng mng
@ -2818,10 +2916,10 @@ esac
# tablet # tablet
# ipv6 # ipv6
# #
# X11 : xftnameunparse x11sm xinerama xcursor xrandr xrender xftfreetype xkb # X11 : xftnameunparse x11sm xinerama xcursor xrandr xrender xftfreetype xkb inputmethod
# Embedded: embedded ft # Embedded: embedded ft
# #
ALL_OPTIONS="styles tools kernel widgets dialogs iconview workspace network canvas table xml opengl sql stl" ALL_OPTIONS="styles tools kernel widgets dialogs iconview workspace inputmethod network canvas table xml opengl sql stl"
BUILD_CONFIG= BUILD_CONFIG=
BUILD_OPTIONS= BUILD_OPTIONS=
@ -2835,7 +2933,7 @@ for config_option in $QMAKE_CONFIG; do
BUILD_CONFIG="$config_option" BUILD_CONFIG="$config_option"
;; ;;
styles|tools|kernel|widgets|dialogs|iconview|workspace|network|canvas|table|xml|opengl|sql|stl) styles|tools|kernel|widgets|dialogs|iconview|workspace|inputmethod|network|canvas|table|xml|opengl|sql|stl)
# these config options affect the Qt API/ABI. they should influence # these config options affect the Qt API/ABI. they should influence
# the generation of the buildkey, so we don't skip them # the generation of the buildkey, so we don't skip them
SKIP="no" SKIP="no"
@ -3182,6 +3280,8 @@ if [ "$PLATFORM_X11" = "yes" ]; then
echo "XRender support ..... $CFG_XRENDER" echo "XRender support ..... $CFG_XRENDER"
echo "Xft support ......... $CFG_FREETYPE" echo "Xft support ......... $CFG_FREETYPE"
echo "XKB Support ......... $CFG_XKB" echo "XKB Support ......... $CFG_XKB"
echo "immodule support .... $CFG_IM"
echo "immodule ext support $CFG_IM_EXT"
elif [ "$PLATFORM_MAC" = "yes" ]; then elif [ "$PLATFORM_MAC" = "yes" ]; then
echo "Accessibility ....... $CFG_ACCESSIBILITY" echo "Accessibility ....... $CFG_ACCESSIBILITY"
echo "Tablet support ...... $CFG_TABLET" echo "Tablet support ...... $CFG_TABLET"
@ -3207,7 +3307,7 @@ EXEC=""
echo "Finding project files. Please wait..." echo "Finding project files. Please wait..."
if [ -z "$QMAKE_PROJECTS" ]; then if [ -z "$QMAKE_PROJECTS" ]; then
QMAKE_PROJECTS=`find $relpath/. -name '*.pro' -print | sed 's-/\./-/-'` QMAKE_PROJECTS=`find $relpath/. -name '.pc' -prune -o -name '*.pro' -print | sed 's-/\./-/-'`
else else
TQT_PROJECTS= TQT_PROJECTS=
for a in `echo $QMAKE_PROJECTS`; do for a in `echo $QMAKE_PROJECTS`; do

@ -0,0 +1,12 @@
#!/bin/sh
cd include
rm -f q*.h
ln -s ../src/*/tq*.h .
ln -s ../extensions/*/src/q*.h .
ln -s ../tools/assistant/lib/qassistantclient.h .
ln -s ../tools/designer/uilib/qwidgetfactory.h .
rm -f q*_p.h
cd private
rm -f q*_p.h
ln -s ../../src/*/tq*_p.h .

@ -15,7 +15,7 @@ TQMAKE_LEX = flex
TQMAKE_LEXFLAGS = TQMAKE_LEXFLAGS =
TQMAKE_YACC = yacc TQMAKE_YACC = yacc
TQMAKE_YACCFLAGS = -d TQMAKE_YACCFLAGS = -d
TQMAKE_CFLAGS = TQMAKE_CFLAGS = -pipe
TQMAKE_CFLAGS_DEPS = -M TQMAKE_CFLAGS_DEPS = -M
TQMAKE_CFLAGS_WARN_ON = -Wall -W TQMAKE_CFLAGS_WARN_ON = -Wall -W
TQMAKE_CFLAGS_WARN_OFF = -w TQMAKE_CFLAGS_WARN_OFF = -w
@ -23,6 +23,7 @@ TQMAKE_CFLAGS_RELEASE = -O2
TQMAKE_CFLAGS_DEBUG = -g TQMAKE_CFLAGS_DEBUG = -g
TQMAKE_CFLAGS_SHLIB = -fPIC TQMAKE_CFLAGS_SHLIB = -fPIC
TQMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses TQMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
TQMAKE_CFLAGS_THREAD = -D_REENTRANT
TQMAKE_CXX = g++ TQMAKE_CXX = g++
TQMAKE_CXXFLAGS = $$TQMAKE_CFLAGS TQMAKE_CXXFLAGS = $$TQMAKE_CFLAGS
@ -33,6 +34,7 @@ TQMAKE_CXXFLAGS_RELEASE = $$TQMAKE_CFLAGS_RELEASE
TQMAKE_CXXFLAGS_DEBUG = $$TQMAKE_CFLAGS_DEBUG TQMAKE_CXXFLAGS_DEBUG = $$TQMAKE_CFLAGS_DEBUG
TQMAKE_CXXFLAGS_SHLIB = $$TQMAKE_CFLAGS_SHLIB TQMAKE_CXXFLAGS_SHLIB = $$TQMAKE_CFLAGS_SHLIB
TQMAKE_CXXFLAGS_YACC = $$TQMAKE_CFLAGS_YACC TQMAKE_CXXFLAGS_YACC = $$TQMAKE_CFLAGS_YACC
TQMAKE_CXXFLAGS_THREAD = $$TQMAKE_CFLAGS_THREAD
TQMAKE_INCDIR = TQMAKE_INCDIR =
TQMAKE_LIBDIR = TQMAKE_LIBDIR =
@ -51,14 +53,19 @@ TQMAKE_LFLAGS_DEBUG =
TQMAKE_LFLAGS_SHLIB = -shared TQMAKE_LFLAGS_SHLIB = -shared
TQMAKE_LFLAGS_PLUGIN = $$TQMAKE_LFLAGS_SHLIB TQMAKE_LFLAGS_PLUGIN = $$TQMAKE_LFLAGS_SHLIB
TQMAKE_LFLAGS_SONAME = -Wl,-soname, TQMAKE_LFLAGS_SONAME = -Wl,-soname,
TQMAKE_LFLAGS_THREAD =
TQMAKE_LIBS = # The following trick (TQMAKE_LIBS{,_THREAD}) is needed at the moment
TQMAKE_LIBS = -lpthread
TQMAKE_LIBS_DYNLOAD = -ldl TQMAKE_LIBS_DYNLOAD = -ldl
TQMAKE_LIBS_X11 = -lXext -lX11 -lm TQMAKE_LIBS_X11 = -lXext -lX11 -lm
TQMAKE_LIBS_X11SM = -lSM -lICE
TQMAKE_LIBS_NIS = -lnsl
TQMAKE_LIBS_QT = -lqt TQMAKE_LIBS_QT = -lqt
TQMAKE_LIBS_TQT_THREAD = -lqt-mt
TQMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu TQMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu
TQMAKE_LIBS_OPENGL_QT = -lGL -lXmu TQMAKE_LIBS_OPENGL_QT = -lGL -lXmu
TQMAKE_LIBS_THREAD =
TQMAKE_TQMOC = $(TQTDIR)/bin/tqmoc TQMAKE_TQMOC = $(TQTDIR)/bin/tqmoc
TQMAKE_UIC = $(TQTDIR)/bin/uic TQMAKE_UIC = $(TQTDIR)/bin/uic

@ -0,0 +1,89 @@
#
#
# qmake configuration for linux-g++
#
MAKEFILE_GENERATOR = UNIX
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl thread
TQMAKE_INCREMENTAL_STYLE = sublib
TQMAKE_CC = gcc
TQMAKE_LEX = flex
TQMAKE_LEXFLAGS =
TQMAKE_YACC = yacc
TQMAKE_YACCFLAGS = -d
TQMAKE_YACCFLAGS_MANGLE = -p $base -b $base
TQMAKE_YACC_HEADER = $base.tab.h
TQMAKE_YACC_SOURCE = $base.tab.c
TQMAKE_CFLAGS = -pipe -g
TQMAKE_CFLAGS_DEPS = -M
TQMAKE_CFLAGS_WARN_ON = -Wall -W
TQMAKE_CFLAGS_WARN_OFF = -w
TQMAKE_CFLAGS_RELEASE = -O1
TQMAKE_CFLAGS_DEBUG = -O0
TQMAKE_CFLAGS_SHLIB = -fPIC
TQMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
TQMAKE_CFLAGS_THREAD = -D_REENTRANT
TQMAKE_CXX = g++
TQMAKE_CXXFLAGS = $$TQMAKE_CFLAGS
TQMAKE_CXXFLAGS_DEPS = $$TQMAKE_CFLAGS_DEPS
TQMAKE_CXXFLAGS_WARN_ON = $$TQMAKE_CFLAGS_WARN_ON
TQMAKE_CXXFLAGS_WARN_OFF = $$TQMAKE_CFLAGS_WARN_OFF
TQMAKE_CXXFLAGS_RELEASE = $$TQMAKE_CFLAGS_RELEASE
TQMAKE_CXXFLAGS_DEBUG = $$TQMAKE_CFLAGS_DEBUG
TQMAKE_CXXFLAGS_SHLIB = $$TQMAKE_CFLAGS_SHLIB
TQMAKE_CXXFLAGS_YACC = $$TQMAKE_CFLAGS_YACC
TQMAKE_CXXFLAGS_THREAD = $$TQMAKE_CFLAGS_THREAD
TQMAKE_INCDIR =
TQMAKE_LIBDIR =
TQMAKE_INCDIR_X11 = /usr/X11R6/include
TQMAKE_LIBDIR_X11 = /usr/X11R6/lib
TQMAKE_INCDIR_QT = $(TQTDIR)/include
TQMAKE_LIBDIR_QT = $(TQTDIR)/lib
TQMAKE_INCDIR_OPENGL = /usr/X11R6/include
TQMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
TQMAKE_LINK = g++
TQMAKE_LINK_SHLIB = g++
TQMAKE_LFLAGS =
TQMAKE_LFLAGS_RELEASE =
TQMAKE_LFLAGS_DEBUG =
TQMAKE_LFLAGS_SHLIB = -shared
TQMAKE_LFLAGS_PLUGIN = $$TQMAKE_LFLAGS_SHLIB
TQMAKE_LFLAGS_SONAME = -Wl,-soname,
TQMAKE_LFLAGS_THREAD =
TQMAKE_RPATH =
TQMAKE_LIBS =
TQMAKE_LIBS_DYNLOAD = -ldl
TQMAKE_LIBS_X11 = -lXext -lX11 -lm
TQMAKE_LIBS_X11SM = -lSM -lICE
TQMAKE_LIBS_NIS = -lnsl
TQMAKE_LIBS_QT = -lqt
TQMAKE_LIBS_TQT_THREAD = -lqt-mt
TQMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu
TQMAKE_LIBS_OPENGL_QT = -lGL -lXmu
TQMAKE_LIBS_THREAD = -lpthread
TQMAKE_TQMOC = $(TQTDIR)/bin/tqmoc
TQMAKE_UIC = $(TQTDIR)/bin/uic
TQMAKE_AR = ar cqs
TQMAKE_RANLIB =
TQMAKE_TAR = tar -cf
TQMAKE_GZIP = gzip -9f
TQMAKE_COPY = cp -f
TQMAKE_COPY_FILE = $(COPY)
TQMAKE_COPY_DIR = $(COPY) -r
TQMAKE_MOVE = mv -f
TQMAKE_DEL_FILE = rm -f
TQMAKE_DEL_DIR = rmdir
TQMAKE_STRIP =
TQMAKE_STRIPFLAGS_LIB += --strip-unneeded
TQMAKE_CHK_DIR_EXISTS = test -d
TQMAKE_MKDIR = mkdir -p

@ -0,0 +1,107 @@
#ifndef TQPLATFORMDEFS_H
#define TQPLATFORMDEFS_H
// Get TQt defines/settings
#include "tqglobal.h"
// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
// DNS system header files are a mess!
// <resolv.h> includes <arpa/nameser.h>. <arpa/nameser.h> is using
// 'u_char' and includes <sys/types.h>. Now the problem is that
// <sys/types.h> defines 'u_char' only if __USE_BSD is defined.
// __USE_BSD is defined in <features.h> if _BSD_SOURCE is defined.
#ifndef _BSD_SOURCE
# define _BSD_SOURCE
#endif
// 1) need to reset default environment if _BSD_SOURCE is defined
// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
// 3) it seems older glibc need this to include the X/Open stuff
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <unistd.h>
// We are hot - unistd.h should have turned on the specific APIs we requested
#ifdef TQT_THREAD_SUPPORT
#include <pthread.h>
#endif
#include <dirent.h>
#include <fcntl.h>
#include <grp.h>
#include <pwd.h>
#include <signal.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/ipc.h>
#include <sys/time.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
// DNS header files are not fully covered by X/Open specifications.
// In particular nothing is said about res_* :/
// Header files <netinet/in.h> and <arpa/nameser.h> are not included
// by <resolv.h> on older versions of the GNU C library. Note that
// <arpa/nameser.h> must be included before <resolv.h>.
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#if !defined(TQT_NO_COMPAT)
#define TQT_STATBUF struct stat
#define TQT_STATBUF4TSTAT struct stat
#define TQT_STAT ::stat
#define TQT_FSTAT ::fstat
#define TQT_STAT_REG S_IFREG
#define TQT_STAT_DIR S_IFDIR
#define TQT_STAT_MASK S_IFMT
#define TQT_STAT_LNK S_IFLNK
#define TQT_FILENO fileno
#define TQT_OPEN ::open
#define TQT_CLOSE ::close
#define TQT_LSEEK ::lseek
#define TQT_READ ::read
#define TQT_WRITE ::write
#define TQT_ACCESS ::access
#define TQT_GETCWD ::getcwd
#define TQT_CHDIR ::chdir
#define TQT_MKDIR ::mkdir
#define TQT_RMDIR ::rmdir
#define TQT_OPEN_RDONLY O_RDONLY
#define TQT_OPEN_WRONLY O_WRONLY
#define TQT_OPEN_RDWR O_RDWR
#define TQT_OPEN_CREAT O_CREAT
#define TQT_OPEN_TRUNC O_TRUNC
#define TQT_OPEN_APPEND O_APPEND
#endif
#define TQT_SIGNAL_RETTYPE void
#define TQT_SIGNAL_ARGS int
#define TQT_SIGNAL_IGNORE SIG_IGN
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
#define TQT_SOCKLEN_T socklen_t
#else
#define TQT_SOCKLEN_T int
#endif
#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
#define TQT_SNPRINTF ::snprintf
#define TQT_VSNPRINTF ::vsnprintf
#endif
#define TQT_MITSHM
#endif // TQPLATFORMDEFS_H

@ -5,7 +5,7 @@
MAKEFILE_GENERATOR = UNIX MAKEFILE_GENERATOR = UNIX
TEMPLATE = app TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl CONFIG += qt warn_on release incremental link_prl thread
TQMAKE_INCREMENTAL_STYLE = sublib TQMAKE_INCREMENTAL_STYLE = sublib
TQMAKE_CC = gcc TQMAKE_CC = gcc

@ -102,5 +102,6 @@
#define TQT_VSNPRINTF ::vsnprintf #define TQT_VSNPRINTF ::vsnprintf
#endif #endif
#define TQT_MITSHM
#endif // TQPLATFORMDEFS_H #endif // TQPLATFORMDEFS_H

@ -0,0 +1,14 @@
TEMPLATE = lib
TARGET = qimsw-multi
DESTDIR = ../../../inputmethods
INCLUDEPATH += .
CONFIG += qt warn_on debug plugin
target.path += $$plugins.path/inputmethods
INSTALLS += target
# Input
HEADERS += qmultiinputcontext.h \
qmultiinputcontextplugin.h
SOURCES += qmultiinputcontext.cpp \
qmultiinputcontextplugin.cpp

@ -0,0 +1,379 @@
/****************************************************************************
** $Id$
**
** Implementation of TQMultiInputContext class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqmultiinputcontext.h"
#include <tqinputcontextfactory.h>
#include <tqstringlist.h>
#include <tqpopupmenu.h>
#ifndef TQT_NO_IM_EXTENSIONS
#include <tqsettings.h>
#endif
#include <cstdlib>
#define TQT_NO_IM_TQMULTIINPUTCONTEXT_IMINDEX
TQMultiInputContext::TQMultiInputContext()
: TQInputContext(), _slave( 0 ), imIndex( 0 ), cachedFocus( FALSE ),
cachedFocusWidget( 0 ), cachedHolderWidget( 0 ),
beIndirectlyConnected( FALSE ), popup( NULL ), currentIMKey( TQString() )
{
keyDict.setAutoDelete( true );
keyDict.clear();
if ( getenv( "TQT_IM_MODULE" ) ) {
currentIMKey = getenv( "TQT_IM_MODULE" );
} else {
#ifndef TQT_NO_IM_EXTENSIONS
TQSettings settings;
currentIMKey = settings.readEntry( "/qt/DefaultInputMethod", "xim" );
#else
currentIMKey = "xim";
#endif
}
}
TQMultiInputContext::~TQMultiInputContext()
{
keyDict.clear();
}
TQString TQMultiInputContext::identifierName()
{
return ( slave() ) ? slave()->identifierName() : "";
}
TQString TQMultiInputContext::language()
{
return ( slave() ) ? slave()->language() : "";
}
#if defined(TQ_WS_X11)
bool TQMultiInputContext::x11FilterEvent( TQWidget *keywidget, XEvent *event )
{
return ( slave() ) ? slave()->x11FilterEvent( keywidget, event ) : FALSE;
}
#endif // TQ_WS_X11
bool TQMultiInputContext::filterEvent( const TQEvent *event )
{
#if !defined(TQT_NO_IM_TQMULTIINPUTCONTEXT_IMINDEX)
if ( event->type() == TQEvent::KeyPress ) {
TQKeyEvent *keyevent = (TQKeyEvent *)event;
// filter selection key
// Control+Alt+Key_Down: change to next input method
// Control+Alt+Key_Up: change to previous input method
if ( ( keyevent->state() & TQt::ControlButton ) &&
( keyevent->state() & TQt::AltButton ) ) {
if ( keyevent->key() == TQt::Key_Up ) {
changeInputMethod( --imIndex );
return TRUE;
} else if ( keyevent->key() == TQt::Key_Down ) {
changeInputMethod( ++imIndex );
return TRUE;
}
}
}
#endif
return ( slave() ) ? slave()->filterEvent( event ) : FALSE;
}
void TQMultiInputContext::reset()
{
if ( slave() )
slave()->reset();
}
void TQMultiInputContext::setFocus()
{
cachedFocus = TRUE;
if ( slave() )
slave()->setFocus();
}
void TQMultiInputContext::unsetFocus()
{
cachedFocus = FALSE;
if ( slave() )
slave()->unsetFocus();
}
void TQMultiInputContext::setMicroFocus( int x, int y, int w, int h, TQFont *f )
{
if ( slave() )
slave()->setMicroFocus( x, y, w, h, f );
}
void TQMultiInputContext::mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState state )
{
if ( slave() )
slave()->mouseHandler( x, type, button, state );
}
TQFont TQMultiInputContext::font() const
{
return ( slave() ) ? slave()->font() : TQInputContext::font();
}
void TQMultiInputContext::destroyInputContext()
{
if ( _slave ) {
// _slave->reset() may not properly work in the case, so we
// manually resets the composing state of text widget
if ( _slave->tqfocusWidget() ) {
TQIMEvent *terminator = new TQIMEvent( TQEvent::IMEnd, TQString(), -1 );
emit imEventGenerated( _slave->tqfocusWidget(), terminator );
}
_slave->deleteLater();
_slave = 0;
}
}
/*!
This function is a placeholder for future experiment or extension
such as commit string snooping. set beIndirectlyConnected = TRUE
to activate this virtual function.
*/
void TQMultiInputContext::postIMEvent( TQObject *receiver, TQIMEvent *event )
{
emit imEventGenerated( receiver, event );
}
#if defined(TQ_WS_X11)
TQWidget *TQMultiInputContext::tqfocusWidget() const
{
return ( slave() ) ? slave()->tqfocusWidget() : 0;
}
TQWidget *TQMultiInputContext::holderWidget() const
{
return ( slave() ) ? slave()->holderWidget() : 0;
}
void TQMultiInputContext::setFocusWidget( TQWidget *w )
{
cachedFocusWidget = w;
if ( slave() )
slave()->setFocusWidget( w );
}
void TQMultiInputContext::setHolderWidget( TQWidget *w )
{
cachedHolderWidget = w;
if ( slave() )
slave()->setHolderWidget( w );
}
void TQMultiInputContext::releaseComposingWidget( TQWidget *w )
{
if ( slave() )
slave()->releaseComposingWidget( w );
}
#endif
bool TQMultiInputContext::isComposing() const
{
return ( slave() ) ? slave()->isComposing() : FALSE;
}
bool TQMultiInputContext::isPreeditRelocationEnabled()
{
return ( slave() ) ? slave()->isPreeditRelocationEnabled() : FALSE;
}
TQInputContext *TQMultiInputContext::slave()
{
if ( ! _slave ) {
#if !defined(TQT_NO_IM_TQMULTIINPUTCONTEXT_IMINDEX)
changeInputMethod( imIndex );
#else
changeInputMethod( currentIMKey );
#endif
}
return _slave;
}
const TQInputContext *TQMultiInputContext::slave() const
{
return _slave;
}
void TQMultiInputContext::changeInputMethod( int newIndex )
{
#if !defined(TQT_NO_IM_TQMULTIINPUTCONTEXT_IMINDEX)
TQStringList keys = TQInputContextFactory::keys();
if ( keys.size() == 0 )
return;
if ( newIndex >= (int)keys.size() ) {
imIndex = 0;
} else if ( newIndex < 0 ) {
imIndex = keys.size() - 1;
} else {
imIndex = newIndex;
}
changeInputMethod( keys[imIndex] );
#endif
}
void TQMultiInputContext::changeInputMethod( TQString key )
{
TQStringList keys = TQInputContextFactory::keys();
if ( keys.size() == 0 )
return;
if ( key.isEmpty() )
key = keys[0];
if ( _slave ) {
_slave->reset();
delete _slave;
}
_slave = TQInputContextFactory::create( key, cachedHolderWidget );
if ( _slave ) {
insertChild( _slave );
const char *method;
if ( beIndirectlyConnected ) {
method = TQT_SLOT(imEventReceived(TQObject *,TQIMEvent *));
} else {
method = TQT_SIGNAL(imEventGenerated(TQObject *,TQIMEvent *));
}
connect( _slave, TQT_SIGNAL(imEventGenerated(TQObject *,TQIMEvent *)),
this, method );
connect( _slave, TQT_SIGNAL(deletionRequested()),
this, TQT_SLOT(destroyInputContext()) );
if ( cachedFocus ) {
_slave->setFocus();
_slave->setFocusWidget( cachedFocusWidget );
}
currentIMKey = key;
//qDebug( "TQMultiInputContext::changeInputMethod(): index=%d, slave=%s",
// imIndex, (const char *)_slave->identifierName() );
}
}
TQPtrList<TQInputContextMenu> *TQMultiInputContext::menus()
{
TQInputContextMenu *imSelMenu = new TQInputContextMenu;
imSelMenu->title = tr( "Select Input &Method" );
imSelMenu->popup = createImSelPopup();
TQPtrList<TQInputContextMenu> *result = new TQPtrList<TQInputContextMenu>;
result->append( imSelMenu );
TQPtrList<TQInputContextMenu> *slaveMenus = ( slave() ) ? slave()->menus() : 0;
if ( slaveMenus ) {
for ( TQPtrList<TQInputContextMenu>::Iterator it = slaveMenus->begin();
it != slaveMenus->end();
++it ) {
TQInputContextMenu *slaveMenu = *it;
result->append( slaveMenu );
}
delete slaveMenus;
}
return result;
}
TQPopupMenu *TQMultiInputContext::createImSelPopup()
{
if ( popup )
delete popup;
popup = new TQPopupMenu();
keyDict.clear();
TQStringList keys = TQInputContextFactory::keys();
for ( uint i=0; i < keys.size(); i++ ) {
TQString idName = keys[i];
bool isIMSwitcher = idName.startsWith( "imsw-" );
if ( ! isIMSwitcher ) {
TQString dispName = TQInputContextFactory::displayName( idName );
if ( dispName.isEmpty() )
dispName = idName;
int id = popup->insertItem( dispName );
keyDict.insert( (long)id, new TQString( idName ) );
if ( idName == currentIMKey )
popup->setItemChecked( id, true );
TQString descriptionStr = TQInputContextFactory::description( idName );
if ( ! descriptionStr.isEmpty() )
popup->setWhatsThis( id, descriptionStr );
}
}
TQObject::connect( popup, TQT_SIGNAL(activated(int)),
this, TQT_SLOT(changeInputMethodWithMenuId(int)) );
return popup;
}
void TQMultiInputContext::changeInputMethodWithMenuId( int menuid )
{
TQString *key = keyDict.tqfind( (long)menuid );
changeInputMethod( (*key) );
}
#endif

@ -0,0 +1,124 @@
/****************************************************************************
** $Id$
**
** Definition of TQMultiInputContext class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQMULTIINPUTCONTEXT_H
#define TQMULTIINPUTCONTEXT_H
#ifndef TQT_NO_IM
#include <tqnamespace.h>
#include <tqwidget.h>
#include <tqinputcontext.h>
#include <tqguardedptr.h>
#include <tqintdict.h>
class TQPopupMenu;
class TQMultiInputContext : public TQInputContext
{
TQ_OBJECT
public:
TQMultiInputContext();
~TQMultiInputContext();
TQString identifierName();
TQString language();
#if defined(TQ_WS_X11)
bool x11FilterEvent( TQWidget *keywidget, XEvent *event );
#endif // TQ_WS_X11
bool filterEvent( const TQEvent *event );
void reset();
void setFocus();
void unsetFocus();
void setMicroFocus( int x, int y, int w, int h, TQFont *f = 0 );
void mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button, TQt::ButtonState state );
TQFont font() const;
bool isComposing() const;
bool isPreeditRelocationEnabled();
#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000)
TQPtrList<TQMenu> *qt4menus();
#endif
TQPtrList<TQInputContextMenu> *menus();
TQPopupMenu *createImSelPopup();
#if defined(TQ_WS_X11)
TQWidget *tqfocusWidget() const;
TQWidget *holderWidget() const;
void setFocusWidget( TQWidget *w );
void setHolderWidget( TQWidget *w );
void releaseComposingWidget( TQWidget *w );
#endif
public slots:
virtual void destroyInputContext();
virtual void postIMEvent( TQObject *receiver, TQIMEvent *event );
protected slots:
void changeInputMethodWithMenuId( int menuid );
protected:
TQInputContext *slave();
const TQInputContext *slave() const;
void changeInputMethod( int newIndex );
void changeInputMethod( TQString name );
TQInputContext *_slave;
int imIndex;
bool cachedFocus;
TQWidget *cachedFocusWidget;
TQWidget *cachedHolderWidget;
bool beIndirectlyConnected;
TQIntDict<TQString> keyDict;
TQGuardedPtr<TQPopupMenu> popup;
TQString currentIMKey;
};
#endif //TQ_NO_IM
#endif // TQMULTIINPUTCONTEXT_H

@ -0,0 +1,88 @@
/****************************************************************************
** $Id$
**
** Implementation of TQMultiInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqmultiinputcontext.h"
#include "tqmultiinputcontextplugin.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
TQMultiInputContextPlugin::TQMultiInputContextPlugin()
{
}
TQMultiInputContextPlugin::~TQMultiInputContextPlugin()
{
}
TQStringList TQMultiInputContextPlugin::keys() const
{
// input method switcher should named with "imsw-" prefix to
// prevent to be listed in ordinary input method list.
return TQStringList( "imsw-multi" );
}
TQInputContext *TQMultiInputContextPlugin::create( const TQString &key )
{
return new TQMultiInputContext;
}
TQStringList TQMultiInputContextPlugin::languages( const TQString &key )
{
return TQStringList( "" );
}
TQString TQMultiInputContextPlugin::displayName( const TQString &key )
{
return tr( "Multiple Input Method Switcher" );
}
TQString TQMultiInputContextPlugin::description( const TQString &key )
{
return tr( "Multiple input method switcher that uses the context menu of the text widgets" );
}
TQ_EXPORT_PLUGIN( TQMultiInputContextPlugin )
#endif

@ -0,0 +1,63 @@
/****************************************************************************
** $Id$
**
** Definition of TQMultiInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqmultiinputcontext.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
class TQMultiInputContextPlugin : public TQInputContextPlugin
{
TQ_OBJECT
public:
TQMultiInputContextPlugin();
~TQMultiInputContextPlugin();
TQStringList keys() const;
TQInputContext *create( const TQString &key );
TQStringList languages( const TQString &key );
TQString displayName( const TQString &key );
TQString description( const TQString &key );
};
#endif

@ -0,0 +1,12 @@
TEMPLATE = lib
TARGET = qimsw-none
DESTDIR = ../../../inputmethods
INCLUDEPATH += .
CONFIG += qt warn_on debug plugin
target.path += $$plugins.path/inputmethods
INSTALLS += target
# Input
HEADERS += qnoneinputcontextplugin.h
SOURCES += qnoneinputcontextplugin.cpp

@ -0,0 +1,101 @@
/****************************************************************************
** $Id$
**
** Implementation of TQNoneInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqnoneinputcontextplugin.h"
#include <tqinputcontextfactory.h>
#include <tqsettings.h>
#include <cstdlib>
TQNoneInputContextPlugin::TQNoneInputContextPlugin()
{
}
TQNoneInputContextPlugin::~TQNoneInputContextPlugin()
{
}
TQStringList TQNoneInputContextPlugin::keys() const
{
// input method switcher should named with "imsw-" prefix to
// prevent to be listed in ordinary input method list.
return TQStringList( "imsw-none" );
}
TQInputContext *TQNoneInputContextPlugin::create( const TQString &key )
{
TQString actuallySpecifiedKey;
bool isIMSwitcher = key.startsWith( "imsw-" );
if ( ! isIMSwitcher )
return 0;
if ( getenv( "TQT_IM_MODULE" ) ) {
actuallySpecifiedKey = getenv( "TQT_IM_MODULE" );
} else {
TQSettings settings;
actuallySpecifiedKey = settings.readEntry( "/qt/DefaultInputMethod", "xim" );
}
return TQInputContextFactory::create( actuallySpecifiedKey, 0 );
}
TQStringList TQNoneInputContextPlugin::languages( const TQString &key )
{
return TQStringList( "" );
}
TQString TQNoneInputContextPlugin::displayName( const TQString &key )
{
return tr( "Dummy Input Method Switcher" );
}
TQString TQNoneInputContextPlugin::description( const TQString &key )
{
return tr( "Dummy input method switcher that uses the context menu of the text widgets" );
}
TQ_EXPORT_PLUGIN( TQNoneInputContextPlugin )
#endif

@ -0,0 +1,62 @@
/****************************************************************************
** $Id$
**
** Definition of TQNoneInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
class TQNoneInputContextPlugin : public TQInputContextPlugin
{
TQ_OBJECT
public:
TQNoneInputContextPlugin();
~TQNoneInputContextPlugin();
TQStringList keys() const;
TQInputContext *create( const TQString &key );
TQStringList languages( const TQString &key );
TQString displayName( const TQString &key );
TQString description( const TQString &key );
};
#endif

@ -0,0 +1,11 @@
TEMPLATE = subdirs
unix {
!embedded:!mac:CONFIG += x11
}
# XIM should be enabled only for X11 platform, but following
# configuration is not working properly yet
#im:x11:SUBDIRS += xim
inputmethod:SUBDIRS += imsw-none imsw-multi simple
inputmethod:SUBDIRS += xim

@ -0,0 +1,15 @@
TEMPLATE = lib
TARGET = qsimple
DESTDIR = ../../../inputmethods
INCLUDEPATH += .
CONFIG += qt warn_on debug plugin
target.path += $$plugins.path/inputmethods
INSTALLS += target
# Input
HEADERS += qsimpleinputcontext.h \
qsimpleinputcontextplugin.h
SOURCES += qsimpleinputcontext.cpp \
qsimpleinputcontextplugin.cpp \
composetable.cpp

@ -0,0 +1,285 @@
/****************************************************************************
** $Id$
**
** Implementation of TQSimpleInputContext class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tqsimpleinputcontext.h"
#include <tqnamespace.h>
#include <tqevent.h>
#include <tqglobal.h>
#include <algorithm>
static const int ignoreKeys[] = {
TQt::Key_Shift,
TQt::Key_Control,
TQt::Key_Meta,
TQt::Key_Alt,
TQt::Key_CapsLock,
TQt::Key_Super_L,
TQt::Key_Super_R,
TQt::Key_Hyper_L,
TQt::Key_Hyper_R,
TQt::Key_Mode_switch
};
static const int composingKeys[] = {
TQt::Key_Multi_key,
TQt::Key_Dead_Grave,
TQt::Key_Dead_Acute,
TQt::Key_Dead_Circumflex,
TQt::Key_Dead_Tilde,
TQt::Key_Dead_Macron,
TQt::Key_Dead_Breve,
TQt::Key_Dead_Abovedot,
TQt::Key_Dead_Diaeresis,
TQt::Key_Dead_Abovering,
TQt::Key_Dead_Doubleacute,
TQt::Key_Dead_Caron,
TQt::Key_Dead_Cedilla,
TQt::Key_Dead_Ogonek,
TQt::Key_Dead_Iota,
TQt::Key_Dead_Voiced_Sound,
TQt::Key_Dead_Semivoiced_Sound,
TQt::Key_Dead_Belowdot,
TQt::Key_Dead_Hook,
TQt::Key_Dead_Horn
};
class Cmp
{
public:
bool operator () (const TQComposeTableElement &lhs, const TQComposeTableElement &rhs) const {
for ( size_t i=0; i < TQT_KEYSEQUENCE_MAX_LEN; i++ ) {
if ( lhs.keys[i] < rhs.keys[i] ) return TRUE;
else
if ( lhs.keys[i] > rhs.keys[i] ) return FALSE;
}
return FALSE;
}
bool operator () (const TQComposeTableElement &lhs, const uint rhs[TQT_KEYSEQUENCE_MAX_LEN]) const {
for ( size_t i=0; i < TQT_KEYSEQUENCE_MAX_LEN; i++ ) {
if ( lhs.keys[i] < rhs[i] ) return TRUE;
else
if ( lhs.keys[i] > rhs[i] ) return FALSE;
}
return FALSE;
}
};
TQSimpleInputContext::TQSimpleInputContext()
: TQInputContext()
{
clearComposeBuffer();
}
TQSimpleInputContext::~TQSimpleInputContext()
{
clearComposeBuffer();
}
bool TQSimpleInputContext::filterEvent( const TQEvent *event )
{
if ( event->type() != TQEvent::KeyPress )
return FALSE;
TQKeyEvent *keyevent = (TQKeyEvent *)event;
int keyval = keyevent->key();
int val = 0;
if ( isIgnoreKeys( keyval ) )
return FALSE;
if ( isComposingKeys( keyval ) ) {
// If composing keys are pressed, use keyval directly
val = UNITIZE( keyval );
} else {
TQString text = keyevent->text();
if ( text.isEmpty() )
return FALSE;
// If not composing keys are pressed, use the character's tqunicode value
// NOTE : The contents of TQKeyEvent::text() is restricted to
// only one character. See description of
// TQInputContext::filterEvent() about key compression.
val = text[0].tqunicode();
// qDebug( "str = %s", (const char*)keyevent->text().local8Bit() );
}
// Store value
int nCompose = 0;
while ( composeBuffer[nCompose] != 0 && nCompose < TQT_KEYSEQUENCE_MAX_LEN )
nCompose++;
if ( nCompose == TQT_KEYSEQUENCE_MAX_LEN ) {
clearComposeBuffer();
nCompose = 0;
}
composeBuffer[nCompose] = val;
// check sequence
if( checkComposeTable( composeBuffer, &defaultComposeTable ) )
return TRUE;
return FALSE;
}
void TQSimpleInputContext::setFocus()
{
//qDebug( "TQSimpleInputContext: %p->setFocus(), tqfocusWidget()=%p",
//this, tqfocusWidget() );
}
void TQSimpleInputContext::unsetFocus()
{
//qDebug( "TQSimpleInputContext: %p->unsetFocus(), tqfocusWidget()=%p",
//this, tqfocusWidget() );
reset();
}
void TQSimpleInputContext::setMicroFocus( int x, int y, int w, int h, TQFont *f )
{
}
void TQSimpleInputContext::mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState state )
{
switch ( type ) {
case TQEvent::MouseButtonPress:
case TQEvent::MouseButtonRelease:
case TQEvent::MouseButtonDblClick:
case TQEvent::MouseMove:
// qDebug( "TQSimpleInputContext::mouseHandler: "
// "x=%d, type=%d, button=%d, state=%d", x, type, button, state );
break;
default:
break;
}
}
void TQSimpleInputContext::reset()
{
clearComposeBuffer();
TQInputContext::reset();
}
TQString TQSimpleInputContext::identifierName()
{
return "simple";
}
TQString TQSimpleInputContext::language()
{
return ""; // FIXME
}
bool TQSimpleInputContext::isIgnoreKeys( int keyval )
{
for ( uint i = 0; i < (sizeof(ignoreKeys)/sizeof(ignoreKeys[0])); i++ )
if ( keyval == ignoreKeys[i] )
return TRUE;
return FALSE;
}
bool TQSimpleInputContext::isComposingKeys( int keyval )
{
for ( uint i = 0; i < (sizeof(composingKeys)/sizeof(composingKeys[0])); i++ )
if ( keyval == composingKeys[i] )
return TRUE;
return FALSE;
}
bool TQSimpleInputContext::checkComposeTable( uint* composeBuffer, const TQComposeTable *composeTable )
{
const TQComposeTableElement *p = std::lower_bound( composeTable->data,
composeTable->data + composeTable->size,
composeBuffer,
Cmp() );
// no entries were found
if ( p == composeTable->data + composeTable->size ) {
// qDebug( "no match" );
clearComposeBuffer();
return FALSE;
}
// check if compose buffer is matched
for ( int i=0; i < TQT_KEYSEQUENCE_MAX_LEN; i++ ) {
// check if partial match
if ( composeBuffer[i] == 0 && p->keys[i] ) {
// qDebug("partial match");
return TRUE;
}
if ( composeBuffer[i] != p->keys[i] ) {
// qDebug("different entry");
clearComposeBuffer();
return i!=0;
}
}
// qDebug("match exactly");
// match exactly
commitChar( p->value );
clearComposeBuffer();
return TRUE;
}
void TQSimpleInputContext::commitChar( uint c )
{
sendIMEvent( TQEvent::IMStart );
sendIMEvent( TQEvent::IMEnd, TQString(TQChar(c)) );
}
void TQSimpleInputContext::clearComposeBuffer(void)
{
for ( uint i=0; i < (sizeof(composeBuffer)/sizeof(int)); i++ )
composeBuffer[i] = 0;
}

@ -0,0 +1,93 @@
/****************************************************************************
** $Id$
**
** Definition of TQSimpleInputContext class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQSIMPLEINPUT_CONTEXT_H
#define TQSIMPLEINPUT_CONTEXT_H
#include <tqinputcontext.h>
#include <tqnamespace.h>
#define TQT_KEYSEQUENCE_MAX_LEN 6
#define UNITIZE(qkey) (0x02000000|qkey)
struct TQComposeTableElement {
uint keys[TQT_KEYSEQUENCE_MAX_LEN];
uint value;
};
struct TQComposeTable {
const TQComposeTableElement *data;
uint size;
};
class TQSimpleInputContext : public TQInputContext {
TQ_OBJECT
public:
TQSimpleInputContext();
~TQSimpleInputContext();
virtual TQString identifierName();
virtual TQString language();
virtual bool filterEvent( const TQEvent *event );
virtual void reset();
virtual void setFocus();
virtual void unsetFocus();
virtual void setMicroFocus( int x, int y, int w, int h, TQFont *f = 0 );
virtual void mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button, TQt::ButtonState state );
protected:
bool isIgnoreKeys(int keyval );
bool isComposingKeys( int keyval );
bool checkComposeTable( uint composeBuffer[], const TQComposeTable *composeTable );
void commitChar( uint c );
void clearComposeBuffer(void);
protected:
uint composeBuffer[TQT_KEYSEQUENCE_MAX_LEN + 1];
static const TQComposeTable defaultComposeTable;
};
#endif // TQSIMPLEINPUT_CONTEXT_H

@ -0,0 +1,86 @@
/****************************************************************************
** $Id$
**
** Implementation of TQSimpleInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqsimpleinputcontext.h"
#include "tqsimpleinputcontextplugin.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
TQSimpleInputContextPlugin::TQSimpleInputContextPlugin()
{
}
TQSimpleInputContextPlugin::~TQSimpleInputContextPlugin()
{
}
TQStringList TQSimpleInputContextPlugin::keys() const
{
return TQStringList( "simple" );
}
TQInputContext *TQSimpleInputContextPlugin::create( const TQString & )
{
return new TQSimpleInputContext;
}
TQStringList TQSimpleInputContextPlugin::languages( const TQString & )
{
return TQStringList( "" );
}
TQString TQSimpleInputContextPlugin::displayName( const TQString & )
{
return tr( "Simple Composing Input Method" );
}
TQString TQSimpleInputContextPlugin::description( const TQString & )
{
return tr( "Simple composing input method" );
}
TQ_EXPORT_PLUGIN( TQSimpleInputContextPlugin )
#endif

@ -0,0 +1,63 @@
/****************************************************************************
** $Id$
**
** Definition of TQSimpleInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqsimpleinputcontext.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
class TQSimpleInputContextPlugin : public TQInputContextPlugin
{
TQ_OBJECT
public:
TQSimpleInputContextPlugin();
~TQSimpleInputContextPlugin();
TQStringList keys() const;
TQInputContext *create( const TQString &key );
TQStringList languages( const TQString &key );
TQString displayName( const TQString &key );
TQString description( const TQString &key );
};
#endif

@ -0,0 +1,450 @@
#!/usr/bin/env ruby
# xcompose2q.rb: X Compose table to TQSimpleInputContext table translator
# Copyright (C) 2004 immodule for TQt Project. All rights reserved.
#
# This file is written to contribute to Trolltech AS under their own
# licence. You may use this file under your TQt license. Following
# description is copied from their original file headers. Contact
# immodule-qt@freedesktop.org if any conditions of this licensing are
# not clear to you.
# This file may be distributed under the terms of the Q Public License
# as defined by Trolltech AS of Norway and appearing in the file
# LICENSE.TQPL included in the packaging of this file.
#
# This file may be distributed and/or modified under the terms of the
# GNU General Public License version 2 as published by the Free Software
# Foundation and appearing in the file LICENSE.GPL included in the
# packaging of this file.
#
# Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
# licenses may use this file in accordance with the TQt Commercial License
# Agreement provided with the Software.
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
# information about TQt Commercial License Agreements.
# See http://www.trolltech.com/qpl/ for TQPL licensing information.
# See http://www.trolltech.com/gpl/ for GPL licensing information.
#
# Contact info@trolltech.com if any conditions of this licensing are
# not clear to you.
# Usage:
# xcompose2q.rb /usr/X11R6/lib/X11/locale/en_US.UTF-8/Compose
require 'uconv'
# translation table for lazy sorting
raw2key = {
"0y1120" => "UNITIZE(TQt::Key_Multi_key)",
"0y1250" => "UNITIZE(TQt::Key_Dead_Grave)",
"0y1251" => "UNITIZE(TQt::Key_Dead_Acute)",
"0y1252" => "UNITIZE(TQt::Key_Dead_Circumflex)",
"0y1253" => "UNITIZE(TQt::Key_Dead_Tilde)",
"0y1254" => "UNITIZE(TQt::Key_Dead_Macron)",
"0y1255" => "UNITIZE(TQt::Key_Dead_Breve)",
"0y1256" => "UNITIZE(TQt::Key_Dead_Abovedot)",
"0y1257" => "UNITIZE(TQt::Key_Dead_Diaeresis)",
"0y1258" => "UNITIZE(TQt::Key_Dead_Abovering)",
"0y1259" => "UNITIZE(TQt::Key_Dead_Doubleacute)",
"0y125a" => "UNITIZE(TQt::Key_Dead_Caron)",
"0y125b" => "UNITIZE(TQt::Key_Dead_Cedilla)",
"0y125c" => "UNITIZE(TQt::Key_Dead_Ogonek)",
"0y125d" => "UNITIZE(TQt::Key_Dead_Iota)",
"0y125e" => "UNITIZE(TQt::Key_Dead_Voiced_Sound)",
"0y125f" => "UNITIZE(TQt::Key_Dead_Semivoiced_Sound)",
"0y1260" => "UNITIZE(TQt::Key_Dead_Belowdot)",
"0y1261" => "UNITIZE(TQt::Key_Dead_Hook)",
"0y1262" => "UNITIZE(TQt::Key_Dead_Horn)",
}
# X's KeySym to Unicode translation table. The tqunicode value is
# extracted from
# TQETWidget::translateKeyEventInternal(). Translation for some
# keys are not available
x2q = {
"Multi_key" => "0y1120",
"dead_grave" => "0y1250",
"dead_acute" => "0y1251",
"dead_circumflex" => "0y1252",
"dead_tilde" => "0y1253",
"dead_macron" => "0y1254",
"dead_breve" => "0y1255",
"dead_abovedot" => "0y1256",
"dead_diaeresis" => "0y1257",
"dead_abovering" => "0y1258",
"dead_doubleacute" => "0y1259",
"dead_caron" => "0y125a",
"dead_cedilla" => "0y125b",
"dead_ogonek" => "0y125c",
"dead_iota" => "0y125d",
"dead_voiced_sound" => "0y125e",
"dead_semivoiced_sound" => "0y125f",
"dead_belowdot" => "0y1260",
"dead_hook" => "0y1261",
"dead_horn" => "0y1262",
"0" => "0x0030",
"1" => "0x0031",
"2" => "0x0032",
"3" => "0x0033",
"4" => "0x0034",
"5" => "0x0035",
"6" => "0x0036",
"7" => "0x0037",
"8" => "0x0038",
"9" => "0x0039",
"A" => "0x0041",
"AE" => "0x00c6",
"Abreve" => "0x0102",
"Acircumflex" => "0x00c2",
"Adiaeresis" => "0x00c4",
"Arabic_alef" => "0x0627",
"Arabic_waw" => "0x0648",
"Arabic_yeh" => "0x064a",
"Aring" => "0x00c5",
"B" => "0x0042",
"C" => "0x0043",
"Ccedilla" => "0x00c7",
"Cyrillic_A" => "0x0410",
"Cyrillic_CHE" => "0x0427",
"Cyrillic_E" => "0x042d",
"Cyrillic_GHE" => "0x0413",
"Cyrillic_I" => "0x0418",
"Cyrillic_IE" => "0x0415",
"Cyrillic_KA" => "0x041a",
"Cyrillic_O" => "0x041e",
"Cyrillic_U" => "0x0423",
"Cyrillic_YERU" => "0x042b",
"Cyrillic_ZE" => "0x0417",
"Cyrillic_ZHE" => "0x0416",
"Cyrillic_a" => "0x0430",
"Cyrillic_che" => "0x0447",
"Cyrillic_e" => "0x044d",
"Cyrillic_ghe" => "0x0433",
"Cyrillic_i" => "0x0438",
"Cyrillic_ie" => "0x0435",
"Cyrillic_ka" => "0x043a",
"Cyrillic_o" => "0x043e",
"Cyrillic_u" => "0x0443",
"Cyrillic_yeru" => "0x044b",
"Cyrillic_ze" => "0x0437",
"Cyrillic_zhe" => "0x0436",
"D" => "0x0044",
"E" => "0x0045",
"Ecircumflex" => "0x00ca",
"Emacron" => "0x0112",
"F" => "0x0046",
"G" => "0x0047",
"Greek_ALPHA" => "0x0391",
"Greek_EPSILON" => "0x0395",
"Greek_ETA" => "0x0397",
"Greek_IOTA" => "0x0399",
"Greek_OMEGA" => "0x03a9",
"Greek_OMICRON" => "0x039f",
"Greek_RHO" => "0x03a1",
"Greek_UPSILON" => "0x03a5",
"Greek_alpha" => "0x03b1",
"Greek_alphaaccent" => "0x03ac",
"Greek_epsilon" => "0x03b5",
"Greek_eta" => "0x03b7",
"Greek_etaaccent" => "0x03ae",
"Greek_iota" => "0x03b9",
"Greek_iotadieresis" => "0x03ca",
"Greek_omega" => "0x03c9",
"Greek_omegaaccent" => "0x03ce",
"Greek_omicron" => "0x03bf",
"Greek_rho" => "0x03c1",
"Greek_upsilon" => "0x03c5",
"Greek_upsilondieresis" => "0x03cb",
"H" => "0x0048",
"I" => "0x0049",
"Idiaeresis" => "0x00cf",
"J" => "0x004a",
"K" => "0x004b",
"KP_0" => "0x0000",
"KP_1" => "0x0000",
"KP_2" => "0x0000",
"KP_3" => "0x0000",
"KP_4" => "0x0000",
"KP_5" => "0x0000",
"KP_6" => "0x0000",
"KP_7" => "0x0000",
"KP_8" => "0x0000",
"KP_9" => "0x0000",
"KP_Add" => "0x0000",
"KP_Divide" => "0x0000",
"KP_Equal" => "0x0000",
"KP_Space" => "0x0000",
"L" => "0x004c",
"M" => "0x004d",
"N" => "0x004e",
"O" => "0x004f",
"Ocircumflex" => "0x00d4",
"Odiaeresis" => "0x00d6",
"Ohorn" => "0x0000",
"Omacron" => "0x014c",
"Ooblique" => "0x00d8",
"Otilde" => "0x00d5",
"P" => "0x0050",
"Q" => "0x0051",
"R" => "0x0052",
"S" => "0x0053",
"Sacute" => "0x015a",
"Scaron" => "0x0160",
"T" => "0x0054",
"U" => "0x0055",
"Udiaeresis" => "0x00dc",
"Uhorn" => "0x0000",
"Ukrainian_I" => "0x0406",
"Ukrainian_i" => "0x0456",
"Umacron" => "0x016a",
"Utilde" => "0x0168",
"V" => "0x0056",
"W" => "0x0057",
"X" => "0x0058",
"Y" => "0x0059",
"Z" => "0x005a",
"a" => "0x0061",
"abreve" => "0x0103",
"acircumflex" => "0x00e2",
"acute" => "0x00b4",
"adiaeresis" => "0x00e4",
"ae" => "0x00e6",
"ampersand" => "0x0026",
"apostrophe" => "0x0027",
"approximate" => "0x223c",
"aring" => "0x00e5",
"asciicircum" => "0x005e",
"asciitilde" => "0x007e",
"asterisk" => "0x002a",
"at" => "0x0040",
"b" => "0x0062",
"backslash" => "0x005c",
"bar" => "0x007c",
"braceleft" => "0x007b",
"braceright" => "0x007d",
"bracketleft" => "0x005b",
"bracketright" => "0x005d",
"c" => "0x0063",
"ccedilla" => "0x00e7",
"colon" => "0x003a",
"combining_acute" => "0x0000",
"combining_belowdot" => "0x0000",
"combining_grave" => "0x0000",
"combining_hook" => "0x0000",
"combining_tilde" => "0x0000",
"comma" => "0x002c",
"d" => "0x0064",
"diaeresis" => "0x00a8",
"dollar" => "0x0024",
"e" => "0x0065",
"ecircumflex" => "0x00ea",
"emacron" => "0x0113",
"equal" => "0x003d",
"exclam" => "0x0021",
"f" => "0x0066",
"g" => "0x0067",
"grave" => "0x0060",
"greater" => "0x003e",
"greaterthanequal" => "0x2265",
"h" => "0x0068",
"hebrew_aleph" => "0x05d0",
"hebrew_bet" => "0x05d1",
"hebrew_beth" => "0x05d1",
"hebrew_dalet" => "0x05d3",
"hebrew_daleth" => "0x05d3",
"hebrew_finalkaph" => "0x05da",
"hebrew_finalpe" => "0x05e3",
"hebrew_gimel" => "0x05d2",
"hebrew_gimmel" => "0x05d2",
"hebrew_he" => "0x05d4",
"hebrew_kaph" => "0x05db",
"hebrew_kuf" => "0x05e7",
"hebrew_lamed" => "0x05dc",
"hebrew_mem" => "0x05de",
"hebrew_nun" => "0x05e0",
"hebrew_pe" => "0x05e4",
"hebrew_qoph" => "0x05e7",
"hebrew_resh" => "0x05e8",
"hebrew_samech" => "0x05e1",
"hebrew_samekh" => "0x05e1",
"hebrew_shin" => "0x05e9",
"hebrew_taf" => "0x05ea",
"hebrew_taw" => "0x05ea",
"hebrew_tet" => "0x05d8",
"hebrew_teth" => "0x05d8",
"hebrew_waw" => "0x05d5",
"hebrew_yod" => "0x05d9",
"hebrew_zade" => "0x05e6",
"hebrew_zadi" => "0x05e6",
"hebrew_zain" => "0x05d6",
"hebrew_zayin" => "0x05d6",
"i" => "0x0069",
"identical" => "0x2261",
"idiaeresis" => "0x00ef",
"includedin" => "0x2282",
"includes" => "0x2283",
"j" => "0x006a",
"k" => "0x006b",
"kana_A" => "0x30a2",
"kana_CHI" => "0x30c1",
"kana_E" => "0x30a8",
"kana_FU" => "0x30d5",
"kana_HA" => "0x30cf",
"kana_HE" => "0x30d8",
"kana_HI" => "0x30d2",
"kana_HO" => "0x30db",
"kana_I" => "0x30a4",
"kana_KA" => "0x30ab",
"kana_KE" => "0x30b1",
"kana_KI" => "0x30ad",
"kana_KO" => "0x30b3",
"kana_KU" => "0x30af",
"kana_MA" => "0x30de",
"kana_ME" => "0x30e1",
"kana_MI" => "0x30df",
"kana_MO" => "0x30e2",
"kana_MU" => "0x30e0",
"kana_NA" => "0x30ca",
"kana_NE" => "0x30cd",
"kana_NI" => "0x30cb",
"kana_NO" => "0x30ce",
"kana_NU" => "0x30cc",
"kana_O" => "0x30aa",
"kana_RA" => "0x30e9",
"kana_RE" => "0x30ec",
"kana_RI" => "0x30ea",
"kana_RO" => "0x30ed",
"kana_RU" => "0x30eb",
"kana_SA" => "0x30b5",
"kana_SE" => "0x30bb",
"kana_SHI" => "0x30b7",
"kana_SO" => "0x30bd",
"kana_SU" => "0x30b9",
"kana_TA" => "0x30bf",
"kana_TE" => "0x30c6",
"kana_TO" => "0x30c8",
"kana_TSU" => "0x30c4",
"kana_U" => "0x30a6",
"kana_WA" => "0x30ef",
"kana_WO" => "0x30f2",
"kana_YA" => "0x30e4",
"kana_YO" => "0x30e8",
"kana_YU" => "0x30e6",
"l" => "0x006c",
"leftarrow" => "0x2190",
"leftcaret" => "0x003c",
"leftshoe" => "0x2282",
"less" => "0x003c",
"lessthanequal" => "0x2264",
"m" => "0x006d",
"macron" => "0x00af",
"minus" => "0x002d",
"n" => "0x006e",
"numbersign" => "0x0023",
"o" => "0x006f",
"ocircumflex" => "0x00f4",
"odiaeresis" => "0x00f6",
"ohorn" => "0x0000",
"omacron" => "0x014d",
"oslash" => "0x00f8",
"otilde" => "0x00f5",
"p" => "0x0070",
"parenleft" => "0x0028",
"parenright" => "0x0029",
"percent" => "0x0025",
"period" => "0x002e",
"plus" => "0x002b",
"q" => "0x0071",
"question" => "0x003f",
"quotedbl" => "0x0022",
"r" => "0x0072",
"rightarrow" => "0x2192",
"rightcaret" => "0x003e",
"rightshoe" => "0x2283",
"righttack" => "0x22a3",
"s" => "0x0073",
"sacute" => "0x015b",
"scaron" => "0x0161",
"semicolon" => "0x003b",
"slash" => "0x002f",
"space" => "0x0020",
"t" => "0x0074",
"u" => "0x0075",
"udiaeresis" => "0x00fc",
"uhorn" => "0x0000",
"umacron" => "0x016b",
"underbar" => "0x005f",
"underscore" => "0x005f",
"utilde" => "0x0169",
"v" => "0x0076",
"w" => "0x0077",
"x" => "0x0078",
"y" => "0x0079",
"z" => "0x007a",
}
readlines.collect {
|line|
broken = ""
seq = ["0", "0", "0", "0", "0", "0"]
index = 0
rhs = "0x0000"
comment = ""
case line
when /^(#|XCOMM)(.*)$/
comment = "// #{$2}\n"
rhs = :isCommentLine
when /^$/
comment = "\n"
rhs = :isCommentLine
else
line.scan(/<([^>]+)>/) {
|args|
keysym = args[0]
unit = x2q[keysym] || keysym.sub(/^U([\da-fA-F]{4,5})$/, "0x\\1")
if (/^(0x(0000|[\da-fA-F]{5,})|dead_space)$/ =~ unit)
broken = "// /* broken */"
end
seq[index] = unit
index += 1
}
Regexp.new(':\s+"(.+)"\s+(.+)$', nil, 'u') =~ line
rhs = Uconv::u8tou16($1).unpack('v')[0]
rhs = format("0x%04x", rhs)
comment = $2
end
entry = {
:broken => broken,
:seq => seq,
:rhs => rhs,
:comment => comment
}
}.sort {
|entry_a, entry_b|
entry_a[:seq] <=> entry_b[:seq]
}.each {
|entry|
broken, seq, rhs, comment = entry.values_at(:broken, :seq, :rhs, :comment)
if (rhs == :isCommentLine)
print comment
else
seq = seq.collect {
|unit|
raw2key[unit] || unit
}
print "#{broken} { {#{seq.join(", ")}}, #{rhs} }, // #{comment}\n"
end
}

@ -0,0 +1,130 @@
/****************************************************************************
** $Id: qximinputcontext_p.h,v 1.6 2004/06/22 06:47:27 daisuke Exp $
**
** Definition of TQXIMInputContext
**
** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQXIMINPUTCONTEXT_H
#define TQXIMINPUTCONTEXT_H
//
// W A R N I N G
// -------------
//
// This file is not part of the TQt API. It exists for the convenience
// of internal files. This header file may change from version to version
// without notice, or even be removed.
//
// We mean it.
//
//
#if !defined(TQ_NO_IM)
#include "tqglobal.h"
#include <tqinputcontext.h>
#include <tqfont.h>
#include <tqcstring.h>
class TQKeyEvent;
class TQWidget;
class TQFont;
class TQString;
#ifdef TQ_WS_X11
#include "tqarray.h"
#include "tqwindowdefs.h"
#include <private/tqt_x11_p.h>
#endif
class TQXIMInputContext : public TQInputContext
{
TQ_OBJECT
public:
#ifdef TQ_WS_X11
TQXIMInputContext();
~TQXIMInputContext();
TQString identifierName();
TQString language();
bool x11FilterEvent( TQWidget *keywidget, XEvent *event );
void reset();
void setFocus();
void unsetFocus();
void setMicroFocus( int x, int y, int w, int h, TQFont *f = 0 );
void mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button, TQt::ButtonState state );
bool isPreeditRelocationEnabled();
void setHolderWidget( TQWidget *widget );
bool hasFocus() const;
void resetClientState();
void close( const TQString &errMsg );
void sendIMEvent( TQEvent::Type type,
const TQString &text = TQString(),
int cursorPosition = -1, int selLength = 0 );
static void init_xim();
static void create_xim();
static void close_xim();
void *ic;
TQString composingText;
TQFont font;
XFontSet fontset;
TQMemArray<bool> selectedChars;
protected:
virtual bool isPreeditPreservationEnabled(); // not a TQInputContext func
TQCString _language;
private:
void setComposePosition(int, int);
void setComposeArea(int, int, int, int);
void setXFontSet(const TQFont &);
int lookupString(XKeyEvent *, TQCString &, KeySym *, tqStatus *) const;
#endif // TQ_WS_X11
};
#endif //TQ_NO_IM
#endif // TQXIMINPUTCONTEXT_H

@ -0,0 +1,930 @@
/****************************************************************************
** $Id: qximinputcontext_x11.cpp,v 1.10 2004/06/22 06:47:27 daisuke Exp $
**
** Implementation of TQXIMInputContext class
**
** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses for Unix/X11 may use this file in accordance with the TQt Commercial
** License Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tqximinputcontext.h"
const int XKeyPress = KeyPress;
const int XKeyRelease = KeyRelease;
#undef KeyPress
#undef KeyRelease
#if !defined(TQT_NO_IM)
#include "tqplatformdefs.h"
#include "tqapplication.h"
#include "tqwidget.h"
#include "tqstring.h"
#include "tqptrlist.h"
#include "tqintdict.h"
#include "tqtextcodec.h"
#include <stdlib.h>
#include <limits.h>
#if !defined(TQT_NO_XIM)
#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/keysymdef.h>
// #define TQT_XIM_DEBUG
// from qapplication_x11.cpp
static XIM qt_xim = 0;
extern XIMStyle qt_xim_style;
extern XIMStyle qt_xim_preferred_style;
extern char *qt_ximServer;
static bool isInitXIM = FALSE;
static TQPtrList<TQXIMInputContext> *ximContextList = 0;
#endif
extern int qt_ximComposingKeycode;
extern TQTextCodec * qt_input_mapper;
#if !defined(TQT_NO_XIM)
#if defined(TQ_C_CALLBACKS)
extern "C" {
#endif // TQ_C_CALLBACKS
#ifdef USE_X11R6_XIM
static void xim_create_callback(XIM /*im*/,
XPointer /*client_data*/,
XPointer /*call_data*/)
{
// qDebug("xim_create_callback");
TQXIMInputContext::create_xim();
}
static void xim_destroy_callback(XIM /*im*/,
XPointer /*client_data*/,
XPointer /*call_data*/)
{
// qDebug("xim_destroy_callback");
TQXIMInputContext::close_xim();
Display *dpy = TQPaintDevice::x11AppDisplay();
XRegisterIMInstantiateCallback(dpy, 0, 0, 0,
(XIMProc) xim_create_callback, 0);
}
#endif // USE_X11R6_XIM
#if defined(TQ_C_CALLBACKS)
}
#endif // TQ_C_CALLBACKS
#endif // TQT_NO_XIM
#ifndef TQT_NO_XIM
/* The cache here is needed, as X11 leaks a few kb for every
XFreeFontSet call, so we avoid creating and deletion of fontsets as
much as possible
*/
static XFontSet fontsetCache[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static int fontsetRefCount = 0;
static const char * const fontsetnames[] = {
"-*-fixed-medium-r-*-*-16-*,-*-*-medium-r-*-*-16-*",
"-*-fixed-medium-i-*-*-16-*,-*-*-medium-i-*-*-16-*",
"-*-fixed-bold-r-*-*-16-*,-*-*-bold-r-*-*-16-*",
"-*-fixed-bold-i-*-*-16-*,-*-*-bold-i-*-*-16-*",
"-*-fixed-medium-r-*-*-24-*,-*-*-medium-r-*-*-24-*",
"-*-fixed-medium-i-*-*-24-*,-*-*-medium-i-*-*-24-*",
"-*-fixed-bold-r-*-*-24-*,-*-*-bold-r-*-*-24-*",
"-*-fixed-bold-i-*-*-24-*,-*-*-bold-i-*-*-24-*"
};
static XFontSet getFontSet( const TQFont &f )
{
int i = 0;
if (f.italic())
i |= 1;
if (f.bold())
i |= 2;
if ( f.pointSize() > 20 )
i += 4;
if ( !fontsetCache[i] ) {
Display* dpy = TQPaintDevice::x11AppDisplay();
int missCount;
char** missList;
fontsetCache[i] = XCreateFontSet(dpy, fontsetnames[i], &missList, &missCount, 0);
if(missCount > 0)
XFreeStringList(missList);
if ( !fontsetCache[i] ) {
fontsetCache[i] = XCreateFontSet(dpy, "-*-fixed-*-*-*-*-16-*", &missList, &missCount, 0);
if(missCount > 0)
XFreeStringList(missList);
if ( !fontsetCache[i] )
fontsetCache[i] = (XFontSet)-1;
}
}
return (fontsetCache[i] == (XFontSet)-1) ? 0 : fontsetCache[i];
}
#ifdef TQ_C_CALLBACKS
extern "C" {
#endif // TQ_C_CALLBACKS
// These static functions should be rewritten as member of
// TQXIMInputContext
static int xic_start_callback(XIC, XPointer client_data, XPointer) {
TQXIMInputContext *qic = (TQXIMInputContext *) client_data;
if (! qic) {
#ifdef TQT_XIM_DEBUG
qDebug("compose start: no qic");
#endif // TQT_XIM_DEBUG
return 0;
}
qic->resetClientState();
qic->sendIMEvent( TQEvent::IMStart );
#ifdef TQT_XIM_DEBUG
qDebug("compose start");
#endif // TQT_XIM_DEBUG
return 0;
}
static int xic_draw_callback(XIC, XPointer client_data, XPointer call_data) {
TQXIMInputContext *qic = (TQXIMInputContext *) client_data;
if (! qic) {
#ifdef TQT_XIM_DEBUG
qDebug("compose event: invalid compose event %p", qic);
#endif // TQT_XIM_DEBUG
return 0;
}
bool send_imstart = FALSE;
if( ! qic->isComposing() && qic->hasFocus() ) {
qic->resetClientState();
send_imstart = TRUE;
} else if ( ! qic->isComposing() || ! qic->hasFocus() ) {
#ifdef TQT_XIM_DEBUG
qDebug( "compose event: invalid compose event composing=%d hasFocus=%d",
qic->isComposing(), qic->hasFocus() );
#endif // TQT_XIM_DEBUG
return 0;
}
if ( send_imstart )
qic->sendIMEvent( TQEvent::IMStart );
XIMPreeditDrawCallbackStruct *drawstruct =
(XIMPreeditDrawCallbackStruct *) call_data;
XIMText *text = (XIMText *) drawstruct->text;
int cursor = drawstruct->caret, sellen = 0;
if ( ! drawstruct->caret && ! drawstruct->chg_first &&
! drawstruct->chg_length && ! text ) {
if( qic->composingText.isEmpty() ) {
#ifdef TQT_XIM_DEBUG
qDebug( "compose emptied" );
#endif // TQT_XIM_DEBUG
// if the composition string has been emptied, we need
// to send an IMEnd event
qic->sendIMEvent( TQEvent::IMEnd );
qic->resetClientState();
// if the commit string has coming after here, IMStart
// will be sent dynamically
}
return 0;
}
if (text) {
char *str = 0;
if (text->encoding_is_wchar) {
int l = wcstombs(NULL, text->string.wide_char, text->length);
if (l != -1) {
str = new char[l + 1];
wcstombs(str, text->string.wide_char, l);
str[l] = 0;
}
} else
str = text->string.multi_byte;
if (! str)
return 0;
TQString s = TQString::fromLocal8Bit(str);
if (text->encoding_is_wchar)
delete [] str;
if (drawstruct->chg_length < 0)
qic->composingText.tqreplace(drawstruct->chg_first, UINT_MAX, s);
else
qic->composingText.tqreplace(drawstruct->chg_first, drawstruct->chg_length, s);
if ( qic->selectedChars.size() < qic->composingText.length() ) {
// expand the selectedChars array if the compose string is longer
uint from = qic->selectedChars.size();
qic->selectedChars.resize( qic->composingText.length() );
for ( uint x = from; from < qic->selectedChars.size(); ++x )
qic->selectedChars[x] = 0;
}
uint x;
bool *p = qic->selectedChars.data() + drawstruct->chg_first;
// determine if the changed chars are selected based on text->feedback
for ( x = 0; x < s.length(); ++x )
*p++ = ( text->feedback ? ( text->feedback[x] & XIMReverse ) : 0 );
// figure out where the selection starts, and how long it is
p = qic->selectedChars.data();
bool started = FALSE;
for ( x = 0; x < TQMIN(qic->composingText.length(), qic->selectedChars.size()); ++x ) {
if ( started ) {
if ( *p ) ++sellen;
else break;
} else {
if ( *p ) {
cursor = x;
started = TRUE;
sellen = 1;
}
}
++p;
}
} else {
if (drawstruct->chg_length == 0)
drawstruct->chg_length = -1;
qic->composingText.remove(drawstruct->chg_first, drawstruct->chg_length);
bool qt_compose_emptied = qic->composingText.isEmpty();
if ( qt_compose_emptied ) {
#ifdef TQT_XIM_DEBUG
qDebug( "compose emptied" );
#endif // TQT_XIM_DEBUG
// if the composition string has been emptied, we need
// to send an IMEnd event
qic->sendIMEvent( TQEvent::IMEnd );
qic->resetClientState();
// if the commit string has coming after here, IMStart
// will be sent dynamically
return 0;
}
}
qic->sendIMEvent( TQEvent::IMCompose,
qic->composingText, cursor, sellen );
return 0;
}
static int xic_done_callback(XIC, XPointer client_data, XPointer) {
TQXIMInputContext *qic = (TQXIMInputContext *) client_data;
if (! qic)
return 0;
// Don't send IMEnd here. TQXIMInputContext::x11FilterEvent()
// handles IMEnd with commit string.
#if 0
if ( qic->isComposing() )
qic->sendIMEvent( TQEvent::IMEnd );
qic->resetClientState();
#endif
return 0;
}
#ifdef TQ_C_CALLBACKS
}
#endif // TQ_C_CALLBACKS
#endif // !TQT_NO_XIM
TQXIMInputContext::TQXIMInputContext()
: TQInputContext(), ic(0), fontset(0)
{
if(!isInitXIM)
TQXIMInputContext::init_xim();
}
void TQXIMInputContext::setHolderWidget( TQWidget *widget )
{
if ( ! widget )
return;
TQInputContext::setHolderWidget( widget );
#if !defined(TQT_NO_XIM)
fontsetRefCount++;
if (! qt_xim) {
qWarning("TQInputContext: no input method context available");
return;
}
if (! widget->isTopLevel()) {
// qWarning("TQInputContext: cannot create input context for non-toplevel widgets");
return;
}
XPoint spot;
XRectangle rect;
XVaNestedList preedit_attr = 0;
XIMCallback startcallback, drawcallback, donecallback;
font = widget->font();
fontset = getFontSet( font );
if (qt_xim_style & XIMPreeditArea) {
rect.x = 0;
rect.y = 0;
rect.width = widget->width();
rect.height = widget->height();
preedit_attr = XVaCreateNestedList(0,
XNArea, &rect,
XNFontSet, fontset,
(char *) 0);
} else if (qt_xim_style & XIMPreeditPosition) {
spot.x = 1;
spot.y = 1;
preedit_attr = XVaCreateNestedList(0,
XNSpotLocation, &spot,
XNFontSet, fontset,
(char *) 0);
} else if (qt_xim_style & XIMPreeditCallbacks) {
startcallback.client_data = (XPointer) this;
startcallback.callback = (XIMProc) xic_start_callback;
drawcallback.client_data = (XPointer) this;
drawcallback.callback = (XIMProc)xic_draw_callback;
donecallback.client_data = (XPointer) this;
donecallback.callback = (XIMProc) xic_done_callback;
preedit_attr = XVaCreateNestedList(0,
XNPreeditStartCallback, &startcallback,
XNPreeditDrawCallback, &drawcallback,
XNPreeditDoneCallback, &donecallback,
(char *) 0);
}
if (preedit_attr) {
ic = XCreateIC(qt_xim,
XNInputStyle, qt_xim_style,
XNClientWindow, widget->winId(),
XNPreeditAttributes, preedit_attr,
(char *) 0);
XFree(preedit_attr);
} else
ic = XCreateIC(qt_xim,
XNInputStyle, qt_xim_style,
XNClientWindow, widget->winId(),
(char *) 0);
if (! ic)
qFatal("Failed to create XIM input context!");
// when resetting the input context, preserve the input state
(void) XSetICValues((XIC) ic, XNResetState, XIMPreserveState, (char *) 0);
if( ! ximContextList )
ximContextList = new TQPtrList<TQXIMInputContext>;
ximContextList->append( this );
#endif // !TQT_NO_XIM
}
TQXIMInputContext::~TQXIMInputContext()
{
#if !defined(TQT_NO_XIM)
if (ic)
XDestroyIC((XIC) ic);
if ( --fontsetRefCount == 0 ) {
Display *dpy = TQPaintDevice::x11AppDisplay();
for ( int i = 0; i < 8; i++ ) {
if ( fontsetCache[i] && fontsetCache[i] != (XFontSet)-1 ) {
XFreeFontSet(dpy, fontsetCache[i]);
fontsetCache[i] = 0;
}
}
}
if( ximContextList ) {
ximContextList->remove( this );
if(ximContextList->isEmpty()) {
// Calling XCloseIM gives a Purify FMR error
// XCloseIM( qt_xim );
// We prefer a less serious memory leak
if( qt_xim ) {
qt_xim = 0;
isInitXIM = FALSE;
}
delete ximContextList;
ximContextList = 0;
}
}
#endif // !TQT_NO_XIM
ic = 0;
}
void TQXIMInputContext::init_xim()
{
#ifndef TQT_NO_XIM
if(!isInitXIM)
isInitXIM = TRUE;
qt_xim = 0;
TQString ximServerName(qt_ximServer);
if (qt_ximServer)
ximServerName.prepend("@im=");
else
ximServerName = "";
if ( !XSupportsLocale() )
qWarning("TQt: Locales not supported on X server");
#ifdef USE_X11R6_XIM
else if ( XSetLocaleModifiers (ximServerName.ascii()) == 0 )
qWarning( "TQt: Cannot set locale modifiers: %s",
ximServerName.ascii());
else {
Display *dpy = TQPaintDevice::x11AppDisplay();
XWindowAttributes attr; // XIM unselects all events on the root window
XGetWindowAttributes( dpy, TQPaintDevice::x11AppRootWindow(),&attr );
XRegisterIMInstantiateCallback(dpy, 0, 0, 0,
(XIMProc) xim_create_callback, 0);
XSelectInput( dpy, TQPaintDevice::x11AppRootWindow(), attr.your_event_tqmask );
}
#else // !USE_X11R6_XIM
else if ( XSetLocaleModifiers ("") == 0 )
qWarning("TQt: Cannot set locale modifiers");
else
TQXIMInputContext::create_xim();
#endif // USE_X11R6_XIM
#endif // TQT_NO_XIM
}
/*! \internal
Creates the application input method.
*/
void TQXIMInputContext::create_xim()
{
#ifndef TQT_NO_XIM
Display *appDpy = TQPaintDevice::x11AppDisplay();
qt_xim = XOpenIM( appDpy, 0, 0, 0 );
if ( qt_xim ) {
#ifdef USE_X11R6_XIM
XIMCallback destroy;
destroy.callback = (XIMProc) xim_destroy_callback;
destroy.client_data = 0;
if ( XSetIMValues( qt_xim, XNDestroyCallback, &destroy, (char *) 0 ) != 0 )
qWarning( "Xlib doesn't support destroy callback");
#endif // USE_X11R6_XIM
XIMStyles *styles = 0;
XGetIMValues(qt_xim, XNQueryInputStyle, &styles, (char *) 0, (char *) 0);
if ( styles ) {
int i;
for ( i = 0; !qt_xim_style && i < styles->count_styles; i++ ) {
if ( styles->supported_styles[i] == qt_xim_preferred_style ) {
qt_xim_style = qt_xim_preferred_style;
break;
}
}
// if the preferred input style couldn't be found, look for
// Nothing
for ( i = 0; !qt_xim_style && i < styles->count_styles; i++ ) {
if ( styles->supported_styles[i] == (XIMPreeditNothing |
XIMStatusNothing) ) {
qt_xim_style = XIMPreeditNothing | XIMStatusNothing;
break;
}
}
// ... and failing that, None.
for ( i = 0; !qt_xim_style && i < styles->count_styles; i++ ) {
if ( styles->supported_styles[i] == (XIMPreeditNone |
XIMStatusNone) ) {
qt_xim_style = XIMPreeditNone | XIMStatusNone;
break;
}
}
// qDebug("TQApplication: using im style %lx", qt_xim_style);
XFree( (char *)styles );
}
if ( qt_xim_style ) {
#ifdef USE_X11R6_XIM
XUnregisterIMInstantiateCallback(appDpy, 0, 0, 0,
(XIMProc) xim_create_callback, 0);
#endif // USE_X11R6_XIM
} else {
// Give up
qWarning( "No supported input style found."
" See InputMethod documentation.");
TQXIMInputContext::close_xim();
}
}
#endif // TQT_NO_XIM
}
/*! \internal
Closes the application input method.
*/
void TQXIMInputContext::close_xim()
{
#ifndef TQT_NO_XIM
TQString errMsg( "TQXIMInputContext::close_xim() has been called" );
// Calling XCloseIM gives a Purify FMR error
// XCloseIM( qt_xim );
// We prefer a less serious memory leak
qt_xim = 0;
if( ximContextList ) {
TQPtrList<TQXIMInputContext> contexts( *ximContextList );
TQPtrList<TQXIMInputContext>::Iterator it = contexts.begin();
while( it != contexts.end() ) {
(*it)->close( errMsg );
++it;
}
// ximContextList will be deleted in ~TQXIMInputContext
}
#endif // TQT_NO_XIM
}
bool TQXIMInputContext::x11FilterEvent( TQWidget *keywidget, XEvent *event )
{
#ifndef TQT_NO_XIM
int xkey_keycode = event->xkey.keycode;
if ( XFilterEvent( event, keywidget->tqtopLevelWidget()->winId() ) ) {
qt_ximComposingKeycode = xkey_keycode; // ### not documented in xlib
// Cancel of the composition is realizable even if
// follwing codes don't exist
#if 0
if ( event->type != XKeyPress || ! (qt_xim_style & XIMPreeditCallbacks) )
return TRUE;
/*
* The Solaris htt input method will transform a ClientMessage
* event into a filtered KeyPress event, in which case our
* keywidget is still zero.
*/
TQETWidget *widget = (TQETWidget*)TQWidget::tqfind( (WId)event->xany.window );
if ( ! keywidget ) {
keywidget = (TQETWidget*)TQWidget::keyboardGrabber();
if ( keywidget ) {
grabbed = TRUE;
} else {
if ( focus_widget )
keywidget = (TQETWidget*)focus_widget;
if ( !keywidget ) {
if ( tqApp->inPopupMode() ) // no focus widget, see if we have a popup
keywidget = (TQETWidget*) tqApp->activePopupWidget();
else if ( widget )
keywidget = (TQETWidget*)widget->tqtopLevelWidget();
}
}
}
/*
if the composition string has been emptied, we need to send
an IMEnd event. however, we have no way to tell if the user
has cancelled input, or if the user has accepted the
composition.
so, we have to look for the next keypress and see if it is
the 'commit' key press (keycode == 0). if it is, we deliver
an IMEnd event with the final text, otherwise we deliver an
IMEnd with empty text (meaning the user has cancelled the
input).
*/
if ( composing && tqfocusWidget && qt_compose_emptied ) {
XEvent event2;
bool found = FALSE;
if ( XCheckTypedEvent( TQPaintDevice::x11AppDisplay(),
XKeyPress, &event2 ) ) {
if ( event2.xkey.keycode == 0 ) {
// found a key event with the 'commit' string
found = TRUE;
XPutBackEvent( TQPaintDevice::x11AppDisplay(), &event2 );
}
}
if ( !found ) {
// no key event, so the user must have cancelled the composition
TQIMEvent endevent( TQEvent::IMEnd, TQString(), -1 );
TQApplication::sendEvent( tqfocusWidget, &endevent );
tqfocusWidget = 0;
}
qt_compose_emptied = FALSE;
}
#endif
return TRUE;
} else if ( tqfocusWidget() ) {
if ( event->type == XKeyPress && event->xkey.keycode == 0 ) {
// input method has sent us a commit string
TQCString data(513);
KeySym sym; // unused
tqStatus status; // unused
TQString inputText;
int count = lookupString( &(event->xkey), data, &sym, &status );
if ( count > 0 )
inputText = qt_input_mapper->toUnicode( data, count );
if ( ! ( qt_xim_style & XIMPreeditCallbacks ) || ! isComposing() ) {
// there is no composing state
sendIMEvent( TQEvent::IMStart );
}
sendIMEvent( TQEvent::IMEnd, inputText );
resetClientState();
return TRUE;
}
}
#endif // !TQT_NO_XIM
return FALSE;
}
void TQXIMInputContext::sendIMEvent( TQEvent::Type type, const TQString &text,
int cursorPosition, int selLength )
{
TQInputContext::sendIMEvent( type, text, cursorPosition, selLength );
if ( type == TQEvent::IMCompose )
composingText = text;
}
void TQXIMInputContext::reset()
{
#if !defined(TQT_NO_XIM)
if ( tqfocusWidget() && isComposing() && ! composingText.isNull() ) {
#ifdef TQT_XIM_DEBUG
qDebug("TQXIMInputContext::reset: composing - sending IMEnd (empty) to %p",
tqfocusWidget() );
#endif // TQT_XIM_DEBUG
TQInputContext::reset();
resetClientState();
char *mb = XmbResetIC((XIC) ic);
if (mb)
XFree(mb);
}
#endif // !TQT_NO_XIM
}
void TQXIMInputContext::resetClientState()
{
#if !defined(TQT_NO_XIM)
composingText = TQString();
if ( selectedChars.size() < 128 )
selectedChars.resize( 128 );
selectedChars.fill( 0 );
#endif // !TQT_NO_XIM
}
void TQXIMInputContext::close( const TQString &errMsg )
{
qDebug( errMsg );
emit deletionRequested();
}
bool TQXIMInputContext::hasFocus() const
{
return ( tqfocusWidget() != 0 );
}
void TQXIMInputContext::setMicroFocus(int x, int y, int, int h, TQFont *f)
{
TQWidget *widget = tqfocusWidget();
if ( qt_xim && widget ) {
TQPoint p( x, y );
TQPoint p2 = widget->mapTo( widget->tqtopLevelWidget(), TQPoint( 0, 0 ) );
p = widget->tqtopLevelWidget()->mapFromGlobal( p );
setXFontSet( f ? *f : widget->font() );
setComposePosition(p.x(), p.y() + h);
setComposeArea(p2.x(), p2.y(), widget->width(), widget->height());
}
}
void TQXIMInputContext::mouseHandler( int , TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState)
{
if ( type == TQEvent::MouseButtonPress ||
type == TQEvent::MouseButtonDblClick ) {
// Don't reset Japanese input context here. Japanese input
// context sometimes contains a whole paragraph and has
// minutes of lifetime different to ephemeral one in other
// languages. The input context should be survived until
// focused again.
if ( ! isPreeditPreservationEnabled() )
reset();
}
}
void TQXIMInputContext::setComposePosition(int x, int y)
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
XPoint point;
point.x = x;
point.y = y;
XVaNestedList preedit_attr =
XVaCreateNestedList(0,
XNSpotLocation, &point,
(char *) 0);
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
}
#endif // !TQT_NO_XIM
}
void TQXIMInputContext::setComposeArea(int x, int y, int w, int h)
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
XRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
XVaNestedList preedit_attr = XVaCreateNestedList(0,
XNArea, &rect,
(char *) 0);
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
}
#endif
}
void TQXIMInputContext::setXFontSet(const TQFont &f)
{
#if !defined(TQT_NO_XIM)
if (font == f) return; // nothing to do
font = f;
XFontSet fs = getFontSet(font);
if (fontset == fs) return; // nothing to do
fontset = fs;
XVaNestedList preedit_attr = XVaCreateNestedList(0, XNFontSet, fontset, (char *) 0);
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
#else
Q_UNUSED( f );
#endif
}
int TQXIMInputContext::lookupString(XKeyEvent *event, TQCString &chars,
KeySym *key, tqStatus *status) const
{
int count = 0;
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
count = XmbLookupString((XIC) ic, event, chars.data(),
chars.size(), key, status);
if ((*status) == XBufferOverflow ) {
chars.resize(count + 1);
count = XmbLookupString((XIC) ic, event, chars.data(),
chars.size(), key, status);
}
}
#endif // TQT_NO_XIM
return count;
}
void TQXIMInputContext::setFocus()
{
#if !defined(TQT_NO_XIM)
if ( qt_xim && ic )
XSetICFocus((XIC) ic);
#endif // !TQT_NO_XIM
}
void TQXIMInputContext::unsetFocus()
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic)
XUnsetICFocus((XIC) ic);
#endif // !TQT_NO_XIM
// Don't reset Japanese input context here. Japanese input context
// sometimes contains a whole paragraph and has minutes of
// lifetime different to ephemeral one in other languages. The
// input context should be survived until focused again.
if ( ! isPreeditPreservationEnabled() )
reset();
}
bool TQXIMInputContext::isPreeditRelocationEnabled()
{
return ( language() == "ja" );
}
bool TQXIMInputContext::isPreeditPreservationEnabled()
{
return ( language() == "ja" );
}
TQString TQXIMInputContext::identifierName()
{
// the name should be "xim" rather than "XIM" to be consistent
// with corresponding immodule of GTK+
return "xim";
}
TQString TQXIMInputContext::language()
{
#if !defined(TQT_NO_XIM)
if ( qt_xim ) {
TQString locale( XLocaleOfIM( qt_xim ) );
if ( locale.startsWith( "zh" ) ) {
// Chinese language should be formed as "zh_CN", "zh_TW", "zh_HK"
_language = locale.left( 5 );
} else {
// other languages should be two-letter ISO 639 language code
_language = locale.left( 2 );
}
}
#endif
return _language;
}
#endif //TQT_NO_IM

@ -0,0 +1,86 @@
/****************************************************************************
** $Id$
**
** Implementation of TQXIMInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqximinputcontext.h"
#include "tqximinputcontextplugin.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
TQXIMInputContextPlugin::TQXIMInputContextPlugin()
{
}
TQXIMInputContextPlugin::~TQXIMInputContextPlugin()
{
}
TQStringList TQXIMInputContextPlugin::keys() const
{
return TQStringList( "xim" );
}
TQInputContext *TQXIMInputContextPlugin::create( const TQString & )
{
return new TQXIMInputContext;
}
TQStringList TQXIMInputContextPlugin::languages( const TQString & )
{
return TQStringList( "" );
}
TQString TQXIMInputContextPlugin::displayName( const TQString & )
{
return tr( "XIM" );
}
TQString TQXIMInputContextPlugin::description( const TQString & )
{
return tr( "XIM input method" );
}
TQ_EXPORT_PLUGIN( TQXIMInputContextPlugin )
#endif

@ -0,0 +1,63 @@
/****************************************************************************
** $Id$
**
** Definition of TQXIMInputContextPlugin class
**
** Copyright (C) 2004 immodule for TQt Project. All rights reserved.
**
** This file is written to contribute to Trolltech AS under their own
** licence. You may use this file under your TQt license. Following
** description is copied from their original file headers. Contact
** immodule-qt@freedesktop.org if any conditions of this licensing are
** not clear to you.
**
**
** This file is part of the input method module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQT_NO_IM
#include "tqximinputcontext.h"
#include <tqinputcontextplugin.h>
#include <tqstringlist.h>
class TQXIMInputContextPlugin : public TQInputContextPlugin
{
TQ_OBJECT
public:
TQXIMInputContextPlugin();
~TQXIMInputContextPlugin();
TQStringList keys() const;
TQInputContext *create( const TQString &key );
TQStringList languages( const TQString &key );
TQString displayName( const TQString &key );
TQString description( const TQString &key );
};
#endif

@ -0,0 +1,14 @@
TEMPLATE = lib
TARGET = qxim
DESTDIR = ../../../inputmethods
INCLUDEPATH += .
CONFIG += qt warn_on debug plugin
target.path += $$plugins.path/inputmethods
INSTALLS += target
# Input
HEADERS += qximinputcontext.h \
qximinputcontextplugin.h
SOURCES += qximinputcontext_x11.cpp \
qximinputcontextplugin.cpp

@ -12,7 +12,7 @@ unix {
OBJECTS_DIR = .obj OBJECTS_DIR = .obj
!tqcontains( LIBS, .*gds.* ):!tqcontains( LIBS, .*libfb.* ) { !tqcontains( LIBS, .*gds.* ):!tqcontains( LIBS, .*libfb.* ) {
LIBS *= -lgds LIBS *= -lfbclient
} }
} }
win32 { win32 {

@ -1,10 +1,10 @@
TEMPLATE = subdirs TEMPLATE = subdirs
shared { shared {
SUBDIRS *= accessible codecs imageformats sqldrivers styles SUBDIRS *= accessible codecs imageformats inputmethods sqldrivers styles
embedded:SUBDIRS *= gfxdrivers embedded:SUBDIRS *= gfxdrivers
} }
dll { dll {
SUBDIRS *= accessible codecs imageformats sqldrivers styles SUBDIRS *= accessible codecs imageformats inputmethods sqldrivers styles
embedded:SUBDIRS *= gfxdrivers embedded:SUBDIRS *= gfxdrivers
} }

@ -67,7 +67,7 @@ Option::TQMAKE_MODE Option::qmake_mode = Option::TQMAKE_GENERATE_NOTHING;
//all modes //all modes
int Option::warn_level = WarnLogic; int Option::warn_level = WarnLogic;
int Option::debug_level = 0; int Option::debug_level = 0;
TQFile Option::output; TQFile Option::output("");
TQString Option::output_dir; TQString Option::output_dir;
TQStringList Option::before_user_vars; TQStringList Option::before_user_vars;
TQStringList Option::after_user_vars; TQStringList Option::after_user_vars;

@ -0,0 +1,63 @@
// Use the __NO_INLINE__ hack below to prevent sys/stat.h from
// exporting __extern_inline definitions of the symbols [fl]?stat64
// with g++-4.3 or later and glibc6 >= 2.7 or later. This flag has no
// impact on [fl]?stat(64)? symbol export for glibc6 << 2.7
//
#ifndef __NO_INLINE__
# define __NO_INLINE__
# define INLINE_ENABLED
#endif
#include <sys/stat.h>
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 7)
// We must ensure that [fl]?stat64 are exported in the dynamic symbol
// table of libqt-mt.so.3 as weak symbols to preserve ABI.
int stat64 (__const char *__path, struct stat64 *__statbuf) __attribute__((weak));
int lstat64 (__const char *__path, struct stat64 *__statbuf) __attribute__((weak));
int fstat64 (int __fd, struct stat64 *__statbuf) __attribute__((weak));
int stat64 (__const char *__path, struct stat64 *__statbuf)
{
return __xstat64 (_STAT_VER, __path, __statbuf);
}
int lstat64 (__const char *__path, struct stat64 *__statbuf)
{
return __lxstat64 (_STAT_VER, __path, __statbuf);
}
int fstat64 (int __fd, struct stat64 *__statbuf)
{
return __fxstat64 (_STAT_VER, __fd, __statbuf);
}
#else
# ifndef INLINE_ENABLED
/*
* Trigger export of the extern __inline [fl]?stat64 symbols
* (defined at <sys/stat.h>) by referencing them in the dummy
* hidden function below. It's very important to reference
* [fl]?stat64 via their [fl]?stat aliases (because LARGEFILE
* is enabled) for these weak symbols to get exported.
*
* This hack is compatible with libc6-dev << 2.7 headers.
*
* This source file must be compiled with -fno-inline to have
* expected effect.
**/
void __stat_extern_inline_export_hack()
__attribute__((visibility("hidden")));
void __stat_extern_inline_export_hack() {
struct stat buf;
stat("", &buf);
lstat("", &buf);
fstat(0, &buf);
}
# else
# error "This file must be compiled with inline disabled for the hack to be effective."
# endif /* INLINES_ENABLED */
#endif

@ -303,7 +303,7 @@ public:
TQString toUnicode(const char* chars, int len) TQString toUnicode(const char* chars, int len)
{ {
TQString result; TQString result;
result.setLength( len ); // worst case result.setLength( len + 1 ); // worst case
TQChar *qch = (TQChar *)result.tqunicode(); TQChar *qch = (TQChar *)result.tqunicode();
TQChar ch; TQChar ch;
while ( len-- ) { while ( len-- ) {

@ -681,6 +681,11 @@ bool TQDialog::event( TQEvent *e )
#if defined(TQ_WS_X11) #if defined(TQ_WS_X11)
extern "C" { int XSetTransientForHint( Display *, unsigned long, unsigned long ); } extern "C" { int XSetTransientForHint( Display *, unsigned long, unsigned long ); }
#include <private/tqt_x11_p.h>
#undef FocusIn
// defined in qapplication_x11.cpp
extern Atom qt_net_wm_full_placement;
extern bool qt_net_supports(Atom atom);
#endif // TQ_WS_X11 #endif // TQ_WS_X11
/*! /*!
@ -702,10 +707,12 @@ void TQDialog::show()
if ( !did_resize ) if ( !did_resize )
adjustSize(); adjustSize();
if ( has_relpos && !did_move ) { if( !qt_net_supports( qt_net_wm_full_placement )) {
adjustPositionInternal( parentWidget(), TRUE ); if ( has_relpos && !did_move ) {
} else if ( !did_move ) { adjustPositionInternal( parentWidget(), TRUE );
adjustPositionInternal( parentWidget() ); } else if ( !did_move ) {
adjustPositionInternal( parentWidget() );
}
} }
if (windowState() != state) if (windowState() != state)
@ -716,7 +723,7 @@ void TQDialog::show()
&& tqApp->mainWidget() && tqApp->mainWidget()->isVisible() && tqApp->mainWidget() && tqApp->mainWidget()->isVisible()
&& !tqApp->mainWidget()->isMinimized()) { && !tqApp->mainWidget()->isMinimized()) {
// make sure the transient for hint is set properly for modal dialogs // make sure the transient for hint is set properly for modal dialogs
XSetTransientForHint( x11Display(), winId(), tqApp->mainWidget()->winId() ); x11SetWindowTransient( tqApp->mainWidget());
} }
#endif // TQ_WS_X11 #endif // TQ_WS_X11
@ -811,7 +818,9 @@ void TQDialog::adjustPositionInternal( TQWidget*w, bool useRelPos)
w = w->tqtopLevelWidget(); w = w->tqtopLevelWidget();
TQRect desk; TQRect desk;
if ( w ) { if ( w ) {
scrn = TQApplication::desktop()->screenNumber( w ); // Use mapToGlobal rather than tqgeometry() in case w might
// be embedded in another application
scrn = TQApplication::desktop()->screenNumber( w->mapToGlobal( TQPoint(0,0) ) );
} else if ( TQApplication::desktop()->isVirtualDesktop() ) { } else if ( TQApplication::desktop()->isVirtualDesktop() ) {
scrn = TQApplication::desktop()->screenNumber( TQCursor::pos() ); scrn = TQApplication::desktop()->screenNumber( TQCursor::pos() );
} else { } else {

@ -264,6 +264,7 @@ public:
TQIconViewToolTip *toolTip; TQIconViewToolTip *toolTip;
TQPixmapCache maskCache; TQPixmapCache maskCache;
TQPixmap *backrubber;
TQPtrDict<TQIconViewItem> selectedItems; TQPtrDict<TQIconViewItem> selectedItems;
struct ItemContainer { struct ItemContainer {
@ -1998,14 +1999,27 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
if ( picture() ) { if ( picture() ) {
TQPicture *pic = picture(); TQPicture *pic = picture();
if ( isSelected() ) { if ( isSelected() ) {
p->fillRect( pixmapRect( FALSE ), TQBrush( cg.highlight(), Qt::Dense4Pattern) ); p->setBrush( TQBrush( cg.highlight(), TQBrush::Dense4Pattern ) );
p->setPen( TQPen( cg.highlight(), TQBrush::Dense4Pattern ) );
p->drawRoundRect( pixmapRect( FALSE ),
1000 / pixmapRect( FALSE ).width(),
1000 / pixmapRect( FALSE ).height() );
} }
p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic ); p->drawPicture( x()-pic->boundingRect().x(), y()-pic->boundingRect().y(), *pic );
if ( isSelected() ) { if ( isSelected() ) {
p->fillRect( textRect( FALSE ), cg.highlight() ); p->setBrush( TQBrush( cg.highlight() ) );
p->setPen( TQPen( cg.highlight() ) );
p->drawRoundRect( textRect( FALSE ),
1000 / textRect( FALSE ).width(),
1000 / textRect( FALSE ).height() );
p->setPen( TQPen( cg.highlightedText() ) ); p->setPen( TQPen( cg.highlightedText() ) );
} else if ( view->d->itemTextBrush != Qt::NoBrush ) } else if ( view->d->itemTextBrush != Qt::NoBrush ) {
p->fillRect( textRect( FALSE ), view->d->itemTextBrush ); p->setBrush( view->d->itemTextBrush );
p->setPen( TQPen( view->d->itemTextBrush.color() ) );
p->drawRoundRect( textRect( FALSE ),
1000 / textRect( FALSE ).width(),
1000 / textRect( FALSE ).height() );
}
int align = view->itemTextPos() == TQIconView::Bottom ? AlignHCenter : AlignAuto; int align = view->itemTextPos() == TQIconView::Bottom ? AlignHCenter : AlignAuto;
if ( view->d->wordWrapIconText ) if ( view->d->wordWrapIconText )
@ -2063,10 +2077,19 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
p->save(); p->save();
if ( isSelected() ) { if ( isSelected() ) {
p->fillRect( textRect( FALSE ), cg.highlight() ); p->setBrush( TQBrush( cg.highlight() ) );
p->setPen( TQPen( cg.highlight() ) );
p->drawRoundRect( textRect( FALSE ),
1000 / textRect( FALSE ).width(),
1000 / textRect( FALSE ).height() );
p->setPen( TQPen( cg.highlightedText() ) ); p->setPen( TQPen( cg.highlightedText() ) );
} else if ( view->d->itemTextBrush != Qt::NoBrush ) } else if ( view->d->itemTextBrush != Qt::NoBrush ) {
p->fillRect( textRect( FALSE ), view->d->itemTextBrush ); p->setBrush( view->d->itemTextBrush );
p->setPen( TQPen( view->d->itemTextBrush.color() ) );
p->drawRoundRect( textRect( FALSE ),
1000 / textRect( FALSE ).width(),
1000 / textRect( FALSE ).height() );
}
int align = AlignHCenter; int align = AlignHCenter;
if ( view->d->wordWrapIconText ) if ( view->d->wordWrapIconText )
@ -2082,31 +2105,14 @@ void TQIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg )
/*! /*!
Paints the focus rectangle of the item using the painter \a p and Paints the focus rectangle of the item using the painter \a p and
the color group \a cg. the color group \a cg.
The default implementation does nothing; subclasses may
reimplement this function.
*/ */
void TQIconViewItem::paintFocus( TQPainter *p, const TQColorGroup &cg ) void TQIconViewItem::paintFocus( TQPainter *p, const TQColorGroup & )
{ {
if ( !view )
return;
view->tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, p,
TQRect( textRect( FALSE ).x(), textRect( FALSE ).y(),
textRect( FALSE ).width(),
textRect( FALSE ).height() ), cg,
(isSelected() ?
TQStyle::Style_FocusAtBorder :
TQStyle::Style_Default),
TQStyleOption(isSelected() ? cg.highlight() : cg.base()));
if ( this != view->d->currentItem ) {
view->tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, p,
TQRect( pixmapRect( FALSE ).x(),
pixmapRect( FALSE ).y(),
pixmapRect( FALSE ).width(),
pixmapRect( FALSE ).height() ),
cg, TQStyle::Style_Default,
TQStyleOption(cg.base()));
}
} }
/*! /*!
@ -2804,6 +2810,7 @@ TQIconView::TQIconView( TQWidget *tqparent, const char *name, WFlags f )
d->renamingItem = 0; d->renamingItem = 0;
d->drawActiveSelection = TRUE; d->drawActiveSelection = TRUE;
d->drawDragShapes = FALSE; d->drawDragShapes = FALSE;
d->backrubber = 0;
connect( d->adjustTimer, TQT_SIGNAL( timeout() ), connect( d->adjustTimer, TQT_SIGNAL( timeout() ),
this, TQT_SLOT( adjustItems() ) ); this, TQT_SLOT( adjustItems() ) );
@ -3288,7 +3295,7 @@ uint TQIconView::count() const
void TQIconView::doAutoScroll() void TQIconView::doAutoScroll()
{ {
TQRect oldRubber = TQRect( *d->rubber ); TQRect oldRubber = *d->rubber;
TQPoint vp = viewport()->mapFromGlobal( TQCursor::pos() ); TQPoint vp = viewport()->mapFromGlobal( TQCursor::pos() );
TQPoint pos = viewportToContents( vp ); TQPoint pos = viewportToContents( vp );
@ -3305,7 +3312,6 @@ void TQIconView::doAutoScroll()
bool block = tqsignalsBlocked(); bool block = tqsignalsBlocked();
TQRect rr; TQRect rr;
TQRegion region( 0, 0, visibleWidth(), visibleHeight() );
blockSignals( TRUE ); blockSignals( TRUE );
viewport()->setUpdatesEnabled( FALSE ); viewport()->setUpdatesEnabled( FALSE );
@ -3331,9 +3337,6 @@ void TQIconView::doAutoScroll()
item->setSelected( TRUE, TRUE ); item->setSelected( TRUE, TRUE );
changed = TRUE; changed = TRUE;
rr = rr.unite( item->rect() ); rr = rr.unite( item->rect() );
} else {
region = region.subtract( TQRect( contentsToViewport( item->pos() ),
item->size() ) );
} }
minx = TQMIN( minx, item->x() - 1 ); minx = TQMIN( minx, item->x() - 1 );
@ -3350,37 +3353,72 @@ void TQIconView::doAutoScroll()
viewport()->setUpdatesEnabled( TRUE ); viewport()->setUpdatesEnabled( TRUE );
blockSignals( block ); blockSignals( block );
TQRect r = *d->rubber; // static bool drawAll;
*d->rubber = oldRubber; if ( d->backrubber == 0 ) {
d->backrubber = new TQPixmap( viewport()->rect().size() );
TQPainter p; d->backrubber->fill( viewport(), viewport()->rect().topLeft() );
p.begin( viewport() ); // drawAll = true;
p.setRasterOp( TQt::NotROP );
p.setPen( TQPen( Qt::color0, 1 ) );
p.setBrush( Qt::NoBrush );
drawRubber( &p );
d->dragging = FALSE;
p.end();
*d->rubber = r;
if ( changed ) {
d->drawAllBack = FALSE;
d->clipRegion = region;
repaintContents( rr, FALSE );
d->drawAllBack = TRUE;
} }
// int oldX = 0, oldY = 0;
// if ( !drawAll && d->scrollTimer ) {
// oldX = contentsX();
// oldY = contentsY();
// }
ensureVisible( pos.x(), pos.y() ); ensureVisible( pos.x(), pos.y() );
// if ( !drawAll && d->scrollTimer && ( oldX != contentsX() || oldY != contentsY() ) )
// drawAll = true;
p.begin( viewport() ); TQRect allRect = oldRubber.normalize();
p.setRasterOp( TQt::NotROP ); if ( changed )
p.setPen( TQPen( Qt::color0, 1 ) ); allRect |= rr.normalize();
p.setBrush( Qt::NoBrush ); allRect |= d->rubber->normalize();
drawRubber( &p ); TQPoint point = contentsToViewport( allRect.topLeft() );
d->dragging = TRUE; allRect = TQRect( point.x(), point.y(), allRect.width(), allRect.height() );
allRect &= viewport()->rect();
d->dragging = FALSE;
TQPainter p( d->backrubber );
p.translate( -contentsX(), -contentsY() );
#if 0
if ( !drawAll ) {
oldRubber = oldRubber.normalize();
point = contentsToViewport( oldRubber.topLeft() );
oldRubber = TQRect( point.x(), point.y(), oldRubber.width(), oldRubber.height() );
oldRubber &= viewport()->rect();
point = contentsToViewport( nr.topLeft() );
nr = TQRect( point.x(), point.y(), nr.width(), nr.height() );
nr &= viewport()->rect();
TQRegion region;
if ( allRect != nr )
region = TQRegion(allRect).subtract( TQRegion( nr ) );
if ( allRect != oldRubber )
region += TQRegion(allRect).subtract( TQRegion( oldRubber ) );
TQMemArray< TQRect > ar = region.rects();
for ( uint i = 0; i < ar.size(); ++i ) {
ar[i].addCoords( -2, -2, 4, 4 );
ar[i] = ar[i].normalize();
p.setClipRect( ar[i] );
drawContents( &p, contentsX() + ar[i].left(), contentsY() + ar[i].top(), ar[i].width(), ar[i].height() );
}
}
else
#endif
{
drawContents( &p,
contentsX() + allRect.left(), contentsY() + allRect.top(),
allRect.width(), allRect.height() );
}
p.end(); p.end();
// drawAll = false;
d->dragging = TRUE;
bitBlt( viewport(), allRect.topLeft(), d->backrubber, allRect );
if ( changed ) { if ( changed ) {
emit selectionChanged(); emit selectionChanged();
@ -3412,9 +3450,7 @@ void TQIconView::doAutoScroll()
void TQIconView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch ) void TQIconView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch )
{ {
if ( d->dragging && d->rubber ) p->save();
drawRubber( p );
TQRect r = TQRect( cx, cy, cw, ch ); TQRect r = TQRect( cx, cy, cw, ch );
TQIconViewPrivate::ItemContainer *c = d->firstContainer; TQIconViewPrivate::ItemContainer *c = d->firstContainer;
@ -3488,8 +3524,16 @@ void TQIconView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch )
d->currentItem->paintFocus( p, tqcolorGroup() ); d->currentItem->paintFocus( p, tqcolorGroup() );
} }
if ( d->dragging && d->rubber ) p->restore();
drawRubber( p ); if ( d->rubber ) {
p->save();
p->translate( contentsX(), contentsY() );
p->setRasterOp( NotROP );
p->setPen( TQPen( color0, 1 ) );
p->setBrush( NoBrush );
drawRubber( p );
p->restore();
}
} }
/*! /*!
@ -4388,17 +4432,15 @@ void TQIconView::contentsMousePressEvent( TQMouseEvent *e )
void TQIconView::contentsMousePressEventEx( TQMouseEvent *e ) void TQIconView::contentsMousePressEventEx( TQMouseEvent *e )
{ {
if ( d->rubber ) { if ( d->rubber ) {
TQPainter p; TQRect r( d->rubber->normalize() );
p.begin( viewport() ); delete d->rubber;
p.setRasterOp( TQt::NotROP ); d->rubber = 0;
p.setPen( TQPen( Qt::color0, 1 ) );
p.setBrush( Qt::NoBrush );
drawRubber( &p ); repaintContents( r, FALSE );
d->dragging = FALSE; d->dragging = FALSE;
p.end();
delete d->rubber; delete d->backrubber;
d->rubber = 0; d->backrubber = 0;
if ( d->scrollTimer ) { if ( d->scrollTimer ) {
disconnect( d->scrollTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( doAutoScroll() ) ); disconnect( d->scrollTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( doAutoScroll() ) );
@ -4583,21 +4625,17 @@ void TQIconView::contentsMouseReleaseEvent( TQMouseEvent *e )
d->startDragItem = 0; d->startDragItem = 0;
if ( d->rubber ) { if ( d->rubber ) {
TQPainter p; TQRect r(d->rubber->normalize());
p.begin( viewport() );
p.setRasterOp( TQt::NotROP );
p.setPen( TQPen( Qt::color0, 1 ) );
p.setBrush( Qt::NoBrush );
drawRubber( &p );
d->dragging = FALSE;
p.end();
if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() > if ( ( d->rubber->topLeft() - d->rubber->bottomRight() ).manhattanLength() >
TQApplication::startDragDistance() ) TQApplication::startDragDistance() )
emitClicked = FALSE; emitClicked = FALSE;
delete d->rubber; delete d->rubber;
d->rubber = 0; d->rubber = 0;
repaintContents(r, FALSE);
d->dragging = FALSE;
delete d->backrubber;
d->backrubber = 0;
d->currentItem = d->tmpCurrentItem; d->currentItem = d->tmpCurrentItem;
d->tmpCurrentItem = 0; d->tmpCurrentItem = 0;
if ( d->currentItem ) if ( d->currentItem )
@ -5365,9 +5403,9 @@ void TQIconView::drawRubber( TQPainter *p )
TQPoint pnt( d->rubber->x(), d->rubber->y() ); TQPoint pnt( d->rubber->x(), d->rubber->y() );
pnt = contentsToViewport( pnt ); pnt = contentsToViewport( pnt );
tqstyle().tqdrawPrimitive(TQStyle::PE_RubberBand, p, tqstyle().tqdrawPrimitive( TQStyle::PE_RubberBand, p,
TQRect(pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height()), TQRect( pnt.x(), pnt.y(), d->rubber->width(), d->rubber->height() ).normalize(),
tqcolorGroup(), TQStyle::Style_Default, TQStyleOption(tqcolorGroup().base())); tqcolorGroup(), TQStyle::Style_Default, TQStyleOption(tqcolorGroup().base()) );
} }
/*! /*!

@ -0,0 +1,186 @@
/****************************************************************************
** $Id: qinputcontextfactory.cpp,v 1.2 2004/06/20 18:43:11 daisuke Exp $
**
** Implementation of TQInputContextFactory class
**
** Created : 001103
**
** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition licenses may use this
** file in accordance with the TQt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tqinputcontextinterface_p.h" // up here for GCC 2.7.* compatibility
#include "tqinputcontextfactory.h"
#include "tqinputcontext.h"
#ifndef TQT_NO_IM
#include "tqapplication.h"
#ifdef TQT_THREAD_SUPPORT
#include <private/tqmutexpool_p.h>
#endif // TQT_THREAD_SUPPORT
#include <stdlib.h>
#include "tqcleanuphandler.h"
#include <private/tqpluginmanager_p.h>
#ifndef TQT_NO_COMPONENT
static TQPluginManager<TQInputContextFactoryInterface> *manager = 0;
static TQSingleCleanupHandler< TQPluginManager<TQInputContextFactoryInterface> > cleanup_manager;
static void create_manager()
{
if( manager ) // already created
return;
#ifdef TQT_THREAD_SUPPORT
// protect manager creation
TQMutexLocker locker( qt_global_mutexpool ?
qt_global_mutexpool->get( &manager ) : 0);
// we check the manager pointer again to make sure that another thread
// has not created the manager before us.
if ( manager ) // already created
return;
#endif
manager = new TQPluginManager<TQInputContextFactoryInterface>( IID_TQInputContextFactory, TQApplication::libraryPaths(), "/inputmethods", FALSE );
Q_CHECK_PTR( manager );
cleanup_manager.set( &manager );
}
#endif //TQT_NO_COMPONENT
/*!
This function generates the input context that has the identifier
name which is in agreement with \a key. \a widget is the client
widget of TQInputContext. \a widget may be null.
*/
TQInputContext *TQInputContextFactory::create( const TQString& key, TQWidget *widget )
{
TQInputContext *ret = 0;
TQString inputcontext = key;
#ifndef TQT_NO_COMPONENT
// make sure the manager is created
create_manager();
TQInterfacePtr<TQInputContextFactoryInterface> iface;
manager->queryInterface( inputcontext, &iface );
if ( iface ) {
ret = iface->create( inputcontext );
#ifdef TQ_WS_X11
if ( ret )
ret->setHolderWidget( widget );
#endif
}
#endif
return ret;
}
/*!
This function returns the list of the names input methods.
Only input methods included in default and placed under
$TQTDIR/plugins/inputmethods are listed.
*/
TQStringList TQInputContextFactory::keys()
{
TQStringList list;
#ifndef TQT_NO_COMPONENT
// make sure the manager is created
create_manager();
list = manager->featureList();
#endif //TQT_NO_COMPONENT
return list;
}
TQStringList TQInputContextFactory::languages( const TQString &key )
{
TQStringList result;
#ifndef TQT_NO_COMPONENT
// make sure the manager is created
create_manager();
TQInterfacePtr<TQInputContextFactoryInterface> iface;
manager->queryInterface( key, &iface );
if ( iface )
result = iface->languages( key );
#endif //TQT_NO_COMPONENT
return result;
}
TQString TQInputContextFactory::displayName( const TQString &key )
{
TQString result( "" );
#ifndef TQT_NO_COMPONENT
// make sure the manager is created
create_manager();
TQInterfacePtr<TQInputContextFactoryInterface> iface;
manager->queryInterface( key, &iface );
if ( iface )
result = iface->displayName( key );
#endif //TQT_NO_COMPONENT
return result;
}
TQString TQInputContextFactory::description( const TQString &key )
{
TQString result( "" );
#ifndef TQT_NO_COMPONENT
// make sure the manager is created
create_manager();
TQInterfacePtr<TQInputContextFactoryInterface> iface;
manager->queryInterface( key, &iface );
if ( iface )
result = iface->description( key );
#endif //TQT_NO_COMPONENT
return result;
}
#endif // TQT_NO_IM

@ -0,0 +1,59 @@
/****************************************************************************
** $Id: qinputcontextfactory.h,v 1.1.1.1 2004/05/11 11:16:49 daisuke Exp $
**
** Definition of TQInputContextFactory class
**
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQINPUTCONTEXTFACTORY_H
#define TQINPUTCONTEXTFACTORY_H
#ifndef TQT_H
#include "tqstringlist.h"
#endif // TQT_H
#ifndef TQT_NO_IM
class TQInputContext;
class TQWidget;
class TQ_EXPORT TQInputContextFactory
{
public:
static TQStringList keys();
static TQInputContext *create( const TQString &key, TQWidget *widget ); // should be a toplevel widget
static TQStringList languages( const TQString &key );
static TQString displayName( const TQString &key );
static TQString description( const TQString &key );
};
#endif //TQT_NO_IM
#endif //TQINPUTCONTEXTFACTORY_H

@ -0,0 +1,87 @@
/****************************************************************************
** $Id: qinputcontextinterface_p.h,v 1.2 2004/06/20 18:43:11 daisuke Exp $
**
** ...
**
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQINPUTCONTEXTINTERFACE_P_H
#define TQINPUTCONTEXTINTERFACE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the TQt API. This header file may
// change from version to version without notice, or even be
// removed.
//
// We mean it.
//
//
#ifndef TQT_H
#include <private/tqcom_p.h>
#endif // TQT_H
#ifndef TQT_NO_IM
#ifndef TQT_NO_COMPONENT
class TQWidget;
class TQInputContext;
// old version interface in qt-x11-immodule-bc-qt3.3.2-20040623.diff:
// {6C2B9EDE-B63C-14c9-A729-3C7643739C4C}
//
// new version interface:
// {a5f5c63d-e044-11d8-9718-000d6077a78d}
// {b0bf3e59-e526-11d8-80da-000d6077a78d}
// {9ef05c7f-0272-11d9-846c-000d6077a78d}
#ifndef IID_TQInputContextFactory
//#define IID_TQInputContextFactory TQUuid(0x6c2b9ede, 0xb63c, 0x14c9, 0xa7, 0x29, 0x3c, 0x76, 0x43, 0x73, 0x9c, 0x4c)
//#define IID_TQInputContextFactory TQUuid(0xa5f5c63d, 0xe044, 0x11d8, 0x97, 0x18, 0x00, 0x0d, 0x60, 0x77, 0xa7, 0x8d)
//#define IID_TQInputContextFactory TQUuid(0xb0bf3e59, 0xe526, 0x11d8, 0x80, 0xda, 0x00, 0x0d, 0x60, 0x77, 0xa7, 0x8d)
#define IID_TQInputContextFactory TQUuid(0x9ef05c7f, 0x0272, 0x11d9, 0x84, 0x6c, 0x00, 0x0d, 0x60, 0x77, 0xa7, 0x8d)
#endif
struct TQ_EXPORT TQInputContextFactoryInterface : public TQFeatureListInterface
{
virtual TQInputContext *create( const TQString &key ) = 0;
virtual TQStringList languages( const TQString &key ) = 0;
virtual TQString displayName( const TQString &key ) = 0;
virtual TQString description( const TQString &key ) = 0;
};
#endif //TQT_NO_COMPONENT
#endif //TQT_NO_IM
#endif //TQINPUTCONTEXTINTERFACE_P_H

@ -0,0 +1,231 @@
/****************************************************************************
** $Id: qinputcontextplugin.cpp,v 1.2 2004/06/20 18:43:11 daisuke Exp $
**
** Implementation of TQInputContextPlugin class
**
** Created : 010920
**
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tqinputcontextplugin.h"
#ifndef TQT_NO_IM
#ifndef TQT_NO_COMPONENT
#include "tqinputcontextinterface_p.h"
/*!
\class TQInputContextPlugin qinputcontextplugin.h
\brief The TQInputContextPlugin class provides an abstract base for custom TQInputContext plugins.
\reentrant
\ingroup plugins
The input context plugin is a simple plugin interface that makes it
easy to create custom input contexts that can be loaded dynamically
into applications.
Writing a input context plugin is achieved by subclassing this
base class, reimplementing the pure virtual functions keys(),
create(), languages(), displayName() description() and exporting
the class with the \c TQ_EXPORT_PLUGIN macro. See the \link
plugins-howto.html TQt Plugins documentation \endlink for details.
\sa TQInputContext
*/
/*!
\fn TQStringList TQInputContextPlugin::keys() const
Returns the list of TQInputContext keys this plugin provides.
These keys are usually the class names of the custom input context
that are implemented in the plugin.
Return value is the names to identify and specify input methods
for the input method switching mechanism and so on. The names have
to be consistent with TQInputContext::identifierName(). The names
have to consist of ASCII characters only. See also
TQInputContext::identifierName() for further information.
\sa create(), displayName(), TQInputContext::identifierName()
*/
/*!
\fn TQInputContext* TQInputContextPlugin::create( const TQString& key )
Creates and returns a TQInputContext instance for the input context key \a key.
The input context key is usually the class name of the required input method.
\sa keys()
*/
/*!
\fn TQStringList languages( const TQString &key )
Returns what languages are supported by the TQInputContext instance
specified by \a key.
The languages are expressed as language code (e.g. "zh_CN",
"zh_TW", "zh_HK", "ja", "ko", ...). An input context that suports
multiple languages can return all supported languages as
TQStringList. The name has to be consistent with
TQInputContextPlugin::language().
This information may be used to optimize user interface.
\sa TQInputContext::language()
*/
/*!
\fn TQString displayName( const TQString &key )
Returns a user friendly i18n-ized name of the TQInputContext
instance specified by \a key. This string may be appeared in a
menu and so on for users.
There are two different names with different responsibility in the
input method domain. This function returns one of them. Another
name is called 'identifier name' to identify and specify input
methods for the input method switching mechanism and so on.
Although tr( identifierName ) can provide user friendly i18n-ized
name without this function, the message catalog have to be managed
by TQt in the case. However, some sophisticated input method
framework manages their own message catalogs to provide this
i18n-ized name string. So we need this function rather than just
call tr() for identifier name.
\sa keys(), TQInputContext::identifierName()
*/
/*!
\fn TQString description( const TQString &key )
Returns a i18n-ized brief description of the TQInputContext
instance specified by \a key. This string may be appeared in some
user interfaces.
*/
class TQInputContextPluginPrivate : public TQInputContextFactoryInterface
{
public:
TQInputContextPluginPrivate( TQInputContextPlugin *p )
: plugin( p )
{
}
virtual ~TQInputContextPluginPrivate();
TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface );
TQ_REFCOUNT;
TQStringList featureList() const;
TQInputContext *create( const TQString &key );
TQStringList languages( const TQString &key );
TQString displayName( const TQString &key );
TQString description( const TQString &key );
private:
TQInputContextPlugin *plugin;
};
TQRESULT TQInputContextPluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface )
{
*iface = 0;
if ( iid == IID_TQUnknown )
*iface = this;
else if ( iid == IID_TQFeatureList )
*iface = this;
else if ( iid == IID_TQInputContextFactory )
*iface = this;
else
return TQE_NOINTERFACE;
(*iface)->addRef();
return TQS_OK;
}
TQInputContextPluginPrivate::~TQInputContextPluginPrivate()
{
delete plugin;
}
TQStringList TQInputContextPluginPrivate::featureList() const
{
return plugin->keys();
}
TQInputContext *TQInputContextPluginPrivate::create( const TQString &key )
{
return plugin->create( key );
}
TQStringList TQInputContextPluginPrivate::languages( const TQString &key )
{
return plugin->languages( key );
}
TQString TQInputContextPluginPrivate::displayName( const TQString &key )
{
return plugin->displayName( key );
}
TQString TQInputContextPluginPrivate::description( const TQString &key )
{
return plugin->description( key );
}
/*!
Constructs a input context plugin. This is invoked automatically by the
\c TQ_EXPORT_PLUGIN macro.
*/
TQInputContextPlugin::TQInputContextPlugin()
: TQGPlugin( d = new TQInputContextPluginPrivate( this ) )
{
}
/*!
Destroys the input context plugin.
You never have to call this explicitly. TQt destroys a plugin
automatically when it is no longer used.
*/
TQInputContextPlugin::~TQInputContextPlugin()
{
// don't delete d, as this is deleted by d
}
#endif // TQT_NO_COMPONENT
#endif // TQT_NO_IM

@ -0,0 +1,67 @@
/****************************************************************************
** $Id: qinputcontextplugin.h,v 1.2 2004/06/20 18:43:11 daisuke Exp $
**
** Definition of TQInputContextPlugin class
**
** Created : 010920
**
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQINPUTCONTEXTPLUGIN_H
#define TQINPUTCONTEXTPLUGIN_H
#ifndef TQT_H
#include "tqgplugin.h"
#include "tqstringlist.h"
#endif // TQT_H
#ifndef TQT_NO_IM
class TQInputContext;
class TQInputContextPluginPrivate;
class TQ_EXPORT TQInputContextPlugin : public TQGPlugin
{
TQ_OBJECT
public:
TQInputContextPlugin();
~TQInputContextPlugin();
virtual TQStringList keys() const = 0;
virtual TQInputContext *create( const TQString &key ) = 0;
virtual TQStringList languages( const TQString &key ) = 0;
virtual TQString displayName( const TQString &key ) = 0;
virtual TQString description( const TQString &key ) = 0;
private:
TQInputContextPluginPrivate *d;
};
#endif // TQT_NO_IM
#endif // TQINPUTCONTEXTPLUGIN_H

@ -0,0 +1,10 @@
# TQt inputmetod module
inputmethod {
INPUTMETHOD_P = inputmethod
HEADERS +=$$INPUTMETHOD_H/qinputcontextfactory.h \
$$INPUTMETHOD_P/qinputcontextinterface_p.h \
$$INPUTMETHOD_H/qinputcontextplugin.h
SOURCES +=$$INPUTMETHOD_CPP/qinputcontextfactory.cpp \
$$INPUTMETHOD_CPP/qinputcontextplugin.cpp
}

@ -34,7 +34,6 @@ kernel {
$$KERNEL_H/tqimage.h \ $$KERNEL_H/tqimage.h \
$$KERNEL_P/tqimageformatinterface_p.h \ $$KERNEL_P/tqimageformatinterface_p.h \
$$KERNEL_H/tqimageformatplugin.h \ $$KERNEL_H/tqimageformatplugin.h \
$$KERNEL_P/tqinputcontext_p.h \
$$KERNEL_H/tqkeycode.h \ $$KERNEL_H/tqkeycode.h \
$$KERNEL_H/tqkeysequence.h \ $$KERNEL_H/tqkeysequence.h \
$$KERNEL_H/tqlayout.h \ $$KERNEL_H/tqlayout.h \
@ -99,6 +98,12 @@ kernel {
$$KERNEL_CPP/tqfontengine_p.h \ $$KERNEL_CPP/tqfontengine_p.h \
$$KERNEL_CPP/tqtextlayout_p.h $$KERNEL_CPP/tqtextlayout_p.h
unix:x11 {
HEADERS += $$KERNEL_H/tqinputcontext.h
} else {
HEADERS += $$KERNEL_P/tqinputcontext_p.h
}
win32:SOURCES += $$KERNEL_CPP/tqapplication_win.cpp \ win32:SOURCES += $$KERNEL_CPP/tqapplication_win.cpp \
$$KERNEL_CPP/tqclipboard_win.cpp \ $$KERNEL_CPP/tqclipboard_win.cpp \
$$KERNEL_CPP/tqcolor_win.cpp \ $$KERNEL_CPP/tqcolor_win.cpp \
@ -130,6 +135,7 @@ kernel {
$$KERNEL_CPP/tqdesktopwidget_x11.cpp \ $$KERNEL_CPP/tqdesktopwidget_x11.cpp \
$$KERNEL_CPP/tqeventloop_x11.cpp \ $$KERNEL_CPP/tqeventloop_x11.cpp \
$$KERNEL_CPP/tqfont_x11.cpp \ $$KERNEL_CPP/tqfont_x11.cpp \
$$KERNEL_CPP/tqinputcontext.cpp \
$$KERNEL_CPP/tqinputcontext_x11.cpp \ $$KERNEL_CPP/tqinputcontext_x11.cpp \
$$KERNEL_CPP/tqmotifdnd_x11.cpp \ $$KERNEL_CPP/tqmotifdnd_x11.cpp \
$$KERNEL_CPP/tqpixmap_x11.cpp \ $$KERNEL_CPP/tqpixmap_x11.cpp \

@ -4113,6 +4113,35 @@ void TQApplication::postEvent( TQObject *receiver, TQEvent *event )
}; };
} }
#if !defined(TQT_NO_IM)
// if this is one of the compressible IM events, do compression
else if ( event->type() == TQEvent::IMCompose ) {
l->last();
TQPostEvent * cur = 0;
for ( ;; ) {
while ( (cur=l->current()) != 0 &&
( cur->receiver != receiver ||
cur->event == 0 ||
cur->event->type() != event->type() ||
cur->event->type() != TQEvent::IMStart ) )
l->prev();
if ( l->current() != 0 ) {
// IMCompose must not be compressed with another one
// beyond its IMStart boundary
if ( cur->event->type() == TQEvent::IMStart ) {
break;
} else if ( cur->event->type() == TQEvent::IMCompose ) {
TQIMComposeEvent * e = (TQIMComposeEvent *)(cur->event);
*e = *(TQIMComposeEvent *)event;
delete event;
return;
}
}
break;
};
}
#endif
// if no compression could be done, just append something // if no compression could be done, just append something
event->posted = TRUE; event->posted = TRUE;
TQPostEvent * pe = new TQPostEvent( receiver, event ); TQPostEvent * pe = new TQPostEvent( receiver, event );
@ -4258,6 +4287,23 @@ void TQApplication::sendPostedEvents( TQObject *receiver, int event_type )
*/ */
void TQApplication::removePostedEvents( TQObject *receiver ) void TQApplication::removePostedEvents( TQObject *receiver )
{
removePostedEvents( receiver, 0 );
}
/*!
Removes all events that have the event type \a event_type posted
using postEvent() for \a receiver.
The events are \e not dispatched, instead they are removed from the
queue.
If \a event_type is 0, all the events are removed from the queue.
\threadsafe
*/
void TQApplication::removePostedEvents( TQObject *receiver, int event_type )
{ {
if ( !receiver ) if ( !receiver )
return; return;
@ -4277,18 +4323,24 @@ void TQApplication::removePostedEvents( TQObject *receiver )
// leave the TQPostEvent objects; they'll be deleted by // leave the TQPostEvent objects; they'll be deleted by
// sendPostedEvents(). // sendPostedEvents().
TQPostEventList * l = receiver->postedEvents; TQPostEventList * l = receiver->postedEvents;
receiver->postedEvents = 0;
l->first(); l->first();
TQPostEvent * pe; TQPostEvent * pe;
while( (pe=l->current()) != 0 ) { while( (pe=l->current()) != 0 ) {
if ( pe->event ) { if ( !event_type || pe->event->type() == event_type ) {
pe->event->posted = FALSE; if ( pe->event ) {
delete pe->event; pe->event->posted = FALSE;
pe->event = 0; delete pe->event;
pe->event = 0;
}
l->remove();
} else {
l->next();
} }
l->remove();
} }
delete l; if ( !event_type || !l->count() ) {
receiver->postedEvents = 0;
delete l;
}
} }
@ -4473,6 +4525,8 @@ void TQApplication::setActiveWindow( TQWidget* act )
focus_widget = 0; focus_widget = 0;
#ifdef TQ_WS_WIN #ifdef TQ_WS_WIN
TQInputContext::accept( tmp ); TQInputContext::accept( tmp );
#elif defined(TQ_WS_X11)
tmp->unfocusInputContext();
#endif #endif
TQApplication::sendSpontaneousEvent( tmp, &out ); TQApplication::sendSpontaneousEvent( tmp, &out );
} else if ( active_window ) { } else if ( active_window ) {

@ -67,6 +67,9 @@ class TQSessionManager;
class TQStyle; class TQStyle;
class TQTranslator; class TQTranslator;
class TQEventLoop; class TQEventLoop;
#if defined(TQ_WS_X11)
class TQIMEvent;
#endif
#if defined(TQ_WS_TQWS) #if defined(TQ_WS_TQWS)
class TQWSDecoration; class TQWSDecoration;
#endif #endif
@ -467,8 +470,19 @@ public:
virtual void saveState( TQSessionManager& sm ); virtual void saveState( TQSessionManager& sm );
#endif #endif
#if defined(TQ_WS_X11) #if defined(TQ_WS_X11)
#if !defined(TQT_NO_IM_EXTENSIONS)
virtual TQWidget *locateICHolderWidget( TQWidget *w );
virtual TQWidgetList *icHolderWidgets();
static void create_im();
static void close_im();
#else
TQWidget *locateICHolderWidget( TQWidget *w );
TQWidgetList *icHolderWidgets();
static void create_xim(); static void create_xim();
static void close_xim(); static void close_xim();
#endif
static TQString defaultInputMethod();
void changeAllInputContext( const TQString & );
static bool x11_apply_settings(); static bool x11_apply_settings();
#endif #endif
void wakeUpGuiThread(); void wakeUpGuiThread();
@ -523,6 +537,12 @@ private:
friend void qt_init(int *, char **, TQApplication::Type); friend void qt_init(int *, char **, TQApplication::Type);
#endif #endif
#if defined(TQ_WS_X11)
private slots:
void postIMEvent( TQObject *receiver, TQIMEvent *event );
#endif
private:
#ifdef TQT_THREAD_SUPPORT #ifdef TQT_THREAD_SUPPORT
static TQMutex *qt_mutex; static TQMutex *qt_mutex;
#endif // TQT_THREAD_SUPPORT #endif // TQT_THREAD_SUPPORT
@ -572,9 +592,12 @@ private:
static TQString* session_key; static TQString* session_key;
bool is_session_restored; bool is_session_restored;
#endif #endif
#if defined(TQ_WS_X11) && !defined (TQT_NO_STYLE ) #if defined(TQ_WS_X11)
#if !defined (TQT_NO_STYLE)
static void x11_initialize_style(); static void x11_initialize_style();
#endif #endif
static TQString defaultIM; // default input method's name in this application.
#endif
static TQSize app_strut; static TQSize app_strut;
#ifndef TQT_NO_COMPONENT #ifndef TQT_NO_COMPONENT
@ -591,6 +614,7 @@ private:
static bool sendSpontaneousEvent( TQObject *receiver, TQEvent *event ); static bool sendSpontaneousEvent( TQObject *receiver, TQEvent *event );
static void removePostedEvent( TQEvent * ); static void removePostedEvent( TQEvent * );
static void removePostedEvents( TQObject *receiver, int event_type );
friend class TQWidget; friend class TQWidget;
friend class TQETWidget; friend class TQETWidget;

File diff suppressed because it is too large Load Diff

@ -111,6 +111,7 @@ static int pending_timer_id = 0;
static bool pending_clipboard_changed = FALSE; static bool pending_clipboard_changed = FALSE;
static bool pending_selection_changed = FALSE; static bool pending_selection_changed = FALSE;
TQ_EXPORT bool qt_qclipboard_bailout_hack = false;
// event capture mechanism for qt_xclb_wait_for_event // event capture mechanism for qt_xclb_wait_for_event
static bool waiting_for_data = FALSE; static bool waiting_for_data = FALSE;
@ -142,6 +143,15 @@ static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer)
|| e->xselectionclear.selection == qt_xa_clipboard))); || e->xselectionclear.selection == qt_xa_clipboard)));
} }
static bool selection_request_pending = false;
static Bool check_selection_request_pending( Display*, XEvent* e, XPointer )
{
if( e->type == SelectionRequest && e->xselectionrequest.owner == owner->winId())
selection_request_pending = true;
return False;
}
bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event, bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
int timeout ) int timeout )
{ {
@ -193,6 +203,14 @@ bool qt_xclb_wait_for_event( Display *dpy, Window win, int type, XEvent *event,
do { do {
if ( XCheckTypedWindowEvent(dpy,win,type,event) ) if ( XCheckTypedWindowEvent(dpy,win,type,event) )
return TRUE; return TRUE;
if( qt_qclipboard_bailout_hack ) {
XEvent dummy;
selection_request_pending = false;
if ( owner != NULL )
XCheckIfEvent(dpy,&dummy,check_selection_request_pending,NULL);
if( selection_request_pending )
return TRUE;
}
// process other clipboard events, since someone is probably requesting data from us // process other clipboard events, since someone is probably requesting data from us
XEvent e; XEvent e;

@ -111,7 +111,7 @@ TQDesktopWidgetPrivate::~TQDesktopWidgetPrivate()
screens[i] = 0; screens[i] = 0;
} }
delete [] screens; free(screens);
} }
if ( rects ) delete [] rects; if ( rects ) delete [] rects;
@ -121,6 +121,8 @@ TQDesktopWidgetPrivate::~TQDesktopWidgetPrivate()
void TQDesktopWidgetPrivate::init() void TQDesktopWidgetPrivate::init()
{ {
// get the screen count // get the screen count
int newScreenCount;
#ifndef TQT_NO_XINERAMA #ifndef TQT_NO_XINERAMA
XineramaScreenInfo *xinerama_screeninfo = 0; XineramaScreenInfo *xinerama_screeninfo = 0;
int unused; int unused;
@ -130,23 +132,26 @@ void TQDesktopWidgetPrivate::init()
if (use_xinerama) { if (use_xinerama) {
xinerama_screeninfo = xinerama_screeninfo =
XineramaQueryScreens(TQPaintDevice::x11AppDisplay(), &screenCount); XineramaQueryScreens(TQPaintDevice::x11AppDisplay(), &newScreenCount);
if (xinerama_screeninfo)
defaultScreen = 0; defaultScreen = 0;
} else } else
#endif // TQT_NO_XINERAMA #endif // TQT_NO_XINERAMA
{ {
defaultScreen = DefaultScreen(TQPaintDevice::x11AppDisplay()); defaultScreen = DefaultScreen(TQPaintDevice::x11AppDisplay());
screenCount = ScreenCount(TQPaintDevice::x11AppDisplay()); newScreenCount = ScreenCount(TQPaintDevice::x11AppDisplay());
use_xinerama = false;
} }
delete [] rects; delete [] rects;
rects = new TQRect[ screenCount ]; rects = new TQRect[ newScreenCount ];
delete [] workareas; delete [] workareas;
workareas = new TQRect[ screenCount ]; workareas = new TQRect[ newScreenCount ];
// get the tqgeometry of each screen // get the tqgeometry of each screen
int i, x, y, w, h; int i, j, x, y, w, h;
for ( i = 0; i < screenCount; i++ ) { for ( i = 0, j = 0; i < newScreenCount; i++ ) {
#ifndef TQT_NO_XINERAMA #ifndef TQT_NO_XINERAMA
if (use_xinerama) { if (use_xinerama) {
@ -163,11 +168,33 @@ void TQDesktopWidgetPrivate::init()
h = HeightOfScreen(ScreenOfDisplay(TQPaintDevice::x11AppDisplay(), i)); h = HeightOfScreen(ScreenOfDisplay(TQPaintDevice::x11AppDisplay(), i));
} }
rects[i].setRect(x, y, w, h);
workareas[i] = TQRect(); workareas[i] = TQRect();
rects[j].setRect(x, y, w, h);
// overlapping?
if (j > 0 && rects[j-1].intersects(rects[j])) {
// pick the bigger one, ignore the other
if ((rects[j].width()*rects[j].height()) >
(rects[j-1].width()*rects[j-1].height()))
rects[j-1] = rects[j];
}
else
j++;
} }
if (screens) {
// leaks TQWidget* pointers on purpose, can't delete them as pointer escapes
screens = (TQWidget**) realloc(screens, j * sizeof(TQWidget*));
if (j > screenCount)
memset(&screens[screenCount], 0, (j-screenCount) * sizeof(TQWidget*));
}
screenCount = j;
#ifndef TQT_NO_XINERAMA #ifndef TQT_NO_XINERAMA
if (use_xinerama && screenCount == 1)
use_xinerama = false;
if (xinerama_screeninfo) if (xinerama_screeninfo)
XFree(xinerama_screeninfo); XFree(xinerama_screeninfo);
#endif // TQT_NO_XINERAMA #endif // TQT_NO_XINERAMA
@ -220,8 +247,7 @@ TQWidget *TQDesktopWidget::screen( int screen )
screen = d->defaultScreen; screen = d->defaultScreen;
if ( ! d->screens ) { if ( ! d->screens ) {
d->screens = new TQWidget*[ d->screenCount ]; d->screens = (TQWidget**) calloc( d->screenCount, sizeof(TQWidget*));
memset( d->screens, 0, d->screenCount * sizeof( TQWidget * ) );
d->screens[ d->defaultScreen ] = this; d->screens[ d->defaultScreen ] = this;
} }

@ -52,13 +52,15 @@
#include "tqdragobject.h" #include "tqdragobject.h"
#include "tqobjectlist.h" #include "tqobjectlist.h"
#include "tqcursor.h" #include "tqcursor.h"
#include "tqbitmap.h"
#include "tqpainter.h"
#include "tqt_x11_p.h" #include "tqt_x11_p.h"
// conflict resolution // conflict resolution
// unused, may be used again later: const int XKeyPress = KeyPress; const int XKeyPress = KeyPress;
// unused, may be used again later: const int XKeyRelease = KeyRelease; const int XKeyRelease = KeyRelease;
#undef KeyPress #undef KeyPress
#undef KeyRelease #undef KeyRelease
@ -114,6 +116,8 @@ Atom qt_xdnd_finished;
Atom qt_xdnd_type_list; Atom qt_xdnd_type_list;
const int qt_xdnd_version = 4; const int qt_xdnd_version = 4;
extern int qt_x11_translateButtonState( int s );
// Actions // Actions
// //
// The Xdnd spec allows for user-defined actions. This could be implemented // The Xdnd spec allows for user-defined actions. This could be implemented
@ -199,6 +203,8 @@ static Time qt_xdnd_target_current_time;
static int qt_xdnd_current_screen = -1; static int qt_xdnd_current_screen = -1;
// state of dragging... true if dragging, false if not // state of dragging... true if dragging, false if not
bool qt_xdnd_dragging = FALSE; bool qt_xdnd_dragging = FALSE;
// need to check state of keyboard modifiers
static bool need_modifiers_check = FALSE;
// dict of payload data, sorted by type atom // dict of payload data, sorted by type atom
static TQIntDict<TQByteArray> * qt_xdnd_target_data = 0; static TQIntDict<TQByteArray> * qt_xdnd_target_data = 0;
@ -257,21 +263,49 @@ class TQShapedPixmapWidget : public TQWidget {
public: public:
TQShapedPixmapWidget(int screen = -1) : TQShapedPixmapWidget(int screen = -1) :
TQWidget(TQApplication::desktop()->screen( screen ), TQWidget(TQApplication::desktop()->screen( screen ),
0, (Qt::WindowType)(WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM) ) 0, (Qt::WindowType)(WStyle_Customize | WStyle_Tool | WStyle_NoBorder | WX11BypassWM) ), oldpmser( 0 ), oldbmser( 0 )
{ {
x11SetWindowType( X11WindowTypeDND );
} }
void setPixmap(TQPixmap pm) void setPixmap(TQPixmap pm, TQPoint hot)
{ {
const TQBitmap* mask = pm.tqmask(); int bmser = pm.tqmask() ? pm.tqmask()->serialNumber() : 0;
if ( mask ) { if( oldpmser == pm.serialNumber() && oldbmser == bmser
&& oldhot == hot )
return;
oldpmser = pm.serialNumber();
oldbmser = bmser;
oldhot = hot;
bool hotspot_in = !(hot.x() < 0 || hot.y() < 0 || hot.x() >= pm.width() || hot.y() >= pm.height());
// if the pixmap has hotspot in its area, make a "hole" in it at that position
// this will allow XTranslateCoordinates() to find directly the window below the cursor instead
// of finding this pixmap, and therefore there won't be needed any (slow) search for the window
// using findRealWindow()
if( hotspot_in ) {
TQBitmap tqmask = pm.tqmask() ? *pm.tqmask() : TQBitmap( pm.width(), pm.height());
if( !pm.tqmask())
tqmask.fill( TQt::color1 );
TQPainter p( &tqmask );
p.setPen( TQt::color0 );
p.drawPoint( hot.x(), hot.y());
p.end();
pm.setMask( tqmask );
setMask( tqmask );
} else if ( pm.tqmask() ) {
setMask( *mask ); setMask( *mask );
} else { } else {
clearMask(); clearMask();
} }
resize(pm.width(),pm.height()); resize(pm.width(),pm.height());
setErasePixmap(pm); setErasePixmap(pm);
erase();
} }
private:
int oldpmser;
int oldbmser;
TQPoint oldhot;
}; };
static TQShapedPixmapWidget * qt_xdnd_deco = 0; static TQShapedPixmapWidget * qt_xdnd_deco = 0;
@ -875,8 +909,59 @@ void qt_handle_xdnd_finished( TQWidget *, const XEvent * xe, bool passive )
void TQDragManager::timerEvent( TQTimerEvent* e ) void TQDragManager::timerEvent( TQTimerEvent* e )
{ {
if ( e->timerId() == heartbeat && qt_xdnd_source_sameanswer.isNull() ) if ( e->timerId() == heartbeat ) {
move( TQCursor::pos() ); if( need_modifiers_check ) {
Window root, child;
int root_x, root_y, win_x, win_y;
unsigned int tqmask;
XQueryPointer( qt_xdisplay(), qt_xrootwin( qt_xdnd_current_screen ),
&root, &child, &root_x, &root_y, &win_x, &win_y, &tqmask );
if( updateMode( (ButtonState)qt_x11_translateButtonState( tqmask )))
qt_xdnd_source_sameanswer = TQRect(); // force move
}
need_modifiers_check = TRUE;
if( qt_xdnd_source_sameanswer.isNull() )
move( TQCursor::pos() );
}
}
static bool qt_xdnd_was_move = false;
static bool qt_xdnd_found = false;
// check whole incoming X queue for move events
// checking whole queue is done by always returning False in the predicate
// if there's another move event in the queue, and there's not a mouse button
// or keyboard or ClientMessage event before it, the current move event
// may be safely discarded
// this helps avoiding being overloaded by being flooded from many events
// from the XServer
static
Bool qt_xdnd_predicate( Display*, XEvent* ev, XPointer )
{
if( qt_xdnd_found )
return False;
if( ev->type == MotionNotify )
{
qt_xdnd_was_move = true;
qt_xdnd_found = true;
}
if( ev->type == ButtonPress || ev->type == ButtonRelease
|| ev->type == XKeyPress || ev->type == XKeyRelease
|| ev->type == ClientMessage )
{
qt_xdnd_was_move = false;
qt_xdnd_found = true;
}
return False;
}
static
bool qt_xdnd_another_movement()
{
qt_xdnd_was_move = false;
qt_xdnd_found = false;
XEvent dummy;
XCheckIfEvent( qt_xdisplay(), &dummy, qt_xdnd_predicate, NULL );
return qt_xdnd_was_move;
} }
bool TQDragManager::eventFilter( TQObject * o, TQEvent * e) bool TQDragManager::eventFilter( TQObject * o, TQEvent * e)
@ -901,8 +986,11 @@ bool TQDragManager::eventFilter( TQObject * o, TQEvent * e)
if ( e->type() == TQEvent::MouseMove ) { if ( e->type() == TQEvent::MouseMove ) {
TQMouseEvent* me = (TQMouseEvent *)e; TQMouseEvent* me = (TQMouseEvent *)e;
updateMode(me->stateAfter()); if( !qt_xdnd_another_movement()) {
move( me->globalPos() ); updateMode(me->stateAfter());
move( me->globalPos() );
}
need_modifiers_check = FALSE;
return TRUE; return TRUE;
} else if ( e->type() == TQEvent::MouseButtonRelease ) { } else if ( e->type() == TQEvent::MouseButtonRelease ) {
tqApp->removeEventFilter( this ); tqApp->removeEventFilter( this );
@ -941,9 +1029,11 @@ bool TQDragManager::eventFilter( TQObject * o, TQEvent * e)
beingCancelled = FALSE; beingCancelled = FALSE;
tqApp->exit_loop(); tqApp->exit_loop();
} else { } else {
updateMode(ke->stateAfter()); if( updateMode(ke->stateAfter())) {
qt_xdnd_source_sameanswer = TQRect(); // force move qt_xdnd_source_sameanswer = TQRect(); // force move
move( TQCursor::pos() ); move( TQCursor::pos() );
}
need_modifiers_check = FALSE;
} }
return TRUE; // Eat all key events return TRUE; // Eat all key events
} }
@ -970,10 +1060,10 @@ bool TQDragManager::eventFilter( TQObject * o, TQEvent * e)
static TQt::ButtonState oldstate; static TQt::ButtonState oldstate;
void TQDragManager::updateMode( TQt::ButtonState newstate ) bool TQDragManager::updateMode( TQt::ButtonState newstate )
{ {
if ( newstate == oldstate ) if ( newstate == oldstate )
return; return false;
const int both = ShiftButton|ControlButton; const int both = ShiftButton|ControlButton;
if ( (newstate & both) == both ) { if ( (newstate & both) == both ) {
global_requested_action = TQDropEvent::Link; global_requested_action = TQDropEvent::Link;
@ -997,6 +1087,7 @@ void TQDragManager::updateMode( TQt::ButtonState newstate )
} }
} }
oldstate = newstate; oldstate = newstate;
return true;
} }
@ -1138,12 +1229,13 @@ void TQDragManager::move( const TQPoint & globalPos )
// recreate the pixmap on the new screen... // recreate the pixmap on the new screen...
delete qt_xdnd_deco; delete qt_xdnd_deco;
qt_xdnd_deco = new TQShapedPixmapWidget( screen ); qt_xdnd_deco = new TQShapedPixmapWidget( screen );
qt_xdnd_deco->x11SetWindowTransient( dragSource->tqtopLevelWidget());
if (!TQWidget::mouseGrabber()) { if (!TQWidget::mouseGrabber()) {
updatePixmap(); updatePixmap();
qt_xdnd_deco->grabMouse(); qt_xdnd_deco->grabMouse();
} }
} }
updatePixmap(); updatePixmap( globalPos );
if ( qt_xdnd_source_sameanswer.contains( globalPos ) && if ( qt_xdnd_source_sameanswer.contains( globalPos ) &&
qt_xdnd_source_sameanswer.isValid() ) { qt_xdnd_source_sameanswer.isValid() ) {
@ -1691,6 +1783,7 @@ bool TQDragManager::drag( TQDragObject * o, TQDragObject::DragMode mode )
dragSource = (TQWidget *)(object->tqparent()); dragSource = (TQWidget *)(object->tqparent());
qt_xdnd_deco->x11SetWindowTransient( dragSource->tqtopLevelWidget());
tqApp->installEventFilter( this ); tqApp->installEventFilter( this );
qt_xdnd_source_current_time = GET_QT_X_TIME(); qt_xdnd_source_current_time = GET_QT_X_TIME();
XSetSelectionOwner( TQPaintDevice::x11AppDisplay(), qt_xdnd_selection, XSetSelectionOwner( TQPaintDevice::x11AppDisplay(), qt_xdnd_selection,
@ -1703,6 +1796,7 @@ bool TQDragManager::drag( TQDragObject * o, TQDragObject::DragMode mode )
qt_xdnd_source_sameanswer = TQRect(); qt_xdnd_source_sameanswer = TQRect();
move(TQCursor::pos()); move(TQCursor::pos());
heartbeat = startTimer(200); heartbeat = startTimer(200);
need_modifiers_check = FALSE;
#ifndef TQT_NO_CURSOR #ifndef TQT_NO_CURSOR
tqApp->setOverrideCursor( Qt::ArrowCursor ); tqApp->setOverrideCursor( Qt::ArrowCursor );
@ -1736,7 +1830,7 @@ bool TQDragManager::drag( TQDragObject * o, TQDragObject::DragMode mode )
// qt_xdnd_source_object persists until we get an xdnd_finish message // qt_xdnd_source_object persists until we get an xdnd_finish message
} }
void TQDragManager::updatePixmap() void TQDragManager::updatePixmap( const TQPoint& cursorPos )
{ {
if ( qt_xdnd_deco ) { if ( qt_xdnd_deco ) {
TQPixmap pm; TQPixmap pm;
@ -1751,9 +1845,8 @@ void TQDragManager::updatePixmap()
defaultPm = new TQPixmap(default_pm); defaultPm = new TQPixmap(default_pm);
pm = *defaultPm; pm = *defaultPm;
} }
qt_xdnd_deco->setPixmap(pm); qt_xdnd_deco->setPixmap(pm, pm_hot);
qt_xdnd_deco->move(TQCursor::pos()-pm_hot); qt_xdnd_deco->move(cursorPos-pm_hot);
qt_xdnd_deco->tqrepaint(FALSE);
//if ( willDrop ) { //if ( willDrop ) {
qt_xdnd_deco->show(); qt_xdnd_deco->show();
//} else { //} else {
@ -1762,4 +1855,9 @@ void TQDragManager::updatePixmap()
} }
} }
void TQDragManager::updatePixmap()
{
updatePixmap( TQCursor::pos());
}
#endif // TQT_NO_DRAGANDDROP #endif // TQT_NO_DRAGANDDROP

@ -2469,6 +2469,16 @@ bool TQTextDrag::decode( const TQMimeSource* e, TQString& str, TQCString& subtyp
if(!e) if(!e)
return FALSE; return FALSE;
// when subtype is not specified, try text/plain first, otherwise this may read
// things like text/x-moz-url even though better targets are available
if( subtype.isNull()) {
TQCString subtmp = "plain";
if( decode( e, str, subtmp )) {
subtype = subtmp;
return true;
}
}
if ( e->cacheType == TQMimeSource::Text ) { if ( e->cacheType == TQMimeSource::Text ) {
str = *e->cache.txt.str; str = *e->cache.txt.str;
subtype = *e->cache.txt.subtype; subtype = *e->cache.txt.subtype;

@ -476,10 +476,11 @@ private:
void move( const TQPoint & ); void move( const TQPoint & );
void drop(); void drop();
void updatePixmap(); void updatePixmap();
void updatePixmap( const TQPoint& cursorPos );
private: private:
TQDragObject * object; TQDragObject * object;
void updateMode( TQt::ButtonState newstate ); bool updateMode( TQt::ButtonState newstate );
void updateCursor(); void updateCursor();
#if defined(TQ_WS_X11) #if defined(TQ_WS_X11)
void createCursors(); void createCursors();

@ -874,6 +874,10 @@ TQWheelEvent::TQWheelEvent( const TQPoint &pos, int delta, int state, Orientatio
the result of a known key (e.g. it may be the result of a compose the result of a known key (e.g. it may be the result of a compose
sequence or a keyboard macro, or due to key event compression). sequence or a keyboard macro, or due to key event compression).
Applications should not use the TQt latin 1 keycodes between 128
and 255, but should rather use the TQKeyEvent::text(). This is
mainly for compatibility.
\sa TQWidget::setKeyCompression() \sa TQWidget::setKeyCompression()
*/ */

@ -707,6 +707,10 @@ static TQtFontStyle *bestStyle(TQtFontFoundry *foundry, const TQtFontStyle::Key
} }
FM_DEBUG( " best style has distance 0x%x", dist ); FM_DEBUG( " best style has distance 0x%x", dist );
if (!foundry->count) {
TQtFontStyle *temp = NULL;
return temp;
}
return foundry->styles[best]; return foundry->styles[best];
} }
@ -980,20 +984,22 @@ TQFontDatabase::tqfindFont( TQFont::Script script, const TQFontPrivate *fp,
#ifdef TQ_WS_X11 #ifdef TQ_WS_X11
if (script == TQFont::Han) { if (script == TQFont::Han) {
// modify script according to locale // modify script according to locale
static TQFont::Script defaultHan = TQFont::UnknownScript; static TQFont::Script defaultHan;
if (defaultHan == TQFont::UnknownScript) { TQCString locale = setlocale(LC_ALL, NULL);
TQCString locale = setlocale(LC_ALL, NULL);
if (locale.tqcontains("ko")) if (locale.tqcontains("ko"))
defaultHan = TQFont::Han_Korean; defaultHan = TQFont::Han_Korean;
else if (locale.tqcontains("zh_TW") || locale.tqcontains("zh_HK")) else if (locale.tqcontains("zh_TW") || locale.tqcontains("zh_HK"))
defaultHan = TQFont::Han_TraditionalChinese; defaultHan = TQFont::Han_TraditionalChinese;
else if (locale.tqcontains("zh")) else if (locale.tqcontains("zh"))
defaultHan = TQFont::Han_SimplifiedChinese; defaultHan = TQFont::Han_SimplifiedChinese;
else else if (locale.tqcontains("ja"))
defaultHan = TQFont::Han_Japanese; defaultHan = TQFont::Han_Japanese;
} else
script = defaultHan; defaultHan = TQFont::Han; // don't change
script = defaultHan;
} }
#endif #endif

@ -721,6 +721,9 @@ static void loadXlfds( const char *reqFamily, int encoding_id )
if ( fontFamily && fontFamily->xlfdLoaded ) if ( fontFamily && fontFamily->xlfdLoaded )
return; return;
#ifdef TQT_XFT2
if ( !qt_has_xft ) {
#endif // TQT_XFT2
int fontCount; int fontCount;
// force the X server to give us XLFDs // force the X server to give us XLFDs
TQCString xlfd_pattern = "-*-"; TQCString xlfd_pattern = "-*-";
@ -822,8 +825,11 @@ static void loadXlfds( const char *reqFamily, int encoding_id )
} }
XFreeFontNames( fontList ); XFreeFontNames( fontList );
}
#ifdef TQT_XFT2
}
#endif // TQT_XFT2
}
#ifndef TQT_NO_XFTFREETYPE #ifndef TQT_NO_XFTFREETYPE
static int getXftWeight(int xftweight) static int getXftWeight(int xftweight)

@ -2701,16 +2701,9 @@ bool TQOpenType::positionAndAdd(TQShaperItem *item, bool doLogClusters)
? -tqRound((positions[i].x_advance >> 6)*scale) ? -tqRound((positions[i].x_advance >> 6)*scale)
: tqRound((positions[i].x_advance >> 6)*scale); : tqRound((positions[i].x_advance >> 6)*scale);
} }
int back = 0; item->offsets[i].x = tqRound((positions[i].x_pos >> 6)*scale);
item->offsets[i].x = tqRound((positions[i].x_pos >> 6)*scale); item->offsets[i].y = -tqRound((positions[i].y_pos >> 6)*scale);
item->offsets[i].y = tqRound((positions[i].y_pos >> 6)*scale); int back = positions[i].back;
while (positions[i-back].back) {
back += positions[i - back].back;
item->offsets[i].x += tqRound((positions[i - back].x_pos >> 6)*scale);
item->offsets[i].y += tqRound((positions[i - back].y_pos >> 6)*scale);
}
item->offsets[i].y = -item->offsets[i].y;
back = positions[i].back;
if (item->flags & TQTextEngine::RightToLeft) { if (item->flags & TQTextEngine::RightToLeft) {
while (back--) { while (back--) {
item->offsets[i].x -= item->advances[i-back]; item->offsets[i].x -= item->advances[i-back];

@ -0,0 +1,856 @@
/****************************************************************************
** $Id: qinputcontext.cpp,v 1.6 2004/06/22 06:47:30 daisuke Exp $
**
** Implementation of TQInputContext class
**
** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses for Unix/X11 may use this file in accordance with the TQt Commercial
** License Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
//#define TQT_NO_IM_PREEDIT_RELOCATION
#include "tqinputcontext.h"
#ifndef TQT_NO_IM
#include "tqplatformdefs.h"
#include "tqapplication.h"
#include "tqwidget.h"
#include "tqpopupmenu.h"
#include <stdlib.h>
#include <limits.h>
class TQInputContextPrivate
{
public:
TQInputContextPrivate()
: holderWidget( 0 ), composingWidget( 0 ), hasFocus( FALSE ),
isComposing( FALSE )
#if !defined(TQT_NO_IM_PREEDIT_RELOCATION)
, preeditString( TQString() ),
cursorPosition( -1 ), selLength ( 0 )
#endif
{}
TQWidget *holderWidget; // widget to which TQInputContext instance belongs.
TQWidget *composingWidget;
bool hasFocus;
bool isComposing;
void updateComposingState( const TQString &text,
int newCursorPosition, int newSelLength ) {
#if !defined(TQT_NO_IM_PREEDIT_RELOCATION)
preeditString = text;
cursorPosition = newCursorPosition;
selLength = newSelLength;
#endif
}
void resetComposingState() {
isComposing = FALSE;
#if !defined(TQT_NO_IM_PREEDIT_RELOCATION)
preeditString = TQString();
cursorPosition = -1;
selLength = 0;
#endif
}
#if !defined(TQT_NO_IM_PREEDIT_RELOCATION)
TQString preeditString;
int cursorPosition;
int selLength;
#endif
};
// UPDATED COMMENT RETQUIRED -- 2004-07-08 YamaKen
/*!
\class TQInputContext qinputcontext.h
\brief The TQInputContext class abstracts the input method dependent data and composing state.
\ingroup i18n
An input method is responsible to input complex text that cannot
be inputted via simple keymap. It converts a sequence of input
events (typically key events) into a text string through the input
method specific converting process. The class of the processes are
widely ranging from simple finite state machine to complex text
translator that pools a whole paragraph of a text with text
editing capability to perform grammar and semantic analysis.
To abstract such different input method specific intermediate
information, TQt offers the TQInputContext as base class. The
concept is well known as 'input context' in the input method
domain. an input context is created for a text widget in response
to a demand. It is ensured that an input context is prepared for
an input method before input to a text widget.
Multiple input contexts that is belonging to a single input method
may concurrently coexist. Suppose multi-window text editor. Each
text widget of window A and B holds different TQInputContext
instance which contains different state information such as
partially composed text.
\section1 Groups of functions:
\table
\header \i Context \i Functions
\row \i Receiving information \i
x11FilterEvent(),
filterEvent(),
setMicroFocus(),
mouseHandler()
\row \i Sending back composed text \i
sendIMEvent(),
\row \i State change notification \i
setFocus(),
unsetFocus(),
reset()
\row \i Context information \i
identifierName(),
language(),
font(),
isComposing(),
\endtable
\section1 Sharing input context between text widgets
Any input context can be shared between several text widgets to
reduce resource consumption. In ideal case, each text widgets
should be allocated dedicated input context. But some complex
input contexts require slightly heavy resource such as 100
kilobytes of memory. It prevents quite many text widgets from
being used concurrently.
To resolve such problem, we can share an input context. There is
one 'input context holder widget' per text widgets that shares
identical input context. In this model, the holder widget owns the
shared input context. Other text widgets access the input context
via TQApplication::locateICHolderWidget(). But the access
convention is transparently hidden into TQWidget, so developers are
not required to aware of it.
What developer should know is only the mapping function
TQApplication::locateICHolderWidget(). It accepts a widget as
argument and returns its holder widget. Default implementation
returns the top-level widget of the widget as reasonable
assumption. But some applications should reimplement the function
to fit application specific usability. See
TQApplication::locateICHolderWidget() for further information.
\section1 Preedit preservation
As described above, input contexts have wide variety of amount of
the state information in accordance with belonging input
method. It is ranging from 2-3 keystrokes of sequence in
deterministic input methods to hundreds of keystrokes with
semantic text refinement in complex input methods such as ordinary
Japanese input method. The difference requires the different reset
policies in losing input focus.
The former simple input method case, users will prefer resetting
the context to back to the neutral state when something
happened. Suppose a web browsing. The user scroll the page by
scrollbar after he or she has typed a half of the valid key
sequence into a text widget. In the case, the input context should
be reset in losing focus when he or she has dragged the
scrollbar. He or she will be confused if the input context is
still preserved until focused back to the text widget because he
or she will restart typing with first key of the sequence as a
habitual operation.
On the other hand, we should choose completely different policy
for the latter complex input method case. Suppose same situation
as above but he or she is using a complex input method. In the
case, he or she will be angry if the input context has been lost
when he or she has dragged the scrollbar because the input context
contained a valuably composed text made up by considerable input
cost. So we should not reset the input context in the case. And
the input context should be preserved until focused back to the
text widget. This behavior is named as 'preedit preservation'.
The two policies can be switched by calling or not calling reset()
in unsetFocus(). Default implementation of unsetFocus() calls
reset() to fit the simple input methods. The implementation is
expressed as 'preedit preservation is disabled'.
\section1 Preedit relocation
Although the most case of the preedit preservation problem for
complex input methods is resolved as described above, there is a
special case. Suppose the case that matches all of the following
conditions.
\list
\i a input focus has been moved from a text widget to another text
widget directly
\i the input context is shared between the two text widgets
\i preedit preservation is enabled for the input context
\endlist
In the case, there are the following two requirements that
contradicts each other. The input context sharing causes it.
\list
\i the input context has to be reset to prepare to input to the
newly focused text widget
\i the input context has to be preserved until focused back to the
previous text widget
\endlist
A intrinsic feature named 'preedit relocation' is available to
compromise the requirements. If the feature is enabled for the
input context, it is simply moved to the new text widget with the
preedit string. The user continues the input on the new text
widget, or relocate it to another text widget. The preedit of
previous text widget is automatically cleared to back to the
neutral state of the widget.
This strange behavior is just a compromise. As described in
previous section, complex input method user should not be exposed
to the risk losing the input context because it contains valuable
long text made up with considerable input cost. The user will
immediately focus back to the previous text widget to continue the
input in the correct text widget if the preedit relocation
occurred. The feature is mainly existing as safety.
The feature properly works even if the focus is moved as
following. Input method developers are not required to be aware of
the relocation protocol since TQInputContext transparently handles
it.
a text widget -> a non-text widget -> another text widget
To enable the preedit relocation feature, the input context class
have to reimplement isPreeditRelocationEnabled() as returns TRUE.
The implementation requires that the preedit preservation is also
enabled since preedit relocation is a special case of the preedit
preservation. If the preedit relocation is disabled, the input
context is simply reset in the relocation case.
\section1 Input context instanciation
\section1 Input method switching
\section1 Text widget implementor's guide
Add following code fragment into createPopupMenu() to add input
method dependent submenus.
\code
#ifndef TQT_NO_IM
TQInputContext *qic = getInputContext();
if ( qic )
qic->addMenusTo( popup );
#endif
\endcode
\sa TQInputContextPlugin, TQInputContextFactory, TQApplication::locateICHolderWidget(), TQApplication::defaultInputMethod()
*/
/*!
Constructs an input context.
holderWidget is set immediately after this constructor has been
returned on the X11 platform.
*/
TQInputContext::TQInputContext( TQObject *tqparent )
: TQObject( tqparent )
{
d = new TQInputContextPrivate;
}
/*!
Destroys the input context.
*/
TQInputContext::~TQInputContext()
{
delete d;
}
#if defined(TQ_WS_X11)
/*!
\internal
Returns the owner of this input context. Ordinary input methods
should not call this function directly to keep platform
independence and flexible configuration possibility.
The return value may differ from tqfocusWidget() if the input
context is shared between several text widgets.
\sa setHolderWidget(), tqfocusWidget()
*/
TQWidget *TQInputContext::holderWidget() const
{
return d->holderWidget;
}
/*!
\internal
Sets the owner of this input context. Ordinary input methods
must not call this function directly.
\sa holderWidget()
*/
void TQInputContext::setHolderWidget( TQWidget *w )
{
d->holderWidget = w;
}
/*!
\internal
Returns the widget that has an input focus for this input
context. Ordinary input methods should not call this function
directly to keep platform independence and flexible configuration
possibility.
The return value may differ from holderWidget() if the input
context is shared between several text widgets.
\sa setFocusWidget(), holderWidget()
*/
TQWidget *TQInputContext::tqfocusWidget() const
{
return d->hasFocus ? d->composingWidget : 0;
}
/*!
\internal
Sets the widget that has an input focus for this input
context. Ordinary input methods must not call this function
directly.
\sa tqfocusWidget()
*/
void TQInputContext::setFocusWidget( TQWidget *w )
{
if ( w ) {
bool isFocusingBack = ( w == d->composingWidget );
bool isPreeditRelocation = ( ! isFocusingBack && isComposing() &&
d->composingWidget );
// invoke sendIMEventInternal() rather than sendIMEvent() to
// avoid altering the composing state
if ( isPreeditRelocation == TRUE ) {
// clear preedit of previously focused text
// widget. preserved preedit may be exist even if
// isPreeditRelocationEnabled() == FALSE.
sendIMEventInternal( TQEvent::IMEnd );
}
d->composingWidget = w; // changes recipient of TQIMEvent
if ( isPreeditRelocation == TRUE ) {
#if !defined(TQT_NO_IM_PREEDIT_RELOCATION)
if ( isPreeditRelocationEnabled() ) {
// copy preedit state to the widget that gaining focus
sendIMEventInternal( TQEvent::IMStart );
sendIMEventInternal( TQEvent::IMCompose, d->preeditString,
d->cursorPosition, d->selLength );
} else
#endif
{
// reset input context when the shared context has
// focused on another text widget
reset();
}
}
}
d->hasFocus = w ? TRUE : FALSE;
}
/*!
\internal
This function is called from TQWidget to keep input state
consistency. Ordinary input method must not call this function
directly.
*/
void TQInputContext::releaseComposingWidget( TQWidget *w )
{
if ( d->composingWidget == w ) {
d->composingWidget = 0;
d->hasFocus = FALSE;
}
}
#endif // TQ_WS_X11
/*!
\internal
This function can be reimplemented in a subclass as returning TRUE
if you want making your input method enable the preedit
relocation. See the description for preedit relocation of
TQInputContext.
/sa TQInputContext
*/
bool TQInputContext::isPreeditRelocationEnabled()
{
return FALSE;
}
/*!
This function indicates whether IMStart event had been sent to the
text widget. It is ensured that an input context can send IMCompose
or IMEnd event safely if this function returned TRUE.
The state is automatically being tracked through sendIMEvent().
\sa sendIMEvent()
*/
bool TQInputContext::isComposing() const
{
return d->isComposing;
}
/*!
This function can be reimplemented in a subclass to filter input
events.
Return TRUE if the \a event has been consumed. Otherwise, the
unfiltered \a event will be forwarded to widgets as ordinary
way. Although the input events have accept() and ignore()
methods, leave it untouched.
\a event is currently restricted to TQKeyEvent. But some input
method related events such as TQWheelEvent or TQTabletEvent may be
added in future.
The filtering opportunity is always given to the input context as
soon as possible. It has to be taken place before any other key
event consumers such as eventfilters and accelerators because some
input methods require quite various key combination and
sequences. It often conflicts with accelerators and so on, so we
must give the input context the filtering opportunity first to
ensure all input methods work properly regardless of application
design.
Ordinary input methods require discrete key events to work
properly, so TQt's key compression is always disabled for any input
contexts.
\sa TQKeyEvent, x11FilterEvent()
*/
bool TQInputContext::filterEvent( const TQEvent *event )
{
return FALSE;
}
/*!
\fn void TQInputContext::deletionRequested()
Emit this signal when a fatal error has been caused in the input
context. The input context will be deleted by the owner which is
usually the holder widget.
*/
/*!
\fn void TQInputContext::imEventGenerated( TQObject *receiver, TQIMEvent *e )
\internal
This signal is emitted when the user has sent a TQIMEvent through
sendIMEvent(). Ordinary input methods should not emit this signal
directly.
\a receiver is a platform dependent destination of the \a e.
\sa TQIMEvent, sendIMEvent(), sendIMEventInternal(),
*/
/*!
\internal
Sends a TQIMEvent to the client via imEventGenerated()
signal. Ordinary input method should not call this function
directly.
\sa TQIMEvent, TQIMComposeEvent, sendIMEvent(), imEventGenerated()
*/
void TQInputContext::sendIMEventInternal( TQEvent::Type type,
const TQString &text,
int cursorPosition, int selLength )
{
TQObject *receiver = 0;
TQIMEvent *event = 0;
#if defined(TQ_WS_X11)
receiver = d->composingWidget;
#elif defined(TQ_WS_TQWS)
// just a placeholder
#endif
if ( ! receiver )
return;
if ( type == TQEvent::IMStart ) {
qDebug( "sending IMStart with %d chars to %p",
text.length(), receiver );
event = new TQIMEvent( type, text, cursorPosition );
} else if ( type == TQEvent::IMEnd ) {
qDebug( "sending IMEnd with %d chars to %p, text=%s",
text.length(), receiver, (const char*)text.local8Bit() );
event = new TQIMEvent( type, text, cursorPosition );
} else if ( type == TQEvent::IMCompose ) {
qDebug( "sending IMCompose to %p with %d chars, cpos=%d, sellen=%d, text=%s",
receiver, text.length(), cursorPosition, selLength,
(const char*)text.local8Bit() );
event = new TQIMComposeEvent( type, text, cursorPosition, selLength );
}
if ( event )
emit imEventGenerated( receiver, event );
}
/*!
Call this function to send TQIMEvent to the text widget. This
function constructs a TQIMEvent based on the arguments and send it
to the appropriate widget. Ordinary input method should not
reimplement this function.
\a type is either \c TQEvent::IMStart or \c TQEvent::IMCompose or \c
TQEvent::IMEnd. You have to send a \c TQEvent::IMStart to start
composing, then send several \c TQEvent::IMCompose to update the
preedit of the widget, and finalize the composition with sending
\c TQEvent::IMEnd.
\c TQEvent::IMStart should always be sent without arguments as:
\code
sendIMEvent( TQEvent::IMStart )
\endcode
And \c TQEvent::IMCompose can be sent without cursor:
\code
sendIMEvent( TQEvent::IMCompose, TQString( "a text" ) )
\endcode
Or optionally with cursor with \a cursorPosition:
\code
sendIMEvent( TQEvent::IMCompose, TQString( "a text with cursor" ), 12 )
\endcode
Note that \a cursorPosition also specifies microfocus position.
Or optionally with selection text:
\code
sendIMEvent( TQEvent::IMCompose, TQString( "a text with selection" ), 12, 9 )
\endcode
\a cursorPosition and \a selLength must be within the \a text. The
\a cursorPosition also specifies microfocus position in the case:
\c TQEvent::IMEnd can be sent without arguments to terminate the
composition with null string:
\code
sendIMEvent( TQEvent::IMEnd )
\endcode
Or optionally accepts \a text to commit a string:
\code
sendIMEvent( TQEvent::IMEnd, TQString( "a text" ) )
\endcode
\sa TQIMEvent, TQIMComposeEvent, setMicroFocus()
*/
void TQInputContext::sendIMEvent( TQEvent::Type type, const TQString &text,
int cursorPosition, int selLength )
{
#if defined(TQ_WS_X11)
if ( !tqfocusWidget() )
return;
#endif
if ( type == TQEvent::IMStart ) {
sendIMEventInternal( type, text, cursorPosition, selLength );
d->isComposing = TRUE;
} else if ( type == TQEvent::IMEnd ) {
d->resetComposingState();
sendIMEventInternal( type, text, cursorPosition, selLength );
} else if ( type == TQEvent::IMCompose ) {
d->updateComposingState( text, cursorPosition, selLength );
sendIMEventInternal( type, text, cursorPosition, selLength );
}
}
/*!
This function can be reimplemented in a subclass to detect
that the input context has been focused on.
The input context will receive input events through
x11FilterEvent() and filterEvent() after setFocus() until
unsetFocus() has been called.
an input context is ensured that setFocus() is called exactly once
until unsetFocus() has been called even if preedit relocation has
occurred. This means that an input focus will survive between
several widgets that sharing the input context.
On the X11 platform, tqfocusWidget is already set before this
function has been called.
\sa unsetFocus()
*/
void TQInputContext::setFocus()
{
}
/*!
This function can be reimplemented in a subclass to detect
that the input context has lost the focus.
an input context is ensured that unsetFocus() is not called during
preedit relocation. This means that an input focus will survive
between several widgets that sharing the input context.
Default implementation that calls reset() is sufficient for simple
input methods. You can override this function to alter the
behavior. For example, most Japanese input contexts should not be
reset on losing focus. The context sometimes contains a whole
paragraph and has minutes of lifetime different to ephemeral one
in other languages. The piled input context should be survived
until focused again since Japanese user naturally expects so.
On the X11 platform, tqfocusWidget is valid until this function has
been returned.
\sa setFocus()
*/
void TQInputContext::unsetFocus()
{
reset();
}
/*!
This function can be implemented in a subclass to handle
microfocus changes.
'microfocus' stands for the input method focus point in the
preedit (XIM "spot" point) for complex language input handling. It
can be used to place auxiliary GUI widgets such as candidate
selection window.
\a x, \a y, \a w and \a h represents the position and size of the
cursor in the preedit string. \a f is the font on the location of
the cursor.
*/
void TQInputContext::setMicroFocus( int x, int y, int w, int h, TQFont *f )
{
}
/*!
This function can be reimplemented in a subclass to handle mouse
presses/releases/doubleclicks/moves within the preedit text. You
can use the function to implement mouse-oriented user interface
such as text selection or popup menu for candidate selection.
The parameter \a x is the offset within the string that was sent
with the IMCompose event. The alteration boundary of \a x is
ensured as character boundary of preedit string accurately.
\a type is either \c TQEvent::MouseButtonPress or \c
TQEvent::MouseButtonRelease or \c TQEvent::MouseButtonDblClick or \c
TQEvent::MouseButtonMove. Refer \a button and \a state to determine
what operation has performed.
The method interface is imported from
TQWSInputMethod::mouseHandler() of TQt/Embedded 2.3.7 and extended
for desktop system.
*/
void TQInputContext::mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState state )
{
// Default behavior for simple ephemeral input contexts. Some
// complex input contexts should not be reset here.
if ( type == TQEvent::MouseButtonPress ||
type == TQEvent::MouseButtonDblClick )
reset();
}
/*!
Returns the font of the current input widget
*/
TQFont TQInputContext::font() const
{
if ( !tqfocusWidget() )
return TQApplication::font(); //### absolutely last resort
return tqfocusWidget()->font();
}
/*!
This function can be reimplemented in a subclass to reset the
state of the input method.
This function is called by several widgets to reset input
state. For example, a text widget call this function before
inserting a text to make widget ready to accept a text.
Default implementation is sufficient for simple input method. You
can override this function to reset external input method engines
in complex input method. In the case, call TQInputContext::reset()
to ensure proper termination of inputting.
You must not send any TQIMEvent except empty IMEnd event using
TQInputContext::reset() at reimplemented reset(). It will break
input state consistency.
*/
void TQInputContext::reset()
{
if ( isComposing() )
sendIMEvent( TQEvent::IMEnd );
}
/*!
This function must be implemented in any subclasses to return the
identifier name of the input method.
Return value is the name to identify and specify input methods for
the input method switching mechanism and so on. The name has to be
consistent with TQInputContextPlugin::keys(). The name has to
consist of ASCII characters only.
There are two different names with different responsibility in the
input method domain. This function returns one of them. Another
name is called 'display name' that stands for the name for
endusers appeared in a menu and so on.
\sa TQInputContextPlugin::keys(), TQInputContextPlugin::displayName()
*/
TQString TQInputContext::identifierName()
{
return "";
}
/*!
This function must be implemented in any subclasses to return a
language code (e.g. "zh_CN", "zh_TW", "zh_HK", "ja", "ko", ...)
of the input context. If the input context can handle multiple
languages, return the currently used one. The name has to be
consistent with TQInputContextPlugin::language().
This information will be used by language tagging feature in
TQIMEvent. It is required to distinguish unified han characters
correctly. It enables proper font and character code
handling. Suppose CJK-awared multilingual web browser
(that automatically modifies fonts in CJK-mixed text) and XML editor
(that automatically inserts lang attr).
\sa TQInputContextPlugin::language()
*/
TQString TQInputContext::language()
{
return "";
}
#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000)
/*!
This is a preliminary interface for TQt4
*/
TQList<TQAction *> TQInputContext::actions()
{
}
#else
/*!
This function can be reimplemented in a subclass to provide input
method dependent popup menus. Return 0 if the menus are
unnecessary.
Ownership of the object and tqchildren are transferred to the
caller, and the result must not be called
setAutoDelete(). TQInputContextMenu::title is used for label text
of the popup menu as submenu.
\sa addMenusTo()
*/
TQPtrList<TQInputContextMenu> *TQInputContext::menus()
{
return 0;
}
#endif
/*!
Appends input method dependent submenus into \a popup. A separator
is also inserted into \a popup if \a action is InsertSeparator.
This is an utility function only for convenience in limited
situation. This function is used by input context owner such as
text widgets to add the submenus to its own context menu. If you
want to insert the submenus in more flexible way, use
TQInputContext::menus() manually. \a popup is not restricted to
context menu of a text widget. For example, the owner may be a
input method menu of TQtopia taskbar in TQt/Embedded platform.
\sa menus(), TQInputContextMenu::Action
*/
void TQInputContext::addMenusTo( TQPopupMenu *popup, TQInputContextMenu::Action action )
{
if ( ! popup )
return;
TQPtrList<TQInputContextMenu> *imMenus = menus();
if ( imMenus ) {
if ( action == TQInputContextMenu::InsertSeparator )
popup->insertSeparator();
for ( TQPtrList<TQInputContextMenu>::Iterator it = imMenus->begin();
it != imMenus->end();
++it ) {
TQInputContextMenu *imMenu = *it;
popup->insertItem( imMenu->title, imMenu->popup );
}
imMenus->clear();
delete imMenus;
}
}
#endif //TQ_NO_IM

@ -0,0 +1,143 @@
/****************************************************************************
** $Id: qinputcontext.h,v 1.8 2004/06/22 06:47:30 daisuke Exp $
**
** Definition of TQInputContext
**
** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQINPUTCONTEXT_H
#define TQINPUTCONTEXT_H
#ifndef TQT_NO_IM
#ifndef TQT_H
#include "tqobject.h"
#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;
class TQPopupMenu;
class TQInputContextPrivate;
struct TQInputContextMenu {
enum Action {
NoSeparator,
InsertSeparator
};
#if !([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000)
TQString title;
TQPopupMenu *popup;
#endif
};
class TQInputContext : public TQObject
{
TQ_OBJECT
public:
TQInputContext( TQObject *tqparent = 0 );
virtual ~TQInputContext();
virtual TQString identifierName();
virtual TQString language();
#if defined(TQ_WS_X11)
virtual bool x11FilterEvent( TQWidget *keywidget, XEvent *event );
#endif // TQ_WS_X11
virtual bool filterEvent( const TQEvent *event );
virtual void reset();
virtual void setFocus();
virtual void unsetFocus();
virtual void setMicroFocus( int x, int y, int w, int h, TQFont *f = 0 );
virtual void mouseHandler( int x, TQEvent::Type type,
TQt::ButtonState button, TQt::ButtonState state );
virtual TQFont font() const;
virtual bool isComposing() const;
virtual bool isPreeditRelocationEnabled();
#if ([[[TQT_VERSION IS DEPRECATED]]]-0 >= 0x040000)
virtual TQList<TQAction *> actions();
void addActionsTo( TQMenu *menu, TQInputContextMenu::Action action = TQInputContextMenu::InsertSeparator );
#else
virtual TQPtrList<TQInputContextMenu> *menus();
void addMenusTo( TQPopupMenu *popup, TQInputContextMenu::Action action = TQInputContextMenu::InsertSeparator );
#endif
#if defined(TQ_WS_X11)
// these functions are not recommended for ordinary use
virtual TQWidget *tqfocusWidget() const;
virtual TQWidget *holderWidget() const;
// these functions must not be used by ordinary input method
virtual void setFocusWidget( TQWidget *w );
virtual void setHolderWidget( TQWidget *w );
virtual void releaseComposingWidget( TQWidget *w );
#endif
signals:
void deletionRequested();
void imEventGenerated( TQObject *receiver, TQIMEvent *e );
protected:
virtual void sendIMEvent( TQEvent::Type type,
const TQString &text = TQString(),
int cursorPosition = -1, int selLength = 0 );
private:
void sendIMEventInternal( TQEvent::Type type,
const TQString &text = TQString(),
int cursorPosition = -1, int selLength = 0 );
TQInputContextPrivate *d;
friend class TQWidget;
friend class TQInputContextFactory;
private: // Disabled copy constructor and operator=
TQInputContext( const TQInputContext & );
TQInputContext &operator=( const TQInputContext & );
};
#endif //TQ_NO_IM
#endif // TQINPUTCONTEXT_H

@ -36,500 +36,34 @@
** **
**********************************************************************/ **********************************************************************/
#include "tqinputcontext.h"
#ifndef TQT_NO_IM
#include "tqplatformdefs.h" #include "tqplatformdefs.h"
#include "tqapplication.h" #include "tqapplication.h"
#include "tqwidget.h" #include "tqwidget.h"
#include "tqinputcontext_p.h"
#include <stdlib.h>
#include <limits.h>
#include "tqt_x11_p.h"
bool qt_compose_emptied = FALSE; /*!
This function may be overridden only if input method is depending
on X11 and you need raw XEvent. Otherwise, this function must not.
#if !defined(TQT_NO_XIM) This function is designed to filter raw key events for XIM, but
other input methods may use this to implement some special
features such as distinguishing Shift_L and Shift_R.
#define XK_MISCELLANY Return TRUE if the \a event has been consumed. Otherwise, the
#define XK_LATIN1 unfiltered \a event will be translated into TQEvent and forwarded
#include <X11/keysymdef.h> to filterEvent(). Filtering at both x11FilterEvent() and
filterEvent() in single input method is allowed.
// #define TQT_XIM_DEBUG \a keywidget is a client widget into which a text is inputted. \a
event is inputted XEvent.
// from qapplication_x11.cpp \sa filterEvent()
extern XIM qt_xim;
extern XIMStyle qt_xim_style;
/* The cache here is needed, as X11 leaks a few kb for every
XFreeFontSet call, so we avoid creating and deletion of fontsets as
much as possible
*/ */
static XFontSet fontsetCache[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static int fontsetRefCount = 0;
static const char * const fontsetnames[] = {
"-*-fixed-medium-r-*-*-16-*,-*-*-medium-r-*-*-16-*",
"-*-fixed-medium-i-*-*-16-*,-*-*-medium-i-*-*-16-*",
"-*-fixed-bold-r-*-*-16-*,-*-*-bold-r-*-*-16-*",
"-*-fixed-bold-i-*-*-16-*,-*-*-bold-i-*-*-16-*",
"-*-fixed-medium-r-*-*-24-*,-*-*-medium-r-*-*-24-*",
"-*-fixed-medium-i-*-*-24-*,-*-*-medium-i-*-*-24-*",
"-*-fixed-bold-r-*-*-24-*,-*-*-bold-r-*-*-24-*",
"-*-fixed-bold-i-*-*-24-*,-*-*-bold-i-*-*-24-*"
};
static XFontSet getFontSet( const TQFont &f )
{
int i = 0;
if (f.italic())
i |= 1;
if (f.bold())
i |= 2;
if ( f.pointSize() > 20 )
i += 4;
if ( !fontsetCache[i] ) {
Display* dpy = TQPaintDevice::x11AppDisplay();
int missCount;
char** missList;
fontsetCache[i] = XCreateFontSet(dpy, fontsetnames[i], &missList, &missCount, 0);
if(missCount > 0)
XFreeStringList(missList);
if ( !fontsetCache[i] ) {
fontsetCache[i] = XCreateFontSet(dpy, "-*-fixed-*-*-*-*-16-*", &missList, &missCount, 0);
if(missCount > 0)
XFreeStringList(missList);
if ( !fontsetCache[i] )
fontsetCache[i] = (XFontSet)-1;
}
}
return (fontsetCache[i] == (XFontSet)-1) ? 0 : fontsetCache[i];
}
#ifdef TQ_C_CALLBACKS
extern "C" {
#endif // TQ_C_CALLBACKS
static int xic_start_callback(XIC, XPointer client_data, XPointer) {
TQInputContext *qic = (TQInputContext *) client_data;
if (! qic) {
#ifdef TQT_XIM_DEBUG
qDebug("compose start: no qic");
#endif // TQT_XIM_DEBUG
return 0;
}
qic->composing = TRUE;
qic->text = TQString::null;
qic->tqfocusWidget = 0;
if ( qic->selectedChars.size() < 128 )
qic->selectedChars.resize( 128 );
qic->selectedChars.fill( 0 );
#ifdef TQT_XIM_DEBUG
qDebug("compose start");
#endif // TQT_XIM_DEBUG
return 0;
}
static int xic_draw_callback(XIC, XPointer client_data, XPointer call_data) {
TQInputContext *qic = (TQInputContext *) client_data;
if (! qic) {
#ifdef TQT_XIM_DEBUG
qDebug("compose event: invalid compose event %p", qic);
#endif // TQT_XIM_DEBUG
return 0;
}
bool send_imstart = FALSE;
if (tqApp->tqfocusWidget() != qic->tqfocusWidget && qic->text.isEmpty()) {
if (qic->tqfocusWidget) {
#ifdef TQT_XIM_DEBUG
qDebug( "sending IMEnd (empty) to %p", qic->tqfocusWidget );
#endif // TQT_XIM_DEBUG
TQIMEvent endevent(TQEvent::IMEnd, TQString::null, -1);
TQApplication::sendEvent(qic->tqfocusWidget, &endevent);
}
qic->text = TQString::null;
qic->tqfocusWidget = tqApp->tqfocusWidget();
qic->composing = FALSE;
if ( qic->selectedChars.size() < 128 )
qic->selectedChars.resize( 128 );
qic->selectedChars.fill( 0 );
if (qic->tqfocusWidget) {
qic->composing = TRUE;
send_imstart = TRUE;
}
}
if (! qic->composing || ! qic->tqfocusWidget) {
#ifdef TQT_XIM_DEBUG
qDebug("compose event: invalid compose event %d %p",
qic->composing, qic->tqfocusWidget);
#endif // TQT_XIM_DEBUG
return 0;
}
if ( send_imstart ) {
#ifdef TQT_XIM_DEBUG
qDebug( "sending IMStart to %p", qic->tqfocusWidget );
#endif // TQT_XIM_DEBUG
qt_compose_emptied = FALSE;
TQIMEvent startevent(TQEvent::IMStart, TQString::null, -1);
TQApplication::sendEvent(qic->tqfocusWidget, &startevent);
}
XIMPreeditDrawCallbackStruct *drawstruct =
(XIMPreeditDrawCallbackStruct *) call_data;
XIMText *text = (XIMText *) drawstruct->text;
int cursor = drawstruct->caret, sellen = 0;
if ( ! drawstruct->caret && ! drawstruct->chg_first &&
! drawstruct->chg_length && ! text ) {
// nothing to do
return 0;
}
if (text) {
char *str = 0;
if (text->encoding_is_wchar) {
int l = wcstombs(NULL, text->string.wide_char, text->length);
if (l != -1) {
str = new char[l + 1];
wcstombs(str, text->string.wide_char, l);
str[l] = 0;
}
} else
str = text->string.multi_byte;
if (! str)
return 0;
TQString s = TQString::fromLocal8Bit(str);
if (text->encoding_is_wchar)
delete [] str;
if (drawstruct->chg_length < 0)
qic->text.tqreplace(drawstruct->chg_first, UINT_MAX, s);
else
qic->text.tqreplace(drawstruct->chg_first, drawstruct->chg_length, s);
if ( qic->selectedChars.size() < qic->text.length() ) {
// expand the selectedChars array if the compose string is longer
uint from = qic->selectedChars.size();
qic->selectedChars.resize( qic->text.length() );
for ( uint x = from; from < qic->selectedChars.size(); ++x )
qic->selectedChars[x] = 0;
}
uint x;
bool *p = qic->selectedChars.data() + drawstruct->chg_first;
// determine if the changed chars are selected based on text->feedback
for ( x = 0; x < s.length(); ++x )
*p++ = ( text->feedback ? ( text->feedback[x] & XIMReverse ) : 0 );
// figure out where the selection starts, and how long it is
p = qic->selectedChars.data();
bool started = FALSE;
for ( x = 0; x < TQMIN(qic->text.length(), qic->selectedChars.size()); ++x ) {
if ( started ) {
if ( *p ) ++sellen;
else break;
} else {
if ( *p ) {
cursor = x;
started = TRUE;
sellen = 1;
}
}
++p;
}
} else {
if (drawstruct->chg_length == 0)
drawstruct->chg_length = -1;
qic->text.remove(drawstruct->chg_first, drawstruct->chg_length);
qt_compose_emptied = qic->text.isEmpty();
if ( qt_compose_emptied ) {
#ifdef TQT_XIM_DEBUG
qDebug( "compose emptied" );
#endif // TQT_XIM_DEBUG
// don't send an empty compose, since we will send an IMEnd with
// either the correct compose text (or null text if the user has
// cancelled the compose or deleted all chars).
return 0;
}
}
#ifdef TQT_XIM_DEBUG
qDebug( "sending IMCompose to %p with %d chars",
qic->tqfocusWidget, qic->text.length() );
#endif // TQT_XIM_DEBUG
TQIMComposeEvent event( TQEvent::IMCompose, qic->text, cursor, sellen );
TQApplication::sendEvent(qic->tqfocusWidget, &event);
return 0;
}
static int xic_done_callback(XIC, XPointer client_data, XPointer) {
TQInputContext *qic = (TQInputContext *) client_data;
if (! qic)
return 0;
if (qic->composing && qic->tqfocusWidget) {
#ifdef TQT_XIM_DEBUG
qDebug( "sending IMEnd (empty) to %p", qic->tqfocusWidget );
#endif // TQT_XIM_DEBUG
TQIMEvent event(TQEvent::IMEnd, TQString::null, -1);
TQApplication::sendEvent(qic->tqfocusWidget, &event);
}
qic->composing = FALSE;
qic->tqfocusWidget = 0;
if ( qic->selectedChars.size() < 128 )
qic->selectedChars.resize( 128 );
qic->selectedChars.fill( 0 );
return 0;
}
#ifdef TQ_C_CALLBACKS
}
#endif // TQ_C_CALLBACKS
#endif // !TQT_NO_XIM
TQInputContext::TQInputContext(TQWidget *widget)
: ic(0), tqfocusWidget(0), composing(FALSE), fontset(0)
{
#if !defined(TQT_NO_XIM)
fontsetRefCount++;
if (! qt_xim) {
qWarning("TQInputContext: no input method context available");
return;
}
if (! widget->isTopLevel()) {
qWarning("TQInputContext: cannot create input context for non-toplevel widgets");
return;
}
XPoint spot;
XRectangle rect;
XVaNestedList preedit_attr = 0;
XIMCallback startcallback, drawcallback, donecallback;
font = widget->font();
fontset = getFontSet( font );
if (qt_xim_style & XIMPreeditArea) {
rect.x = 0;
rect.y = 0;
rect.width = widget->width();
rect.height = widget->height();
preedit_attr = XVaCreateNestedList(0,
XNArea, &rect,
XNFontSet, fontset,
(char *) 0);
} else if (qt_xim_style & XIMPreeditPosition) {
spot.x = 1;
spot.y = 1;
preedit_attr = XVaCreateNestedList(0,
XNSpotLocation, &spot,
XNFontSet, fontset,
(char *) 0);
} else if (qt_xim_style & XIMPreeditCallbacks) {
startcallback.client_data = (XPointer) this;
startcallback.callback = (XIMProc) xic_start_callback;
drawcallback.client_data = (XPointer) this;
drawcallback.callback = (XIMProc)xic_draw_callback;
donecallback.client_data = (XPointer) this;
donecallback.callback = (XIMProc) xic_done_callback;
preedit_attr = XVaCreateNestedList(0,
XNPreeditStartCallback, &startcallback,
XNPreeditDrawCallback, &drawcallback,
XNPreeditDoneCallback, &donecallback,
(char *) 0);
}
if (preedit_attr) {
ic = XCreateIC(qt_xim,
XNInputStyle, qt_xim_style,
XNClientWindow, widget->winId(),
XNPreeditAttributes, preedit_attr,
(char *) 0);
XFree(preedit_attr);
} else
ic = XCreateIC(qt_xim,
XNInputStyle, qt_xim_style,
XNClientWindow, widget->winId(),
(char *) 0);
if (! ic)
qFatal("Failed to create XIM input context!");
// when resetting the input context, preserve the input state
(void) XSetICValues((XIC) ic, XNResetState, XIMPreserveState, (char *) 0);
#endif // !TQT_NO_XIM
}
TQInputContext::~TQInputContext()
{
#if !defined(TQT_NO_XIM)
if (ic)
XDestroyIC((XIC) ic);
if ( --fontsetRefCount == 0 ) {
Display *dpy = TQPaintDevice::x11AppDisplay();
for ( int i = 0; i < 8; i++ ) {
if ( fontsetCache[i] && fontsetCache[i] != (XFontSet)-1 ) {
XFreeFontSet(dpy, fontsetCache[i]);
fontsetCache[i] = 0;
}
}
}
#endif // !TQT_NO_XIM
ic = 0;
tqfocusWidget = 0;
composing = FALSE;
}
void TQInputContext::reset()
{
#if !defined(TQT_NO_XIM)
if (tqfocusWidget && composing && ! text.isNull()) {
#ifdef TQT_XIM_DEBUG
qDebug("TQInputContext::reset: composing - sending IMEnd (empty) to %p",
tqfocusWidget);
#endif // TQT_XIM_DEBUG
TQIMEvent endevent(TQEvent::IMEnd, TQString::null, -1);
TQApplication::sendEvent(tqfocusWidget, &endevent);
tqfocusWidget = 0;
text = TQString::null;
if ( selectedChars.size() < 128 )
selectedChars.resize( 128 );
selectedChars.fill( 0 );
char *mb = XmbResetIC((XIC) ic);
if (mb)
XFree(mb);
}
#endif // !TQT_NO_XIM
}
void TQInputContext::setComposePosition(int x, int y)
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
XPoint point;
point.x = x;
point.y = y;
XVaNestedList preedit_attr =
XVaCreateNestedList(0,
XNSpotLocation, &point,
(char *) 0);
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
}
#endif // !TQT_NO_XIM
}
void TQInputContext::setComposeArea(int x, int y, int w, int h)
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
XRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
XVaNestedList preedit_attr = XVaCreateNestedList(0,
XNArea, &rect,
(char *) 0);
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
}
#endif
}
int TQInputContext::lookupString(XKeyEvent *event, TQCString &chars,
KeySym *key, Status *status) const
{
int count = 0;
#if !defined(TQT_NO_XIM)
if (qt_xim && ic) {
count = XmbLookupString((XIC) ic, event, chars.data(),
chars.size(), key, status);
if ((*status) == XBufferOverflow ) {
chars.resize(count + 1);
count = XmbLookupString((XIC) ic, event, chars.data(),
chars.size(), key, status);
}
}
#endif // TQT_NO_XIM
return count;
}
void TQInputContext::setFocus()
{
#if !defined(TQT_NO_XIM)
if (qt_xim && ic)
XSetICFocus((XIC) ic);
#endif // !TQT_NO_XIM
}
void TQInputContext::setXFontSet(const TQFont &f)
{
#if !defined(TQT_NO_XIM)
if (font == f) return; // nothing to do
font = f;
XFontSet fs = getFontSet(font);
if (fontset == fs) return; // nothing to do
fontset = fs;
XVaNestedList preedit_attr = XVaCreateNestedList(0, XNFontSet, fontset, (char *) 0); #endif //TQ_NO_IM
XSetICValues((XIC) ic, XNPreeditAttributes, preedit_attr, (char *) 0);
XFree(preedit_attr);
#else
TQ_UNUSED( f );
#endif
}

@ -512,7 +512,8 @@ typedef Qt::Orientation Orientation;
#ifdef TQT_NO_COMPAT #ifdef TQT_NO_COMPAT
enum GUIStyle { enum GUIStyle {
WindowsStyle = 1, // ### TQt 4.0: either remove the obsolete enums or clean up compat vs. 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. MotifStyle = 4, // ### TQT_NO_COMPAT by reordering or combination into one enum.
GtkStyle = 6 // Gtk compability mode
}; };
#else #else
enum GUIStyle { enum GUIStyle {
@ -520,7 +521,8 @@ typedef Qt::Orientation Orientation;
WindowsStyle, WindowsStyle,
Win3Style, // OBSOLETE Win3Style, // OBSOLETE
PMStyle, // OBSOLETE PMStyle, // OBSOLETE
MotifStyle MotifStyle,
GtkStyle = 6 // Gtk compability mode
}; };
#endif #endif
@ -631,6 +633,87 @@ typedef Qt::Orientation Orientation;
Key_Help = (int)Qt::Key_Help, Key_Help = (int)Qt::Key_Help,
Key_Direction_L = (int)Qt::Key_Direction_L, Key_Direction_L = (int)Qt::Key_Direction_L,
Key_Direction_R = (int)Qt::Key_Direction_R, Key_Direction_R = (int)Qt::Key_Direction_R,
// International input method support (X keycode - 0xEE00, the
// definition follows TQt/Embedded 2.3.7) Only interesting if
// you are writing your own input method
// International & multi-key character composition
Key_Multi_key = 0x1120, // Multi-key character compose
Key_Codeinput = 0x1137,
Key_SingleCandidate = 0x113c,
Key_MultipleCandidate = 0x113d,
Key_PreviousCandidate = 0x113e,
// Misc Functions
Key_Mode_switch = 0x117e, // Character set switch
//Key_script_switch = 0x117e, // Alias for mode_switch
// Japanese keyboard support
Key_Kanji = 0x1121, // Kanji, Kanji convert
Key_Muhenkan = 0x1122, // Cancel Conversion
//Key_Henkan_Mode = 0x1123, // Start/Stop Conversion
Key_Henkan = 0x1123, // Alias for Henkan_Mode
Key_Romaji = 0x1124, // to Romaji
Key_Hiragana = 0x1125, // to Hiragana
Key_Katakana = 0x1126, // to Katakana
Key_Hiragana_Katakana = 0x1127, // Hiragana/Katakana toggle
Key_Zenkaku = 0x1128, // to Zenkaku
Key_Hankaku = 0x1129, // to Hankaku
Key_Zenkaku_Hankaku = 0x112a, // Zenkaku/Hankaku toggle
Key_Touroku = 0x112b, // Add to Dictionary
Key_Massyo = 0x112c, // Delete from Dictionary
Key_Kana_Lock = 0x112d, // Kana Lock
Key_Kana_Shift = 0x112e, // Kana Shift
Key_Eisu_Shift = 0x112f, // Alphanumeric Shift
Key_Eisu_toggle = 0x1130, // Alphanumeric toggle
//Key_Kanji_Bangou = 0x1137, // Codeinput
//Key_Zen_Koho = 0x113d, // Multiple/All Candidate(s)
//Key_Mae_Koho = 0x113e, // Previous Candidate
// Korean keyboard support
//
// In fact, many Korean users need only 2 keys, Key_Hangul and
// Key_Hangul_Hanja. But rest of the keys are good for future.
Key_Hangul = 0x1131, // Hangul start/stop(toggle)
Key_Hangul_Start = 0x1132, // Hangul start
Key_Hangul_End = 0x1133, // Hangul end, English start
Key_Hangul_Hanja = 0x1134, // Start Hangul->Hanja Conversion
Key_Hangul_Jamo = 0x1135, // Hangul Jamo mode
Key_Hangul_Romaja = 0x1136, // Hangul Romaja mode
//Key_Hangul_Codeinput = 0x1137, // Hangul code input mode
Key_Hangul_Jeonja = 0x1138, // Jeonja mode
Key_Hangul_Banja = 0x1139, // Banja mode
Key_Hangul_PreHanja = 0x113a, // Pre Hanja conversion
Key_Hangul_PostHanja = 0x113b, // Post Hanja conversion
//Key_Hangul_SingleCandidate = 0x113c, // Single candidate
//Key_Hangul_MultipleCandidate = 0x113d, // Multiple candidate
//Key_Hangul_PreviousCandidate = 0x113e, // Previous candidate
Key_Hangul_Special = 0x113f, // Special symbols
//Key_Hangul_switch = 0x117e, // Alias for mode_switch
// dead keys (X keycode - 0xED00 to avoid the conflict)
Key_Dead_Grave = 0x1250,
Key_Dead_Acute = 0x1251,
Key_Dead_Circumflex = 0x1252,
Key_Dead_Tilde = 0x1253,
Key_Dead_Macron = 0x1254,
Key_Dead_Breve = 0x1255,
Key_Dead_Abovedot = 0x1256,
Key_Dead_Diaeresis = 0x1257,
Key_Dead_Abovering = 0x1258,
Key_Dead_Doubleacute = 0x1259,
Key_Dead_Caron = 0x125a,
Key_Dead_Cedilla = 0x125b,
Key_Dead_Ogonek = 0x125c,
Key_Dead_Iota = 0x125d,
Key_Dead_Voiced_Sound = 0x125e,
Key_Dead_Semivoiced_Sound = 0x125f,
Key_Dead_Belowdot = 0x1260,
Key_Dead_Hook = 0x1261,
Key_Dead_Horn = 0x1262,
Key_Space = (int)Qt::Key_Space, // 7 bit printable ASCII Key_Space = (int)Qt::Key_Space, // 7 bit printable ASCII
Key_Any = Key_Space, Key_Any = Key_Space,
Key_Exclam = (int)Qt::Key_Exclam, Key_Exclam = (int)Qt::Key_Exclam,
@ -703,6 +786,11 @@ typedef Qt::Orientation Orientation;
Key_AsciiTilde = (int)Qt::Key_AsciiTilde, Key_AsciiTilde = (int)Qt::Key_AsciiTilde,
// Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06
//
// This is mainly for compatibility - applications and input
// methods should not use the TQt keycodes between 128 and 255,
// but should rather use the TQKeyEvent::text(). See
// TQETWidget::translateKeyEventInternal() for more details.
Key_nobreakspace = (int)Qt::Key_nobreakspace, Key_nobreakspace = (int)Qt::Key_nobreakspace,
Key_exclamdown = (int)Qt::Key_exclamdown, Key_exclamdown = (int)Qt::Key_exclamdown,

@ -1105,11 +1105,16 @@ static void create_dpis()
TQ_CHECK_PTR( dpisX ); TQ_CHECK_PTR( dpisX );
TQ_CHECK_PTR( dpisY ); TQ_CHECK_PTR( dpisY );
for ( i = 0; i < screens; i++ ) { for ( i = 0; i < screens; i++ ) {
dpisX[ i ] = (DisplayWidth(dpy,i) * 254 + DisplayWidthMM(dpy,i)*5) if (DisplayWidthMM(dpy,i) < 1)
dpisX[ i ] = 75; // default the dpi to 75.
/ (DisplayWidthMM(dpy,i)*10); else
dpisY[ i ] = (DisplayHeight(dpy,i) * 254 + DisplayHeightMM(dpy,i)*5) dpisX[ i ] = (DisplayWidth(dpy,i) * 254 + DisplayWidthMM(dpy,i)*5)
/ (DisplayHeightMM(dpy,i)*10); / (DisplayWidthMM(dpy,i)*10);
if (DisplayHeightMM(dpy,i) < 1)
dpisY[ i ] = 75; // default the dpi to 75.
else
dpisY[ i ] = (DisplayHeight(dpy,i) * 254 + DisplayHeightMM(dpy,i)*5)
/ (DisplayHeightMM(dpy,i)*10);
} }
} }

@ -40,7 +40,19 @@
// NOT REVISED // NOT REVISED
#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 // Uncomment the next line to enable the MIT Shared Memory extension
// for TQPixmap::xForm()
// //
// WARNING: This has some problems: // WARNING: This has some problems:
// //
@ -48,7 +60,7 @@
// 2. TQt does not handle the ShmCompletion message, so you will // 2. TQt does not handle the ShmCompletion message, so you will
// get strange effects if you xForm() repeatedly. // get strange effects if you xForm() repeatedly.
// //
// #define TQT_MITSHM // #define TQT_MITSHM_XFORM
#if defined(TQ_OS_WIN32) && defined(TQT_MITSHM) #if defined(TQ_OS_WIN32) && defined(TQT_MITSHM)
#undef TQT_MITSHM #undef TQT_MITSHM
@ -131,7 +143,7 @@ inline static void qSafeXDestroyImage( XImage *x )
MIT Shared Memory Extension support: makes xForm noticeably (~20%) faster. MIT Shared Memory Extension support: makes xForm noticeably (~20%) faster.
*****************************************************************************/ *****************************************************************************/
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
static bool xshminit = FALSE; static bool xshminit = FALSE;
static XShmSegmentInfo xshminfo; static XShmSegmentInfo xshminfo;
@ -213,8 +225,100 @@ static bool qt_create_mitshm_buffer( const TQPaintDevice* dev, int w, int h )
// return FALSE; // return FALSE;
// } // }
#endif // TQT_MITSHM #endif // TQT_MITSHM_XFORM
#ifdef TQT_MITSHM_CONVERSIONS
static bool qt_mitshm_error = false;
static int qt_mitshm_errorhandler( Display*, XErrorEvent* )
{
qt_mitshm_error = true;
return 0;
}
static XImage* qt_XShmCreateImage( Display* dpy, Visual* visual, unsigned int depth,
int format, int /*offset*/, char* /*data*/, unsigned int width, unsigned int height,
int /*bitmap_pad*/, int /*bytes_per_line*/, XShmSegmentInfo* shminfo )
{
if( width * height * depth < 100*100*32 )
return NULL;
static int shm_inited = -1;
if( shm_inited == -1 ) {
if( XShmQueryExtension( dpy ))
shm_inited = 1;
else
shm_inited = 0;
}
if( shm_inited == 0 )
return NULL;
XImage* xi = XShmCreateImage( dpy, visual, depth, format, NULL, shminfo, width,
height );
if( xi == NULL )
return NULL;
shminfo->shmid = shmget( IPC_PRIVATE, xi->bytes_per_line * xi->height,
IPC_CREAT|0600);
if( shminfo->shmid < 0 ) {
XDestroyImage( xi );
return NULL;
}
shminfo->readOnly = False;
shminfo->shmaddr = (char*)shmat( shminfo->shmid, 0, 0 );
if( shminfo->shmaddr == (char*)-1 ) {
XDestroyImage( xi );
shmctl( shminfo->shmid, IPC_RMID, 0 );
return NULL;
}
xi->data = shminfo->shmaddr;
#ifndef TQT_MITSHM_RMID_IGNORES_REFCOUNT
// mark as deleted to automatically free the memory in case
// of a crash (but this doesn't work e.g. on Solaris)
shmctl( shminfo->shmid, IPC_RMID, 0 );
#endif
if( shm_inited == 1 ) { // first time
XErrorHandler old_h = XSetErrorHandler( qt_mitshm_errorhandler );
XShmAttach( dpy, shminfo );
shm_inited = 2;
XSync( dpy, False );
XSetErrorHandler( old_h );
if( qt_mitshm_error ) { // oops ... perhaps we are remote?
shm_inited = 0;
XDestroyImage( xi );
shmdt( shminfo->shmaddr );
#ifdef TQT_MITSHM_RMID_IGNORES_REFCOUNT
shmctl( shminfo->shmid, IPC_RMID, 0 );
#endif
return NULL;
}
} else
XShmAttach( dpy, shminfo );
return xi;
}
static void qt_XShmDestroyImage( XImage* xi, XShmSegmentInfo* shminfo )
{
XShmDetach( TQPaintDevice::x11AppDisplay(), shminfo );
XDestroyImage( xi );
shmdt( shminfo->shmaddr );
#ifdef TQT_MITSHM_RMID_IGNORES_REFCOUNT
shmctl( shminfo->shmid, IPC_RMID, 0 );
#endif
}
static XImage* qt_XShmGetImage( const TQPixmap* pix, int format,
XShmSegmentInfo* shminfo )
{
XImage* xi = qt_XShmCreateImage( pix->x11Display(), (Visual*)pix->x11Visual(),
pix->depth(), format, 0, 0, pix->width(), pix->height(), 32, 0, shminfo );
if( xi == NULL )
return NULL;
if( XShmGetImage( pix->x11Display(), pix->handle(), xi, 0, 0, AllPlanes ) == False ) {
qt_XShmDestroyImage( xi, shminfo );
return NULL;
}
return xi;
}
#endif // TQT_MITSHM_CONVERSIONS
/***************************************************************************** /*****************************************************************************
Internal functions Internal functions
@ -667,9 +771,20 @@ TQImage TQPixmap::convertToImage() const
d = 32; // > 8 ==> 32 d = 32; // > 8 ==> 32
XImage *xi = (XImage *)data->ximage; // any cached ximage? XImage *xi = (XImage *)data->ximage; // any cached ximage?
if ( !xi ) // fetch data from X server #ifdef TQT_MITSHM_CONVERSIONS
bool mitshm_ximage = false;
XShmSegmentInfo shminfo;
#endif
if ( !xi ) { // fetch data from X server
#ifdef TQT_MITSHM_CONVERSIONS
xi = qt_XShmGetImage( this, mono ? XYPixmap : ZPixmap, &shminfo );
if( xi ) {
mitshm_ximage = true;
} else
#endif
xi = XGetImage( x11Display(), hd, 0, 0, w, h, AllPlanes, xi = XGetImage( x11Display(), hd, 0, 0, w, h, AllPlanes,
mono ? XYPixmap : ZPixmap ); mono ? XYPixmap : ZPixmap );
}
TQ_CHECK_PTR( xi ); TQ_CHECK_PTR( xi );
if (!xi) if (!xi)
return image; // null image return image; // null image
@ -680,15 +795,31 @@ TQImage TQPixmap::convertToImage() const
TQImage::LittleEndian : TQImage::BigEndian; TQImage::LittleEndian : TQImage::BigEndian;
} }
image.create( w, h, d, 0, bitOrder ); image.create( w, h, d, 0, bitOrder );
if ( image.isNull() ) // could not create image if ( image.isNull() ) { // could not create image
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage )
qt_XShmDestroyImage( xi, &shminfo );
else
#endif
qSafeXDestroyImage( xi );
return image; return image;
}
const TQPixmap* msk = tqmask(); const TQPixmap* msk = tqmask();
const TQPixmap *alf = data->alphapm; const TQPixmap *alf = data->alphapm;
TQImage alpha; TQImage alpha;
if (alf) { if (alf) {
XImage *axi = XGetImage(x11Display(), alf->hd, 0, 0, w, h, AllPlanes, ZPixmap); XImage* axi;
#ifdef TQT_MITSHM_CONVERSIONS
bool mitshm_aximage = false;
XShmSegmentInfo ashminfo;
axi = qt_XShmGetImage( alf, ZPixmap, &ashminfo );
if( axi ) {
mitshm_aximage = true;
} else
#endif
axi = XGetImage(x11Display(), alf->hd, 0, 0, w, h, AllPlanes, ZPixmap);
if (axi) { if (axi) {
image.setAlphaBuffer( TRUE ); image.setAlphaBuffer( TRUE );
@ -702,6 +833,11 @@ TQImage TQPixmap::convertToImage() const
src += axi->bytes_per_line; src += axi->bytes_per_line;
} }
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_aximage )
qt_XShmDestroyImage( axi, &ashminfo );
else
#endif
qSafeXDestroyImage( axi ); qSafeXDestroyImage( axi );
} }
} else if (msk) { } else if (msk) {
@ -844,6 +980,12 @@ TQImage TQPixmap::convertToImage() const
xi->bits_per_pixel ); xi->bits_per_pixel );
#endif #endif
image.reset(); image.reset();
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage )
qt_XShmDestroyImage( xi, &shminfo );
else
#endif
qSafeXDestroyImage( xi );
return image; return image;
} }
@ -949,10 +1091,22 @@ TQImage TQPixmap::convertToImage() const
delete [] carr; delete [] carr;
} }
if ( data->optim != BestOptim ) { // throw away image data if ( data->optim != BestOptim ) { // throw away image data
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage )
qt_XShmDestroyImage( xi, &shminfo );
else
#endif
qSafeXDestroyImage( xi ); qSafeXDestroyImage( xi );
((TQPixmap*)this)->data->ximage = 0; ((TQPixmap*)this)->data->ximage = 0;
} else // keep ximage data } else { // keep ximage data
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage ) { // copy the XImage?
qt_XShmDestroyImage( xi, &shminfo );
xi = 0;
}
#endif
((TQPixmap*)this)->data->ximage = xi; ((TQPixmap*)this)->data->ximage = xi;
}
return image; return image;
} }
@ -1125,6 +1279,11 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
bool trucol = (visual->c_class == TrueColor || visual->c_class == DirectColor); bool trucol = (visual->c_class == TrueColor || visual->c_class == DirectColor);
int nbytes = image.numBytes(); int nbytes = image.numBytes();
uchar *newbits= 0; uchar *newbits= 0;
int newbits_size = 0;
#ifdef TQT_MITSHM_CONVERSIONS
bool mitshm_ximage = false;
XShmSegmentInfo shminfo;
#endif
if ( trucol ) { // truecolor display if ( trucol ) { // truecolor display
TQRgb pix[256]; // pixel translation table TQRgb pix[256]; // pixel translation table
@ -1153,19 +1312,24 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
} }
} }
#ifdef TQT_MITSHM_CONVERSIONS
xi = qt_XShmCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0, &shminfo );
if( xi != NULL ) {
mitshm_ximage = true;
newbits = (uchar*)xi->data;
}
else
#endif
xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 ); xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
TQ_CHECK_PTR( xi );
if (!xi) if (!xi)
return false; return false;
if( newbits == NULL )
newbits = (uchar *)malloc( xi->bytes_per_line*h ); newbits = (uchar *)malloc( xi->bytes_per_line*h );
TQ_CHECK_PTR( newbits ); TQ_CHECK_PTR( newbits );
if ( !newbits ) // no memory if ( !newbits ) // no memory
return FALSE; return FALSE;
int bppc = xi->bits_per_pixel; int bppc = xi->bits_per_pixel;
if ( bppc > 8 && xi->byte_order == LSBFirst )
bppc++;
bool contig_bits = n_bits(red_mask) == rbits && bool contig_bits = n_bits(red_mask) == rbits &&
n_bits(green_mask) == gbits && n_bits(green_mask) == gbits &&
n_bits(blue_mask) == bbits; n_bits(blue_mask) == bbits;
@ -1215,31 +1379,70 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
init=TRUE; init=TRUE;
} }
for ( uint y=0; y<h; y++ ) { enum { BPP8,
uchar* src = image.scanLine( y ); BPP16_8_3_M3, BPP16_7_2_M3, BPP16_MSB, BPP16_LSB,
uchar* dst = newbits + xi->bytes_per_line*y; BPP24_MSB, BPP24_LSB,
TQRgb* p = (TQRgb *)src; BPP32_16_8_0, BPP32_MSB, BPP32_LSB
} mode = BPP8;
#define GET_RGB \ if ( bppc > 8 && xi->byte_order == LSBFirst )
int r = tqRed ( *p ); \ bppc++;
int g = tqGreen( *p ); \
int b = tqBlue ( *p++ ); \ int wordsize;
r = red_shift > 0 \ bool bigendian;
? r << red_shift : r >> -red_shift; \ qSysInfo( &wordsize, &bigendian );
g = green_shift > 0 \ bool same_msb_lsb = ( xi->byte_order == MSBFirst ) == ( bigendian );
? g << green_shift : g >> -green_shift; \
b = blue_shift > 0 \ if( bppc == 8 ) // 8 bit
? b << blue_shift : b >> -blue_shift; mode = BPP8;
else if( bppc == 16 || bppc == 17 ) { // 16 bit MSB/LSB
if( red_shift == 8 && green_shift == 3 && blue_shift == -3
&& !d8 && same_msb_lsb )
mode = BPP16_8_3_M3;
else if( red_shift == 7 && green_shift == 2 && blue_shift == -3
&& !d8 && same_msb_lsb )
mode = BPP16_7_2_M3;
else
mode = bppc == 17 ? BPP16_LSB : BPP16_MSB;
} else if( bppc == 24 || bppc == 25 ) { // 24 bit MSB/LSB
mode = bppc == 25 ? BPP24_LSB : BPP24_MSB;
} else if( bppc == 32 || bppc == 33 ) { // 32 bit MSB/LSB
if( red_shift == 16 && green_shift == 8 && blue_shift == 0
&& !d8 && same_msb_lsb )
mode = BPP32_16_8_0;
else
mode = bppc == 33 ? BPP32_LSB : BPP32_MSB;
} else
qFatal("Logic error 3");
#define GET_PIXEL \ #define GET_PIXEL \
int pixel; \ int pixel; \
if ( d8 ) pixel = pix[*src++]; \ if ( d8 ) pixel = pix[*src++]; \
else { \ else { \
GET_RGB \ int r = tqRed ( *p ); \
pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask) \ int g = tqGreen( *p ); \
int b = tqBlue ( *p++ ); \
r = red_shift > 0 \
? r << red_shift : r >> -red_shift; \
g = green_shift > 0 \
? g << green_shift : g >> -green_shift; \
b = blue_shift > 0 \
? b << blue_shift : b >> -blue_shift; \
pixel = (r & red_tqmask)|(g & green_tqmask) | (b & blue_tqmask) \
| ~(blue_mask | green_mask | red_mask); \ | ~(blue_mask | green_mask | red_mask); \
} }
// optimized case - no d8 case, shift only once instead of twice, tqmask only once instead of twice,
// use direct values instead of variables, and use only one statement
// (*p >> 16), (*p >> 8 ) and (*p) are tqRed(),tqGreen() and tqBlue() without masking
// shifts have to be passed including the shift operator (e.g. '>>3'), because of the direction
#define GET_PIXEL_OPT(red_shift,green_shift,blue_shift,red_tqmask,green_tqmask,blue_tqmask) \
int pixel = ((( *p >> 16 ) red_shift ) & red_tqmask ) \
| ((( *p >> 8 ) green_shift ) & green_tqmask ) \
| ((( *p ) blue_shift ) & blue_tqmask ); \
++p;
#define GET_PIXEL_DITHER_TC \ #define GET_PIXEL_DITHER_TC \
int r = tqRed ( *p ); \ int r = tqRed ( *p ); \
int g = tqGreen( *p ); \ int g = tqGreen( *p ); \
@ -1262,89 +1465,176 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
? b << blue_shift : b >> -blue_shift; \ ? b << blue_shift : b >> -blue_shift; \
int pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask); int pixel = (b & blue_mask)|(g & green_mask) | (r & red_mask);
if ( dither_tc ) { // again, optimized case
uint x; // can't be optimized that much :(
switch ( bppc ) { #define GET_PIXEL_DITHER_TC_OPT(red_shift,green_shift,blue_shift,red_tqmask,green_tqmask,blue_tqmask, \
case 16: // 16 bit MSB rbits,gbits,bbits) \
for ( x=0; x<w; x++ ) { const int thres = D[x%16][y%16]; \
GET_PIXEL_DITHER_TC int r = tqRed ( *p ); \
*dst++ = (pixel >> 8); if ( r <= (255-(1<<(8-rbits))) && ((r<<rbits) & 255) \
*dst++ = pixel; > thres) \
} r += (1<<(8-rbits)); \
int g = tqGreen( *p ); \
if ( g <= (255-(1<<(8-gbits))) && ((g<<gbits) & 255) \
> thres) \
g += (1<<(8-gbits)); \
int b = tqBlue ( *p++ ); \
if ( b <= (255-(1<<(8-bbits))) && ((b<<bbits) & 255) \
> thres) \
b += (1<<(8-bbits)); \
int pixel = (( r red_shift ) & red_tqmask ) \
| (( g green_shift ) & green_tqmask ) \
| (( b blue_shift ) & blue_tqmask );
#define CYCLE(body) \
for ( uint y=0; y<h; y++ ) { \
uchar* src = image.scanLine( y ); \
uchar* dst = newbits + xi->bytes_per_line*y; \
TQRgb* p = (TQRgb *)src; \
body \
}
if ( dither_tc ) {
switch ( mode ) {
case BPP16_8_3_M3:
CYCLE(
TQ_INT16* dst16 = (TQ_INT16*)dst;
for ( uint x=0; x<w; x++ ) {
GET_PIXEL_DITHER_TC_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f,5,6,5)
*dst16++ = pixel;
}
)
break; break;
case 17: // 16 bit LSB case BPP16_7_2_M3:
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL_DITHER_TC TQ_INT16* dst16 = (TQ_INT16*)dst;
*dst++ = pixel; for ( uint x=0; x<w; x++ ) {
*dst++ = pixel >> 8; GET_PIXEL_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f)
} *dst16++ = pixel;
}
)
break; break;
default: default:
qFatal("Logic error"); qFatal("Logic error");
} }
} else { } else {
uint x; switch ( mode ) {
switch ( bppc ) { case BPP8: // 8 bit
case 8: // 8 bit CYCLE(
for ( x=0; x<w; x++ ) { Q_UNUSED(p);
int pixel = pix[*src++]; for ( uint x=0; x<w; x++ ) {
*dst++ = pixel; int pixel = pix[*src++];
} *dst++ = pixel;
}
)
break; break;
case 16: // 16 bit MSB case BPP16_8_3_M3:
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL TQ_INT16* dst16 = (TQ_INT16*)dst;
*dst++ = (pixel >> 8); for ( uint x=0; x<w; x++ ) {
*dst++ = pixel; GET_PIXEL_OPT(<<8,<<3,>>3,0xf800,0x7e0,0x1f)
} *dst16++ = pixel;
}
)
break; break;
case 17: // 16 bit LSB case BPP16_7_2_M3:
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL TQ_INT16* dst16 = (TQ_INT16*)dst;
*dst++ = pixel; for ( uint x=0; x<w; x++ ) {
*dst++ = pixel >> 8; GET_PIXEL_DITHER_TC_OPT(<<7,<<2,>>3,0x7c00,0x3e0,0x1f,5,5,5)
} *dst16++ = pixel;
}
)
break; break;
case 24: // 24 bit MSB case BPP16_MSB: // 16 bit MSB
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL for ( uint x=0; x<w; x++ ) {
*dst++ = pixel >> 16; GET_PIXEL_DITHER_TC
*dst++ = pixel >> 8; *dst++ = (pixel >> 8);
*dst++ = pixel; *dst++ = pixel;
} }
)
break; break;
case 25: // 24 bit LSB case BPP16_LSB: // 16 bit LSB
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL for ( uint x=0; x<w; x++ ) {
*dst++ = pixel; GET_PIXEL_DITHER_TC
*dst++ = pixel >> 8; *dst++ = pixel;
*dst++ = pixel >> 16; *dst++ = pixel >> 8;
} }
)
break; break;
case 32: // 32 bit MSB case BPP16_MSB: // 16 bit MSB
for ( x=0; x<w; x++ ) { CYCLE(
GET_PIXEL for ( uint x=0; x<w; x++ ) {
*dst++ = pixel >> 24; GET_PIXEL
*dst++ = pixel >> 16; *dst++ = (pixel >> 8);
*dst++ = pixel >> 8; *dst++ = pixel;
*dst++ = pixel; }
} )
break;
case BPP16_LSB: // 16 bit LSB
CYCLE(
for ( uint x=0; x<w; x++ ) {
GET_PIXEL
*dst++ = pixel;
*dst++ = pixel >> 8;
}
)
break;
case BPP24_MSB: // 24 bit MSB
CYCLE(
for ( uint x=0; x<w; x++ ) {
GET_PIXEL
*dst++ = pixel >> 16;
*dst++ = pixel >> 8;
*dst++ = pixel;
}
)
break; break;
case 33: // 32 bit LSB case 33: // 32 bit LSB
for ( x=0; x<w; x++ ) { case BPP24_LSB: // 24 bit LSB
GET_PIXEL CYCLE(
*dst++ = pixel; for ( uint x=0; x<w; x++ ) {
*dst++ = pixel >> 8; GET_PIXEL
*dst++ = pixel >> 16; *dst++ = pixel;
*dst++ = pixel >> 24; *dst++ = pixel >> 8;
} *dst++ = pixel >> 16;
}
)
break; break;
default: case BPP32_16_8_0:
qFatal("Logic error 2"); CYCLE(
} memcpy( dst, p, w * 4 );
} )
} break;
xi->data = (char *)newbits; case BPP32_MSB: // 32 bit MSB
CYCLE(
for ( uint x=0; x<w; x++ ) {
GET_PIXEL
*dst++ = pixel >> 24;
*dst++ = pixel >> 16;
*dst++ = pixel >> 8;
*dst++ = pixel;
}
)
break;
case BPP32_LSB: // 32 bit LSB
CYCLE(
for ( uint x=0; x<w; x++ ) {
GET_PIXEL
*dst++ = pixel;
*dst++ = pixel >> 8;
*dst++ = pixel >> 16;
*dst++ = pixel >> 24;
}
)
break;
default:
qFatal("Logic error 2");
}
}
xi->data = (char *)newbits;
} }
if ( d == 8 && !trucol ) { // 8 bit pixmap if ( d == 8 && !trucol ) { // 8 bit pixmap
@ -1363,6 +1653,7 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
} }
newbits = (uchar *)malloc( nbytes ); // copy image into newbits newbits = (uchar *)malloc( nbytes ); // copy image into newbits
newbits_size = nbytes;
TQ_CHECK_PTR( newbits ); TQ_CHECK_PTR( newbits );
if ( !newbits ) // no memory if ( !newbits ) // no memory
return FALSE; return FALSE;
@ -1479,12 +1770,19 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
} }
} }
if ( !xi ) { // X image not created if ( !xi ) {
#ifdef TQT_MITSHM_CONVERSIONS
xi = qt_XShmCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0, &shminfo );
if( xi != NULL )
mitshm_ximage = true;
else
#endif // X image not created
xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 ); xi = XCreateImage( dpy, visual, dd, ZPixmap, 0, 0, w, h, 32, 0 );
if ( xi->bits_per_pixel == 16 ) { // convert 8 bpp ==> 16 bpp if ( xi->bits_per_pixel == 16 ) { // convert 8 bpp ==> 16 bpp
ushort *p2; ushort *p2;
int p2inc = xi->bytes_per_line/sizeof(ushort); int p2inc = xi->bytes_per_line/sizeof(ushort);
ushort *newerbits = (ushort *)malloc( xi->bytes_per_line * h ); ushort *newerbits = (ushort *)malloc( xi->bytes_per_line * h );
newbits_size = xi->bytes_per_line * h;
TQ_CHECK_PTR( newerbits ); TQ_CHECK_PTR( newerbits );
if ( !newerbits ) // no memory if ( !newerbits ) // no memory
return FALSE; return FALSE;
@ -1502,6 +1800,14 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
"(bpp=%d)", xi->bits_per_pixel ); "(bpp=%d)", xi->bits_per_pixel );
#endif #endif
} }
#ifdef TQT_MITSHM_CONVERSIONS
if( newbits_size > 0 && mitshm_ximage ) { // need to copy to shared memory
memcpy( xi->data, newbits, newbits_size );
free( newbits );
newbits = (uchar*)xi->data;
}
else
#endif
xi->data = (char *)newbits; xi->data = (char *)newbits;
} }
@ -1535,19 +1841,24 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
} }
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage )
XShmPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ),
xi, 0, 0, 0, 0, w, h, False );
else
#endif
XPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ), XPutImage( dpy, hd, qt_xget_readonly_gc( x11Screen(), FALSE ),
xi, 0, 0, 0, 0, w, h ); xi, 0, 0, 0, 0, w, h );
if ( data->optim != BestOptim ) { // throw away image
qSafeXDestroyImage( xi );
data->ximage = 0;
} else { // keep ximage that we created
data->ximage = xi;
}
data->w = w; data->w = w;
data->h = h; data->h = h;
data->d = dd; data->d = dd;
XImage* axi = NULL;
#ifdef TQT_MITSHM_CONVERSIONS
bool mitshm_aximage = false;
XShmSegmentInfo ashminfo;
#endif
if ( image.hasAlphaBuffer() ) { if ( image.hasAlphaBuffer() ) {
TQBitmap m; TQBitmap m;
m = image.createAlphaMask( conversion_flags ); m = image.createAlphaMask( conversion_flags );
@ -1583,38 +1894,90 @@ bool TQPixmap::convertFromImage( const TQImage &img, int conversion_flags )
data->alphapm->rendhd = data->alphapm->rendhd =
(HANDLE) XftDrawCreateAlpha( x11Display(), data->alphapm->hd, 8 ); (HANDLE) XftDrawCreateAlpha( x11Display(), data->alphapm->hd, 8 );
XImage *axi = XCreateImage(x11Display(), (Visual *) x11Visual(), #ifdef TQT_MITSHM_CONVERSIONS
axi = qt_XShmCreateImage( x11Display(), (Visual*)x11Visual(),
8, ZPixmap, 0, 0, w, h, 8, 0, &ashminfo );
if( axi != NULL )
mitshm_aximage = true;
else
#endif
axi = XCreateImage(x11Display(), (Visual *) x11Visual(),
8, ZPixmap, 0, 0, w, h, 8, 0); 8, ZPixmap, 0, 0, w, h, 8, 0);
if (axi) { if (axi) {
if( axi->data==NULL ) {
// the data is deleted by qSafeXDestroyImage // the data is deleted by qSafeXDestroyImage
axi->data = (char *) malloc(h * axi->bytes_per_line); axi->data = (char *) malloc(h * axi->bytes_per_line);
TQ_CHECK_PTR( axi->data ); TQ_CHECK_PTR( axi->data );
}
char *aptr = axi->data; char *aptr = axi->data;
if (image.depth() == 32) { if (image.depth() == 32) {
const int *iptr = (const int *) image.bits(); const int *iptr = (const int *) image.bits();
int max = w * h; if( axi->bytes_per_line == (int)w ) {
while (max--) int max = w * h;
*aptr++ = *iptr++ >> 24; // squirt while (max--)
*aptr++ = *iptr++ >> 24; // squirt
} else {
for (uint i = 0; i < h; ++i ) {
for (uint j = 0; j < w; ++j )
*aptr++ = *iptr++ >> 24; // squirt
aptr += ( axi->bytes_per_line - w );
}
}
} else if (image.depth() == 8) { } else if (image.depth() == 8) {
const TQRgb * const rgb = image.colorTable(); const TQRgb * const rgb = image.colorTable();
for (uint y = 0; y < h; ++y) { for (uint y = 0; y < h; ++y) {
const uchar *iptr = image.scanLine(y); const uchar *iptr = image.scanLine(y);
for (uint x = 0; x < w; ++x) for (uint x = 0; x < w; ++x)
*aptr++ = tqAlpha(rgb[*iptr++]); *aptr++ = tqAlpha(rgb[*iptr++]);
aptr += ( axi->bytes_per_line - w );
} }
} }
GC gc = XCreateGC(x11Display(), data->alphapm->hd, 0, 0); GC gc = XCreateGC(x11Display(), data->alphapm->hd, 0, 0);
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_aximage )
XShmPutImage( dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h, False );
else
#endif
XPutImage(dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h); XPutImage(dpy, data->alphapm->hd, gc, axi, 0, 0, 0, 0, w, h);
XFreeGC(x11Display(), gc); XFreeGC(x11Display(), gc);
qSafeXDestroyImage(axi);
} }
} }
#endif // TQT_NO_XFTFREETYPE #endif // TQT_NO_XFTFREETYPE
} }
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage || mitshm_aximage )
XSync( x11Display(), False ); // wait until processed
#endif
if ( data->optim != BestOptim ) { // throw away image
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage )
qt_XShmDestroyImage( xi, &shminfo );
else
#endif
qSafeXDestroyImage( xi );
data->ximage = 0;
} else { // keep ximage that we created
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_ximage ) { // copy the XImage?
qt_XShmDestroyImage( xi, &shminfo );
xi = 0;
}
#endif
data->ximage = xi;
}
if( axi ) {
#ifdef TQT_MITSHM_CONVERSIONS
if( mitshm_aximage )
qt_XShmDestroyImage( axi, &ashminfo );
else
#endif
qSafeXDestroyImage(axi);
}
return TRUE; return TRUE;
} }
@ -1777,7 +2140,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
return pm; return pm;
} }
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
static bool try_once = TRUE; static bool try_once = TRUE;
if (try_once) { if (try_once) {
try_once = FALSE; try_once = FALSE;
@ -1810,7 +2173,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
dbpl = ((w*bpp+31)/32)*4; dbpl = ((w*bpp+31)/32)*4;
dbytes = dbpl*h; dbytes = dbpl*h;
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
if ( use_mitshm ) { if ( use_mitshm ) {
dptr = (uchar *)xshmimg->data; dptr = (uchar *)xshmimg->data;
uchar fillbyte = bpp == 8 ? white.pixel() : 0xff; uchar fillbyte = bpp == 8 ? white.pixel() : 0xff;
@ -1826,7 +2189,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
memset( dptr, TQt::white.pixel( x11Screen() ), dbytes ); memset( dptr, TQt::white.pixel( x11Screen() ), dbytes );
else else
memset( dptr, 0xff, dbytes ); memset( dptr, 0xff, dbytes );
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
} }
#endif #endif
@ -1857,7 +2220,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
} else { } else {
xbpl = (w*bpp)/8; xbpl = (w*bpp)/8;
p_inc = dbpl - xbpl; p_inc = dbpl - xbpl;
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
if ( use_mitshm ) if ( use_mitshm )
p_inc = xshmimg->bytes_per_line - xbpl; p_inc = xshmimg->bytes_per_line - xbpl;
#endif #endif
@ -1894,7 +2257,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
TQPixmap pm( w, h ); TQPixmap pm( w, h );
pm.data->uninit = FALSE; pm.data->uninit = FALSE;
pm.x11SetScreen( x11Screen() ); pm.x11SetScreen( x11Screen() );
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
if ( use_mitshm ) { if ( use_mitshm ) {
XCopyArea( dpy, xshmpm, pm.handle(), gc, 0, 0, w, h, 0, 0 ); XCopyArea( dpy, xshmpm, pm.handle(), gc, 0, 0, w, h, 0, 0 );
} else { } else {
@ -1903,7 +2266,7 @@ TQPixmap TQPixmap::xForm( const TQWMatrix &matrix ) const
ZPixmap, 0, (char *)dptr, w, h, 32, 0 ); ZPixmap, 0, (char *)dptr, w, h, 32, 0 );
XPutImage( dpy, pm.handle(), gc, xi, 0, 0, 0, 0, w, h); XPutImage( dpy, pm.handle(), gc, xi, 0, 0, 0, 0, w, h);
qSafeXDestroyImage( xi ); qSafeXDestroyImage( xi );
#if defined(TQT_MITSHM) #if defined(TQT_MITSHM_XFORM)
} }
#endif #endif

@ -9028,7 +9028,7 @@ void TQTextCursor::restoreState()
pop(); pop();
} }
bool TQTextCursor::place( const TQPoint &p, TQTextParagraph *s, bool link ) bool TQTextCursor::place( const TQPoint &p, TQTextParagraph *s, bool link, bool loosePlacing, bool matchBetweenCharacters )
{ {
TQPoint pos( p ); TQPoint pos( p );
TQRect r; TQRect r;
@ -9046,7 +9046,7 @@ bool TQTextCursor::place( const TQPoint &p, TQTextParagraph *s, bool link )
str = s; str = s;
if ( pos.y() >= r.y() && pos.y() <= r.y() + r.height() ) if ( pos.y() >= r.y() && pos.y() <= r.y() + r.height() )
break; break;
if ( !s->next() ) { if ( loosePlacing == TRUE && !s->next() ) {
#ifdef TQ_WS_MACX #ifdef TQ_WS_MACX
pos.setX( s->rect().x() + s->rect().width() ); pos.setX( s->rect().x() + s->rect().width() );
#endif #endif
@ -9087,7 +9087,7 @@ bool TQTextCursor::place( const TQPoint &p, TQTextParagraph *s, bool link )
if ( pos.x() < x ) if ( pos.x() < x )
pos.setX( x + 1 ); pos.setX( x + 1 );
int cw; int cw;
int curpos = s->length()-1; int curpos = -1;
int dist = 10000000; int dist = 10000000;
bool inCustom = FALSE; bool inCustom = FALSE;
while ( i < nextLine ) { while ( i < nextLine ) {
@ -9109,14 +9109,21 @@ bool TQTextCursor::place( const TQPoint &p, TQTextParagraph *s, bool link )
cpos += cw; cpos += cw;
int d = cpos - pos.x(); int d = cpos - pos.x();
bool dm = d < 0 ? !chr->rightToLeft : chr->rightToLeft; bool dm = d < 0 ? !chr->rightToLeft : chr->rightToLeft;
if ( (TQABS( d ) < dist || (dist == d && dm == TRUE )) && para->string()->validCursorPosition( i ) ) { if ( ( matchBetweenCharacters == TRUE && (TQABS( d ) < dist || (dist == d && dm == TRUE )) && para->string()->validCursorPosition( i ) ) ||
( matchBetweenCharacters == FALSE && ( d == 0 || dm == TRUE ) ) ) {
dist = TQABS( d ); dist = TQABS( d );
if ( !link || pos.x() >= x + chr->x ) if ( !link || ( pos.x() >= x + chr->x && ( loosePlacing == TRUE || pos.x() < cpos ) ) )
curpos = i; curpos = i;
} }
} }
i++; i++;
} }
if ( curpos == -1 ) {
if ( loosePlacing == TRUE )
curpos = s->length()-1;
else
return FALSE;
}
setIndex( curpos ); setIndex( curpos );
#ifndef TQT_NO_TEXTCUSTOMITEM #ifndef TQT_NO_TEXTCUSTOMITEM
@ -13244,6 +13251,9 @@ void TQTextParagraph::drawString( TQPainter &painter, const TQString &str, int s
tmpw = fullSelectionWidth - xleft; tmpw = fullSelectionWidth - xleft;
painter.fillRect( xleft, y, tmpw, h, color ); painter.fillRect( xleft, y, tmpw, h, color );
painter.drawText( xstart, y + baseLine, str, start, len, dir ); painter.drawText( xstart, y + baseLine, str, start, len, dir );
// draw preedit's underline
if (selection == TQTextDocument::IMCompositionText)
painter.drawLine(xstart, y + baseLine + 1, xstart + w, y + baseLine + 1);
if (selStart != start || selEnd != start + len || selWrap) if (selStart != start || selEnd != start + len || selWrap)
painter.restore(); painter.restore();
} }

@ -2523,7 +2523,8 @@ public:
int totalOffsetY() const; // total document offset int totalOffsetY() const; // total document offset
bool place( const TQPoint &pos, TQTextParagraph *s ) { return place( pos, s, FALSE ); } bool place( const TQPoint &pos, TQTextParagraph *s ) { return place( pos, s, FALSE ); }
bool place( const TQPoint &pos, TQTextParagraph *s, bool link ); bool place( const TQPoint &pos, TQTextParagraph *s, bool link ) { return place( pos, s, link, TRUE, TRUE ); }
bool place( const TQPoint &pos, TQTextParagraph *s, bool link, bool loosePlacing, bool matchBetweenCharacters );
void restoreState(); void restoreState();

@ -177,6 +177,11 @@ extern "C" {
#endif // TQT_NO_XRENDER #endif // TQT_NO_XRENDER
#ifndef TQT_NO_XSYNC
# include <X11/extensions/sync.h>
#endif // TQT_NO_XSYNC
#ifndef TQT_NO_XKB #ifndef TQT_NO_XKB
# include <X11/XKBlib.h> # include <X11/XKBlib.h>
#endif // TQT_NO_XKB #endif // TQT_NO_XKB

@ -5953,8 +5953,24 @@ void TQWidget::setFocus()
if ( isActiveWindow() ) { if ( isActiveWindow() ) {
TQWidget * prev = tqApp->focus_widget; TQWidget * prev = tqApp->focus_widget;
if ( prev ) { if ( prev ) {
if ( prev != this ) // This part is never executed when TQ_WS_X11? Preceding XFocusOut
// had already reset focus_widget when received XFocusIn
// Don't reset input context explicitly here. Whether reset or not
// when focusing out is a responsibility of input methods. For
// example, Japanese input context should not be reset here. The
// context sometimes contains a whole paragraph and has minutes of
// lifetime different to ephemeral one in other languages. The
// input context should be survived until focused again. So we
// delegate the responsibility to input context via
// unfocusInputContext().
if ( prev != this && prev->isInputMethodEnabled() ) {
#if 0
prev->resetInputContext(); prev->resetInputContext();
#else
prev->unfocusInputContext();
#endif
}
} }
#if defined(TQ_WS_WIN) #if defined(TQ_WS_WIN)
else { else {
@ -5962,9 +5978,8 @@ void TQWidget::setFocus()
} }
#endif #endif
tqApp->focus_widget = this; tqApp->focus_widget = this;
#if defined(TQ_WS_X11) if( isInputMethodEnabled() )
focusInputContext(); focusInputContext();
#endif
#if defined(TQ_WS_WIN) #if defined(TQ_WS_WIN)
if ( !tqtopLevelWidget()->isPopup() ) if ( !tqtopLevelWidget()->isPopup() )
@ -6012,7 +6027,11 @@ void TQWidget::clearFocus()
focusProxy()->clearFocus(); focusProxy()->clearFocus();
return; return;
} else if ( hasFocus() ) { } else if ( hasFocus() ) {
#if !defined(TQ_WS_X11)
resetInputContext(); resetInputContext();
#else
unfocusInputContext();
#endif
TQWidget* w = tqApp->tqfocusWidget(); TQWidget* w = tqApp->tqfocusWidget();
// clear active focus // clear active focus
tqApp->focus_widget = 0; tqApp->focus_widget = 0;
@ -7338,7 +7357,13 @@ bool TQWidget::event( TQEvent *e )
break; break;
case TQEvent::MouseButtonPress: case TQEvent::MouseButtonPress:
// Don't reset input context here. Whether reset or not is
// a responsibility of input method. reset() will be
// called by mouseHandler() of input method if necessary
// via mousePressEvent() of text widgets.
#if 0
resetInputContext(); resetInputContext();
#endif
mousePressEvent( (TQMouseEvent*)e ); mousePressEvent( (TQMouseEvent*)e );
if ( ! ((TQMouseEvent*)e)->isAccepted() ) if ( ! ((TQMouseEvent*)e)->isAccepted() )
return FALSE; return FALSE;

@ -64,6 +64,10 @@
#endif // TQFONTENGINE_P_H #endif // TQFONTENGINE_P_H
#endif // USE_QT4 #endif // USE_QT4
#if defined(TQ_WS_X11) && !defined(TQT_NO_IM)
class TQInputContext;
#endif
class TQLayout; class TQLayout;
#ifdef USE_QT4 #ifdef USE_QT4
@ -980,7 +984,19 @@ public:
CGContextRef macCGContext(bool clipped=TRUE) const; CGContextRef macCGContext(bool clipped=TRUE) const;
#endif #endif
#endif #endif
#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
void setWindowOpacity(double level); void setWindowOpacity(double level);
double windowOpacity() const; double windowOpacity() const;
@ -1051,6 +1067,18 @@ protected:
int metric( int ) const; int metric( int ) const;
#if defined(TQ_WS_X11)
#if !defined(TQT_NO_IM_EXTENSIONS)
virtual TQWidget *icHolderWidget();
#else
TQWidget *icHolderWidget();
#endif
TQInputContext *getInputContext();
void changeInputContext( const TQString & );
void sendMouseEventToInputContext( int x, TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState state );
#endif
void resetInputContext(); void resetInputContext();
virtual void create( WId = 0, bool initializeWindow = TRUE, virtual void create( WId = 0, bool initializeWindow = TRUE,
@ -1082,14 +1110,25 @@ protected:
private Q_SLOTS: private Q_SLOTS:
void focusProxyDestroyed(); void focusProxyDestroyed();
#if defined(TQ_WS_X11)
void destroyInputContext();
#endif
private: private:
void setFontSys( TQFont *f = 0 ); void setFontSys( TQFont *f = 0 );
#if defined(TQ_WS_X11) #if defined(TQ_WS_X11)
void createInputContext(); void createInputContext();
void destroyInputContext();
void focusInputContext(); void focusInputContext();
void unfocusInputContext();
void checkChildrenDnd(); void checkChildrenDnd();
#ifndef TQT_NO_XSYNC
void createSyncCounter();
void destroySyncCounter();
void incrementSyncCounter();
void handleSyncRequest( void* ev );
#endif
#elif defined(TQ_WS_MAC) #elif defined(TQ_WS_MAC)
uint own_id : 1, macDropEnabled : 1; uint own_id : 1, macDropEnabled : 1;
EventHandlerRef window_event; EventHandlerRef window_event;
@ -1159,6 +1198,9 @@ private:
TQFont fnt; TQFont fnt;
#ifndef TQT_NO_LAYOUT #ifndef TQT_NO_LAYOUT
TQLayout *lay_out; TQLayout *lay_out;
#endif
#if defined(TQ_WS_X11) && !defined(TQT_NO_IM) && !defined(TQT_NO_IM_EXTENSIONS)
TQInputContext *ic; // Input Context
#endif #endif
TQWExtra *extra; TQWExtra *extra;
#if defined(TQ_WS_TQWS) #if defined(TQ_WS_TQWS)
@ -1471,7 +1513,13 @@ struct TQ_EXPORT TQTLWExtra {
uint dnd : 1; // DND properties installed uint dnd : 1; // DND properties installed
uint uspos : 1; // User defined position uint uspos : 1; // User defined position
uint ussize : 1; // User defined size uint ussize : 1; // User defined size
void *xic; // XIM Input Context #if defined(TQT_NO_IM_EXTENSIONS)
void *xic; // Input Context
#endif
#ifndef TQT_NO_XSYNC
ulong syncCounter;
uint syncRequestValue[2];
#endif
#endif #endif
#if defined(TQ_WS_MAC) #if defined(TQ_WS_MAC)
WindowGroupRef group; WindowGroupRef group;

@ -83,6 +83,11 @@ extern Atom qt_net_wm_window_type_menu;
extern Atom qt_net_wm_window_type_utility; extern Atom qt_net_wm_window_type_utility;
extern Atom qt_net_wm_window_type_splash; extern Atom qt_net_wm_window_type_splash;
extern Atom qt_net_wm_window_type_override; extern Atom qt_net_wm_window_type_override;
extern Atom qt_net_wm_window_type_dropdown_menu;
extern Atom qt_net_wm_window_type_popup_menu;
extern Atom qt_net_wm_window_type_combo;
extern Atom qt_net_wm_window_type_dnd;
extern Atom qt_net_wm_window_type_tooltip;
extern Atom qt_net_wm_pid; extern Atom qt_net_wm_pid;
extern Atom qt_net_wm_user_time; extern Atom qt_net_wm_user_time;
extern Atom qt_enlightenment_desktop; extern Atom qt_enlightenment_desktop;
@ -300,11 +305,9 @@ int qt_sip_count( TQWidget* );
bool qt_wstate_iconified( WId ); bool qt_wstate_iconified( WId );
void qt_updated_rootinfo(); void qt_updated_rootinfo();
#ifndef TQT_NO_XIM #ifndef TQT_NO_IM
#include "tqinputcontext_p.h" #include "tqinputcontext.h"
#include "tqinputcontextfactory.h"
extern XIM qt_xim;
extern XIMStyle qt_xim_style;
#endif #endif
// Paint event clipping magic // Paint event clipping magic
@ -322,6 +325,12 @@ extern bool qt_deferred_map_tqcontains(TQWidget *);
static TQWidget *mouseGrb = 0; static TQWidget *mouseGrb = 0;
static TQWidget *keyboardGrb = 0; static TQWidget *keyboardGrb = 0;
#ifndef TQT_NO_XSYNC
extern Atom qt_net_wm_sync_request_counter;
extern Atom qt_net_wm_sync_request;
extern bool qt_use_xsync;
#endif
// defined in qfont_x11.cpp // defined in qfont_x11.cpp
extern bool qt_has_xft; extern bool qt_has_xft;
@ -683,10 +692,6 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
x11Colormap() ); x11Colormap() );
#endif // TQT_NO_XFTFREETYPE #endif // TQT_NO_XFTFREETYPE
// NET window types
long net_wintypes[7] = { 0, 0, 0, 0, 0, 0, 0 };
int curr_wintype = 0;
// NET window states // NET window states
long net_winstates[6] = { 0, 0, 0, 0, 0, 0 }; long net_winstates[6] = { 0, 0, 0, 0, 0, 0 };
int curr_winstate = 0; int curr_winstate = 0;
@ -708,7 +713,6 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
if ( testWFlags(WStyle_Splash) ) { if ( testWFlags(WStyle_Splash) ) {
if (qt_net_supports(qt_net_wm_window_type_splash)) { if (qt_net_supports(qt_net_wm_window_type_splash)) {
clearWFlags( WX11BypassWM ); clearWFlags( WX11BypassWM );
net_wintypes[curr_wintype++] = qt_net_wm_window_type_splash;
} else { } else {
setWFlags( WX11BypassWM | WStyle_Tool | WStyle_NoBorder ); setWFlags( WX11BypassWM | WStyle_Tool | WStyle_NoBorder );
} }
@ -717,27 +721,22 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
mwmhints.decorations = 0L; mwmhints.decorations = 0L;
mwmhints.flags |= (1L << 1); // MWM_HINTS_DECORATIONS mwmhints.flags |= (1L << 1); // MWM_HINTS_DECORATIONS
if ( testWFlags( WStyle_NoBorder ) ) { if ( testWFlags( WStyle_NormalBorder | WStyle_DialogBorder ) ) {
// override netwm type - quick and easy for KDE noborder mwmhints.decorations |= (1L << 1); // MWM_DECOR_BORDER
net_wintypes[curr_wintype++] = qt_net_wm_window_type_override; mwmhints.decorations |= (1L << 2); // MWM_DECOR_RESIZEH
} else { }
if ( testWFlags( WStyle_NormalBorder | WStyle_DialogBorder ) ) {
mwmhints.decorations |= (1L << 1); // MWM_DECOR_BORDER
mwmhints.decorations |= (1L << 2); // MWM_DECOR_RESIZEH
}
if ( testWFlags( WStyle_Title ) ) if ( testWFlags( WStyle_Title ) )
mwmhints.decorations |= (1L << 3); // MWM_DECOR_TITLE mwmhints.decorations |= (1L << 3); // MWM_DECOR_TITLE
if ( testWFlags( WStyle_SysMenu ) ) if ( testWFlags( WStyle_SysMenu ) )
mwmhints.decorations |= (1L << 4); // MWM_DECOR_MENU mwmhints.decorations |= (1L << 4); // MWM_DECOR_MENU
if ( testWFlags( WStyle_Minimize ) ) if ( testWFlags( WStyle_Minimize ) )
mwmhints.decorations |= (1L << 5); // MWM_DECOR_MINIMIZE mwmhints.decorations |= (1L << 5); // MWM_DECOR_MINIMIZE
if ( testWFlags( WStyle_Maximize ) ) if ( testWFlags( WStyle_Maximize ) )
mwmhints.decorations |= (1L << 6); // MWM_DECOR_MAXIMIZE mwmhints.decorations |= (1L << 6); // MWM_DECOR_MAXIMIZE
}
if (testWFlags(WStyle_Tool)) { if (testWFlags(WStyle_Tool)) {
wsa.save_under = True; wsa.save_under = True;
@ -757,23 +756,6 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
} }
} }
// ### need a better way to do this
if (inherits("TQPopupMenu")) {
// menu netwm type
net_wintypes[curr_wintype++] = qt_net_wm_window_type_menu;
} else if (inherits("TQToolBar")) {
// 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;
}
if (dialog) // dialog netwm type
net_wintypes[curr_wintype++] = qt_net_wm_window_type_dialog;
// normal netwm type - default
net_wintypes[curr_wintype++] = qt_net_wm_window_type_normal;
// stays on top // stays on top
if (testWFlags(WStyle_StaysOnTop)) { if (testWFlags(WStyle_StaysOnTop)) {
net_winstates[curr_winstate++] = qt_net_wm_state_above; net_winstates[curr_winstate++] = qt_net_wm_state_above;
@ -808,6 +790,7 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
wsa.save_under = True; wsa.save_under = True;
XChangeWindowAttributes( dpy, id, CWOverrideRedirect | CWSaveUnder, XChangeWindowAttributes( dpy, id, CWOverrideRedirect | CWSaveUnder,
&wsa ); &wsa );
x11SetWindowType();
} else if ( topLevel && !desktop ) { // top-level widget } else if ( topLevel && !desktop ) { // top-level widget
TQWidget *p = parentWidget(); // real tqparent TQWidget *p = parentWidget(); // real tqparent
if (p) if (p)
@ -851,11 +834,14 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
XResizeWindow( dpy, id, crect.width(), crect.height() ); XResizeWindow( dpy, id, crect.width(), crect.height() );
XStoreName( dpy, id, tqAppName() ); XStoreName( dpy, id, tqAppName() );
Atom protocols[4]; Atom protocols[5];
int n = 0; int n = 0;
protocols[n++] = qt_wm_delete_window; // support del window protocol protocols[n++] = qt_wm_delete_window; // support del window protocol
protocols[n++] = qt_wm_take_focus; // support take focus window protocol protocols[n++] = qt_wm_take_focus; // support take focus window protocol
protocols[n++] = qt_net_wm_ping; // support _NET_WM_PING protocol protocols[n++] = qt_net_wm_ping; // support _NET_WM_PING protocol
#ifndef TQT_NO_XSYNC
protocols[n++] = qt_net_wm_sync_request;// support the _NET_WM_SYNC_REQUEST protocol
#endif
if ( testWFlags( WStyle_ContextHelp ) ) if ( testWFlags( WStyle_ContextHelp ) )
protocols[n++] = qt_net_wm_context_help; protocols[n++] = qt_net_wm_context_help;
XSetWMProtocols( dpy, id, protocols, n ); XSetWMProtocols( dpy, id, protocols, n );
@ -867,12 +853,7 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
else else
XDeleteProperty(dpy, id, qt_xa_motif_wm_hints); XDeleteProperty(dpy, id, qt_xa_motif_wm_hints);
// set _NET_WM_WINDOW_TYPE x11SetWindowType();
if (curr_wintype > 0)
XChangeProperty(dpy, id, qt_net_wm_window_type, XA_ATOM, 32, PropModeReplace,
(unsigned char *) net_wintypes, curr_wintype);
else
XDeleteProperty(dpy, id, qt_net_wm_window_type);
// set _NET_WM_WINDOW_STATE // set _NET_WM_WINDOW_STATE
if (curr_winstate > 0) if (curr_winstate > 0)
@ -886,6 +867,14 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
XChangeProperty(dpy, id, qt_net_wm_pid, XA_CARDINAL, 32, PropModeReplace, XChangeProperty(dpy, id, qt_net_wm_pid, XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &curr_pid, 1); (unsigned char *) &curr_pid, 1);
#ifndef TQT_NO_XSYNC
// set _NET_WM_SYNC_COUNTER
createSyncCounter();
long counterVal = topData()->syncCounter;
XChangeProperty( dpy, id, qt_net_wm_sync_request_counter, XA_CARDINAL, 32, PropModeReplace,
(unsigned char*) &counterVal, 1);
#endif
// when we create a toplevel widget, the frame strut should be dirty // when we create a toplevel widget, the frame strut should be dirty
fstrut_dirty = 1; fstrut_dirty = 1;
@ -923,6 +912,10 @@ void TQWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
if ( destroyw ) if ( destroyw )
qt_XDestroyWindow( this, dpy, destroyw ); qt_XDestroyWindow( this, dpy, destroyw );
#if !defined(TQT_NO_IM_EXTENSIONS)
ic = 0;
#endif
} }
@ -981,11 +974,24 @@ void TQWidget::destroy( bool destroyWindow, bool destroySubWindows )
if ( destroyWindow ) if ( destroyWindow )
qt_XDestroyWindow( this, x11Display(), winid ); qt_XDestroyWindow( this, x11Display(), winid );
} }
#ifndef TQT_NO_XSYNC
destroySyncCounter();
#endif
setWinId( 0 ); setWinId( 0 );
extern void qPRCleanup( TQWidget *widget ); // from qapplication_x11.cpp extern void qPRCleanup( TQWidget *widget ); // from qapplication_x11.cpp
if ( testWState(WState_Reparented) ) if ( testWState(WState_Reparented) )
qPRCleanup(this); qPRCleanup(this);
if( this == icHolderWidget() ) {
destroyInputContext();
} else {
// release previous focus information participating with
// preedit preservation of qic
TQInputContext *qic = getInputContext();
if ( qic )
qic->releaseComposingWidget( this );
}
} }
} }
@ -1022,14 +1028,18 @@ void TQWidget::reparentSys( TQWidget *tqparent, WFlags f, const TQPoint &p, bool
XReparentWindow( x11Display(), old_winid, XReparentWindow( x11Display(), old_winid,
RootWindow( x11Display(), x11Screen() ), 0, 0 ); RootWindow( x11Display(), x11Screen() ), 0, 0 );
if ( isTopLevel() ) { if ( this == icHolderWidget() ) {
// input contexts are associated with toplevel widgets, so we need // input contexts are sometimes associated with toplevel widgets, so
// destroy the context here. if we are reparenting back to toplevel, // we need destroy the context here. if we are reparenting back to
// then we will have another context created, otherwise we will // toplevel, then we may have another context created, otherwise we
// use our new toplevel's context // will use our new ic holder's context
destroyInputContext(); destroyInputContext();
} }
#ifndef TQT_NO_XSYNC
destroySyncCounter();
#endif
if ( isTopLevel() || !tqparent ) // we are toplevel, or reparenting to toplevel if ( isTopLevel() || !tqparent ) // we are toplevel, or reparenting to toplevel
topData()->parentWinId = 0; topData()->parentWinId = 0;
@ -1131,6 +1141,64 @@ void TQWidget::reparentSys( TQWidget *tqparent, WFlags f, const TQPoint &p, bool
setMouseTracking(mouse_tracking); setMouseTracking(mouse_tracking);
} }
// 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);
}
void TQWidget::x11SetWindowTransient( TQWidget* tqparent )
{
XSetTransientForHint( x11Display(), winId(), tqparent->winId());
}
/*! /*!
Translates the widget coordinate \a pos to global screen Translates the widget coordinate \a pos to global screen
@ -1182,7 +1250,8 @@ TQPoint TQWidget::mapFromGlobal( const TQPoint &pos ) const
language input systems. language input systems.
In the X11 version of TQt, if \a text is TRUE, this method sets the In the X11 version of TQt, if \a text is TRUE, this method sets the
XIM "spot" point for complex language input handling. input method focus point in the preedit (XIM "spot" point) for
complex language input handling.
The font \a f is a rendering hint to the currently active input method. The font \a f is a rendering hint to the currently active input method.
If \a f is 0 the widget's font is used. If \a f is 0 the widget's font is used.
@ -1192,22 +1261,15 @@ TQPoint TQWidget::mapFromGlobal( const TQPoint &pos ) const
void TQWidget::setMicroFocusHint(int x, int y, int width, int height, void TQWidget::setMicroFocusHint(int x, int y, int width, int height,
bool text, TQFont *f ) bool text, TQFont *f )
{ {
#ifndef TQT_NO_XIM #ifndef TQT_NO_IM
if ( text ) { if ( text ) {
TQWidget* tlw = tqtopLevelWidget();
TQTLWExtra *topdata = tlw->topData();
// trigger input context creation if it hasn't happened already // trigger input context creation if it hasn't happened already
createInputContext(); createInputContext();
TQInputContext *qic = (TQInputContext *) topdata->xic;
TQInputContext *qic = getInputContext();
if ( qt_xim && qic ) { if(qic) {
TQPoint p( x, y ); TQPoint gp = mapToGlobal( TQPoint( x, y ) );
TQPoint p2 = mapTo( tqtopLevelWidget(), TQPoint( 0, 0 ) ); qic->setMicroFocus(gp.x(), gp.y(), width, height, f);
p = mapTo( tqtopLevelWidget(), p);
qic->setXFontSet( f ? *f : fnt );
qic->setComposePosition(p.x(), p.y() + height);
qic->setComposeArea(p2.x(), p2.y(), this->width(), this->height());
} }
} }
#endif #endif
@ -2659,13 +2721,21 @@ void TQWidget::deleteSysExtra()
void TQWidget::createTLSysExtra() void TQWidget::createTLSysExtra()
{ {
#if defined(TQT_NO_IM_EXTENSIONS)
// created lazily // created lazily
extra->topextra->xic = 0; extra->topextra->xic = 0;
#endif
#ifndef TQT_NO_XSYNC
extra->topextra->syncCounter = 0;
extra->topextra->syncRequestValue[0] = 0;
extra->topextra->syncRequestValue[1] = 0;
#endif
} }
void TQWidget::deleteTLSysExtra() void TQWidget::deleteTLSysExtra()
{ {
destroyInputContext(); // don't destroy input context here. it will be destroyed in
// TQWidget::destroy() destroyInputContext();
} }
/* /*
@ -2706,6 +2776,51 @@ void TQWidget::checkChildrenDnd()
} }
} }
#ifndef TQT_NO_XSYNC
// create a window's XSyncCounter
void TQWidget::createSyncCounter()
{
if( !qt_use_xsync || !isTopLevel() || topData()->syncCounter )
return;
XSyncValue zero;
XSyncIntToValue( &zero, 0 );
topData()->syncCounter = XSyncCreateCounter( x11Display(), zero );
}
// destroy a window's XSyncCounter
void TQWidget::destroySyncCounter()
{
if( !qt_use_xsync || !extra || !extra->topextra
|| !extra->topextra->syncCounter )
return;
XSyncDestroyCounter( x11Display(), extra->topextra->syncCounter );
extra->topextra->syncCounter = 0;
}
// increment a window's XSyncCounter
void TQWidget::incrementSyncCounter()
{
if( qt_use_xsync && topData()->syncCounter &&
!(topData()->syncRequestValue[0] == 0 &&
topData()->syncRequestValue[1] == 0) ) {
XSyncValue val;
XSyncIntsToValue( &val, topData()->syncRequestValue[ 0 ], topData()->syncRequestValue[ 1 ] );
XSyncSetCounter( x11Display(), topData()->syncCounter, val );
topData()->syncRequestValue[0] = topData()->syncRequestValue[1] = 0;
}
}
// handle _NET_WM_SYNC_REQUEST
void TQWidget::handleSyncRequest( void* ev )
{
XEvent* xev = (XEvent*)ev;
topData()->syncRequestValue[ 0 ] = xev->xclient.data.l[ 2 ];
topData()->syncRequestValue[ 1 ] = xev->xclient.data.l[ 3 ];
}
#endif // TQT_NO_XSYNC
/*! /*!
\property TQWidget::acceptDrops \property TQWidget::acceptDrops
\brief whether drop events are enabled for this widget \brief whether drop events are enabled for this widget
@ -2897,77 +3012,257 @@ void TQWidget::updateFrameStrut() const
} }
/*!
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()
{
return tqApp->locateICHolderWidget(this);
}
/*!
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()
{
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;
}
/*!
This function replaces the TQInputContext instance used for text
input to this widget. The \a identifierName is the identifier name
of newly choosed input method.
*/
void TQWidget::changeInputContext( const TQString& identifierName )
{
TQWidget *icWidget = icHolderWidget();
#if !defined(TQT_NO_IM_EXTENSIONS)
TQInputContext **qicp = &icWidget->ic;
#else
TQInputContext **qicp = (TQInputContext **)&icWidget->topData()->xic;
#endif
if( *qicp )
delete *qicp;
// an input context that has the identifierName is generated.
TQInputContext *qic = TQInputContextFactory::create( identifierName, icWidget );
*qicp = qic;
if ( qic ) {
TQObject::connect( qic, TQT_SIGNAL(imEventGenerated(TQObject *,TQIMEvent *)),
tqApp, TQT_SLOT(postIMEvent(TQObject *,TQIMEvent *)) );
TQObject::connect( qic, TQT_SIGNAL(deletionRequested()),
icWidget, TQT_SLOT(destroyInputContext()) );
}
}
/*!
\internal
This is an internal function, you should never call this.
This function is called to generate an input context
according to a configuration for default input method
When TQT_NO_IM_EXTENSIONS is not set, input context is
generated only when isInputMethodEnabled() returns TRUE.
*/
void TQWidget::createInputContext() void TQWidget::createInputContext()
{ {
TQWidget *tlw = tqtopLevelWidget(); // #if !defined(TQT_NO_IM_EXTENSIONS)
TQTLWExtra *topdata = tlw->topData(); if( !isInputMethodEnabled() || TQApplication::closingDown() )
return;
// #endif
#ifndef TQT_NO_XIM TQWidget *icWidget = icHolderWidget();
if (qt_xim) { #ifndef TQT_NO_IM
if (! topdata->xic) { #if !defined(TQT_NO_IM_EXTENSIONS)
TQInputContext *qic = new TQInputContext(tlw); TQInputContext **qicp = &icWidget->ic;
topdata->xic = (void *) qic; #else
} TQInputContext **qicp = (TQInputContext **)&icWidget->topData()->xic;
} else #endif
#endif // TQT_NO_XIM
{ if ( ! *qicp ) {
// qDebug("TQWidget::createInputContext: no xim"); // an input context of the default input method is generated.
topdata->xic = 0; TQInputContext *qic = TQInputContextFactory::create( TQApplication::defaultInputMethod(), icWidget );
}
*qicp = qic;
if ( qic ) {
TQObject::connect( qic, TQT_SIGNAL(imEventGenerated(TQObject *,TQIMEvent *)),
tqApp, TQT_SLOT(postIMEvent(TQObject *,TQIMEvent *)) );
TQObject::connect( qic, TQT_SIGNAL(deletionRequested()),
icWidget, TQT_SLOT(destroyInputContext()) );
}
}
#endif // TQT_NO_IM
} }
/*!
\internal
This slot is used to destroy the input context that belonging
to the widget itself, so icHolderWidget()->ic is not fetched.
\sa TQInputContext::deletionRequested()
*/
void TQWidget::destroyInputContext() void TQWidget::destroyInputContext()
{ {
#ifndef TQT_NO_XIM #ifndef TQT_NO_IM
TQInputContext *qic = (TQInputContext *) extra->topextra->xic; #if !defined(TQT_NO_IM_EXTENSIONS)
delete qic; TQInputContext **qicp = &ic;
#endif // TQT_NO_XIM #else
extra->topextra->xic = 0; if ( ! extra || ! extra->topextra )
return;
TQInputContext **qicp = (TQInputContext **)&extra->topextra->xic;
#endif
if( *qicp )
delete *qicp;
*qicp = 0;
#endif // TQT_NO_IM
} }
/*! /*!
This function is called when the user finishes input composition, This function is called when text widgets need to be neutral state to
e.g. changes focus to another widget, moves the cursor, etc. execute text operations properly. See qlineedit.cpp and qtextedit.cpp as
example.
Ordinary reset that along with changing focus to another widget,
moving the cursor, etc, is implicitly handled via
unfocusInputContext() because whether reset or not when such
situation is a responsibility of input methods. So we delegate the
responsibility to the input context via unfocusInputContext(). See
'Preedit preservation' section of the class description of
TQInputContext for further information.
\sa TQInputContext, unfocusInputContext(), TQInputContext::unsetFocus()
*/ */
void TQWidget::resetInputContext() void TQWidget::resetInputContext()
{ {
#ifndef TQT_NO_XIM #ifndef TQT_NO_IM
if ((qt_xim_style & XIMPreeditCallbacks) && hasFocus()) { // trigger input context creation if it hasn't happened already
TQWidget *tlw = tqtopLevelWidget(); createInputContext();
TQTLWExtra *topdata = tlw->topData();
TQInputContext *qic = getInputContext();
if( qic )
qic->reset();
#endif // TQT_NO_IM
}
/*!
\internal
This is an internal function, you should never call this.
This function is called to focus associated input context. The
code intends to eliminate duplicate focus for the context even if
the context is shared between widgets
\sa TQInputContext::setFocus()
*/
void TQWidget::focusInputContext()
{
#ifndef TQT_NO_IM
TQWidget* tlw = tqtopLevelWidget();
if (!tlw->isPopup() || isInputMethodEnabled()) {
// trigger input context creation if it hasn't happened already // trigger input context creation if it hasn't happened already
createInputContext(); createInputContext();
if (topdata->xic) { TQInputContext *qic = getInputContext();
TQInputContext *qic = (TQInputContext *) topdata->xic; if ( qic ) {
qic->reset(); if( qic->tqfocusWidget() != this ) {
qic->setFocusWidget( this );
qic->setFocus();
}
} }
} }
#endif // TQT_NO_XIM #endif // TQT_NO_IM
} }
void TQWidget::focusInputContext() /*!
\internal
This is an internal function, you should never call this.
This function is called to remove focus from associated input
context.
\sa TQInputContext::unsetFocus()
*/
void TQWidget::unfocusInputContext()
{ {
#ifndef TQT_NO_XIM #ifndef TQT_NO_IM
TQWidget *tlw = tqtopLevelWidget(); // trigger input context creation if it hasn't happened already
if (!tlw->isPopup() || isInputMethodEnabled()) { createInputContext();
TQTLWExtra *topdata = tlw->topData();
// trigger input context creation if it hasn't happened already TQInputContext *qic = getInputContext();
createInputContext(); if ( qic ) {
// may be caused reset() in some input methods
qic->unsetFocus();
qic->setFocusWidget( 0 );
}
#endif // TQT_NO_IM
}
if (topdata->xic) {
TQInputContext *qic = (TQInputContext *) topdata->xic; /*!
qic->setFocus(); This function is called to send mouse event to associated input
} context by derived text widgets. A derived text widget must be
calculate \a x as character offset at the mouse cursor in the
preedit.
\sa TQInputContext::mouseHandler()
*/
void TQWidget::sendMouseEventToInputContext( int x, TQEvent::Type type,
TQt::ButtonState button,
TQt::ButtonState state )
{
#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_XIM #endif // TQT_NO_IM
} }
void TQWidget::setWindowOpacity(double) void TQWidget::setWindowOpacity(double)
{ {
} }

@ -128,7 +128,7 @@ bool qt_resolve_gl_symbols(bool fatal)
if (gl_syms_resolved) if (gl_syms_resolved)
return TRUE; return TRUE;
TQLibrary gl("GL"); TQLibrary gl("GL.so.1");
gl.setAutoUnload(FALSE); gl.setAutoUnload(FALSE);
qt_glCallLists = (_glCallLists) gl.resolve("glCallLists"); qt_glCallLists = (_glCallLists) gl.resolve("glCallLists");
@ -286,7 +286,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
typedef Status (*_XmuLookupStandardColormap)( Display *dpy, int screen, VisualID visualid, unsigned int depth, typedef Status (*_XmuLookupStandardColormap)( Display *dpy, int screen, VisualID visualid, unsigned int depth,
Atom property, Bool tqreplace, Bool retain ); Atom property, Bool tqreplace, Bool retain );
_XmuLookupStandardColormap qt_XmuLookupStandardColormap; _XmuLookupStandardColormap qt_XmuLookupStandardColormap;
qt_XmuLookupStandardColormap = (_XmuLookupStandardColormap) TQLibrary::resolve("Xmu", "XmuLookupStandardColormap"); qt_XmuLookupStandardColormap = (_XmuLookupStandardColormap) TQLibrary::resolve("Xmu.so.6", "XmuLookupStandardColormap");
if (!qt_XmuLookupStandardColormap) if (!qt_XmuLookupStandardColormap)
qFatal("Unable to resolve Xmu symbols - please check your Xmu library installation."); qFatal("Unable to resolve Xmu symbols - please check your Xmu library installation.");
#define XmuLookupStandardColormap qt_XmuLookupStandardColormap #define XmuLookupStandardColormap qt_XmuLookupStandardColormap

@ -38,6 +38,7 @@ OPENGL_CPP = opengl
TOOLS_CPP = tools TOOLS_CPP = tools
CODECS_CPP = codecs CODECS_CPP = codecs
WORKSPACE_CPP = workspace WORKSPACE_CPP = workspace
INPUTMETHOD_CPP = inputmethod
XML_CPP = xml XML_CPP = xml
STYLES_CPP = styles STYLES_CPP = styles
EMBEDDED_CPP = embedded EMBEDDED_CPP = embedded
@ -55,6 +56,7 @@ win32 {
TOOLS_H = $$TOOLS_CPP TOOLS_H = $$TOOLS_CPP
CODECS_H = $$CODECS_CPP CODECS_H = $$CODECS_CPP
WORKSPACE_H = $$WORKSPACE_CPP WORKSPACE_H = $$WORKSPACE_CPP
#INPUTMETHOD_H = $$INPUTMETHOD_CPP
XML_H = $$XML_CPP XML_H = $$XML_CPP
CANVAS_H = $$CANVAS_CPP CANVAS_H = $$CANVAS_CPP
STYLES_H = $$STYLES_CPP STYLES_H = $$STYLES_CPP
@ -71,6 +73,7 @@ win32 {
TOOLS_H = $$WIN_ALL_H TOOLS_H = $$WIN_ALL_H
CODECS_H = $$WIN_ALL_H CODECS_H = $$WIN_ALL_H
WORKSPACE_H = $$WIN_ALL_H WORKSPACE_H = $$WIN_ALL_H
#INPUTMETHOD_H = $$WIN_ALL_H
XML_H = $$WIN_ALL_H XML_H = $$WIN_ALL_H
CANVAS_H = $$WIN_ALL_H CANVAS_H = $$WIN_ALL_H
STYLES_H = $$WIN_ALL_H STYLES_H = $$WIN_ALL_H
@ -99,6 +102,7 @@ unix {
TOOLS_H = $$TOOLS_CPP TOOLS_H = $$TOOLS_CPP
CODECS_H = $$CODECS_CPP CODECS_H = $$CODECS_CPP
WORKSPACE_H = $$WORKSPACE_CPP WORKSPACE_H = $$WORKSPACE_CPP
INPUTMETHOD_H = $$INPUTMETHOD_CPP
XML_H = $$XML_CPP XML_H = $$XML_CPP
STYLES_H = $$STYLES_CPP STYLES_H = $$STYLES_CPP
!embedded:!mac:CONFIG += x11 x11inc !embedded:!mac:CONFIG += x11 x11inc
@ -114,7 +118,7 @@ embedded {
EMBEDDED_H = $$EMBEDDED_CPP EMBEDDED_H = $$EMBEDDED_CPP
} }
DEPENDPATH += ;$$NETWORK_H;$$KERNEL_H;$$WIDGETS_H;$$SQL_H;$$TABLE_H;$$DIALOGS_H; DEPENDPATH += ;$$NETWORK_H;$$KERNEL_H;$$WIDGETS_H;$$INPUTMETHOD_H;$$SQL_H;$$TABLE_H;$$DIALOGS_H;
DEPENDPATH += $$ICONVIEW_H;$$OPENGL_H;$$TOOLS_H;$$CODECS_H;$$WORKSPACE_H;$$XML_H; DEPENDPATH += $$ICONVIEW_H;$$OPENGL_H;$$TOOLS_H;$$CODECS_H;$$WORKSPACE_H;$$XML_H;
DEPENDPATH += $$CANVAS_H;$$STYLES_H DEPENDPATH += $$CANVAS_H;$$STYLES_H
embedded:DEPENDPATH += ;$$EMBEDDED_H embedded:DEPENDPATH += ;$$EMBEDDED_H
@ -149,6 +153,7 @@ include($$WIDGETS_CPP/qt_widgets.pri)
include($$DIALOGS_CPP/qt_dialogs.pri) include($$DIALOGS_CPP/qt_dialogs.pri)
include($$ICONVIEW_CPP/qt_iconview.pri) include($$ICONVIEW_CPP/qt_iconview.pri)
include($$WORKSPACE_CPP/qt_workspace.pri) include($$WORKSPACE_CPP/qt_workspace.pri)
include($$INPUTMETHOD_CPP/qt_inputmethod.pri)
include($$NETWORK_CPP/qt_network.pri) include($$NETWORK_CPP/qt_network.pri)
include($$CANVAS_CPP/qt_canvas.pri) include($$CANVAS_CPP/qt_canvas.pri)
include($$TABLE_CPP/qt_table.pri) include($$TABLE_CPP/qt_table.pri)
@ -176,6 +181,16 @@ unix {
QMAKE_PKGCONFIG_INCDIR = $$headers.path QMAKE_PKGCONFIG_INCDIR = $$headers.path
} }
unix {
# Debian - compile __debian_export_symbols.cpp with -fno-inline
debian_no_inline.output = .obj/${TQMAKE_FILE_BASE}.o
debian_no_inline.commands = $(CXX) -c $(CXXFLAGS) $(INCPATH) -fno-inline ${TQMAKE_FILE_NAME} -o ${TQMAKE_FILE_OUT}
debian_no_inline.input = DEBIAN_NO_INLINE
TQMAKE_EXTRA_UNIX_COMPILERS += debian_no_inline
DEBIAN_NO_INLINE = __debian_export_symbols.cpp
}
wince-* { wince-* {
CONFIG -= incremental CONFIG -= incremental
message( ...removing plugin stuff... (not permanent) ) message( ...removing plugin stuff... (not permanent) )

@ -767,7 +767,7 @@ TQIBaseDriver::TQIBaseDriver(void *connection, TQObject *tqparent, const char *n
: TQSqlDriver(tqparent, name ? name : TQIBASE_DRIVER_NAME) : TQSqlDriver(tqparent, name ? name : TQIBASE_DRIVER_NAME)
{ {
d = new TQIBaseDriverPrivate(this); d = new TQIBaseDriverPrivate(this);
d->ibase = (isc_db_handle)connection; d->ibase = (isc_db_handle)(long int)connection;
setOpen(TRUE); setOpen(TRUE);
setOpenError(FALSE); setOpenError(FALSE);
} }

@ -188,7 +188,7 @@ sql {
SOURCES += $$SQL_CPP/drivers/ibase/tqsql_ibase.cpp SOURCES += $$SQL_CPP/drivers/ibase/tqsql_ibase.cpp
DEFINES += TQT_SQL_IBASE DEFINES += TQT_SQL_IBASE
unix { unix {
LIBS *= -lgds LIBS *= -lfbclient
} }
win32 { win32 {
!win32-borland:LIBS *= gds32_ms.lib !win32-borland:LIBS *= gds32_ms.lib

@ -74,6 +74,20 @@ TQString TQDir::homeDirPath()
TQString TQDir::canonicalPath() const TQString TQDir::canonicalPath() const
{ {
TQString r; TQString r;
#if defined(__GLIBC__) && !defined(PATH_MAX)
char *cur = ::get_current_dir_name();
if ( cur ) {
char *tmp = canonicalize_file_name( TQFile::encodeName( dPath ).data() );
if ( tmp ) {
r = TQFile::decodeName( tmp );
free( tmp );
}
slashify( r );
// always make sure we go back to the current dir
::chdir( cur );
free( cur );
}
#else
char cur[PATH_MAX+1]; char cur[PATH_MAX+1];
if ( ::getcwd( cur, PATH_MAX ) ) { if ( ::getcwd( cur, PATH_MAX ) ) {
char tmp[PATH_MAX+1]; char tmp[PATH_MAX+1];
@ -86,6 +100,7 @@ TQString TQDir::canonicalPath() const
// always make sure we go back to the current dir // always make sure we go back to the current dir
::chdir( cur ); ::chdir( cur );
} }
#endif /* __GLIBC__ && !PATH_MAX */
return r; return r;
} }
@ -147,9 +162,17 @@ TQString TQDir::currentDirPath()
struct stat st; struct stat st;
if ( ::stat( ".", &st ) == 0 ) { if ( ::stat( ".", &st ) == 0 ) {
#if defined(__GLIBC__) && !defined(PATH_MAX)
char *currentName = ::get_current_dir_name();
if ( currentName ) {
result = TQFile::decodeName(currentName);
free( currentName );
}
#else
char currentName[PATH_MAX+1]; char currentName[PATH_MAX+1];
if ( ::getcwd( currentName, PATH_MAX ) ) if ( ::getcwd( currentName, PATH_MAX ) )
result = TQFile::decodeName(currentName); result = TQFile::decodeName(currentName);
#endif /* __GLIBC__ && !PATH_MAX */
#if defined(TQT_DEBUG) #if defined(TQT_DEBUG)
if ( result.isNull() ) if ( result.isNull() )
qWarning( "TQDir::currentDirPath: getcwd() failed" ); qWarning( "TQDir::currentDirPath: getcwd() failed" );

@ -982,3 +982,13 @@
#define TQT_NO_WORKSPACE #define TQT_NO_WORKSPACE
#endif #endif
// Input method
#if !defined(TQT_NO_IM) && (defined(TQT_NO_STRINGLIST))
#define TQT_NO_IM
#endif
// Input method extensions
#if !defined(TQT_NO_IM_EXTENSIONS) && (defined(TQT_NO_IM) || defined(TQT_NO_STRINGLIST))
#define TQT_NO_IM_EXTENSIONS
#endif

@ -48,6 +48,9 @@
#if !defined(TQWS) && defined(TQ_OS_MAC) #if !defined(TQWS) && defined(TQ_OS_MAC)
# include <tqt_mac.h> # include <tqt_mac.h>
#endif #endif
#if defined(Q_OS_HURD)
# include <stdlib.h>
#endif
void TQFileInfo::slashify( TQString& ) void TQFileInfo::slashify( TQString& )
{ {
@ -127,16 +130,43 @@ bool TQFileInfo::isSymLink() const
TQString TQFileInfo::readLink() const TQString TQFileInfo::readLink() const
{ {
if ( !isSymLink() )
return TQString();
#if defined(TQ_OS_UNIX) && !defined(TQ_OS_OS2EMX) #if defined(TQ_OS_UNIX) && !defined(TQ_OS_OS2EMX)
#if defined(__GLIBC__) && !defined(PATH_MAX)
int size = 256;
char *s = NULL, *s2;
while (1)
{
s2 = (char *) realloc (s, size);
if (s2 == NULL) {
free( s );
return TQString();
}
s = s2;
int len = readlink ( TQFile::encodeName(fn).data(), s, size );
if ( len < 0 ) {
free( s );
return TQString();
}
if ( len < size ) {
s[len] = '\0';
TQString str = TQFile::decodeName(s);
free(s);
return str;
}
size *= 2;
}
#else
char s[PATH_MAX+1]; char s[PATH_MAX+1];
if ( !isSymLink() )
return TQString();
int len = readlink( TQFile::encodeName(fn).data(), s, PATH_MAX ); int len = readlink( TQFile::encodeName(fn).data(), s, PATH_MAX );
if ( len >= 0 ) { if ( len >= 0 ) {
s[len] = '\0'; s[len] = '\0';
return TQFile::decodeName(s); return TQFile::decodeName(s);
} }
#endif #endif /* __GLIBC__ && !PATH_MAX */
#endif /* Q_OS_UNIX && !Q_OS_OS2EMX */
#if !defined(TQWS) && defined(TQ_OS_MAC) #if !defined(TQWS) && defined(TQ_OS_MAC)
{ {
FSRef fref; FSRef fref;

@ -115,7 +115,9 @@
# define TQ_OS_ULTRIX # define TQ_OS_ULTRIX
#elif defined(sinix) #elif defined(sinix)
# define TQ_OS_RELIANT # define TQ_OS_RELIANT
#elif defined(__linux__) || defined(__linux) #elif defined(__GNU__)
# define TQ_OS_HURD
#elif defined(__linux__) || defined(__linux) || defined(__GNU__) || defined(__GLIBC__)
# define TQ_OS_LINUX # define TQ_OS_LINUX
#elif defined(__FreeBSD__) || defined(__DragonFly__) #elif defined(__FreeBSD__) || defined(__DragonFly__)
# define TQ_OS_FREEBSD # define TQ_OS_FREEBSD
@ -137,8 +139,6 @@
# define TQ_OS_AIX # define TQ_OS_AIX
#elif defined(__Lynx__) #elif defined(__Lynx__)
# define TQ_OS_LYNX # define TQ_OS_LYNX
#elif defined(__GNU_HURD__)
# define TQ_OS_HURD
#elif defined(__DGUX__) #elif defined(__DGUX__)
# define TQ_OS_DGUX # define TQ_OS_DGUX
#elif defined(__TQNXNTO__) #elif defined(__TQNXNTO__)
@ -318,9 +318,9 @@
TQString bloat. However, gcc 3.4 doesn't allow us to create references to TQString bloat. However, gcc 3.4 doesn't allow us to create references to
members of a packed struct. (Pointers are OK, because then you members of a packed struct. (Pointers are OK, because then you
supposedly know what you are doing.) */ supposedly know what you are doing.) */
# if (defined(__arm__) || defined(__ARMEL__)) && !defined(TQT_TQMOC_CPP) # if (defined(__arm__) || defined(__ARMEL__)) && !defined(__ARM_EABI__) && !defined(TQT_TQMOC_CPP)
# define TQ_PACKED __attribute__ ((packed)) # define TQ_PACKED __attribute__ ((packed))
# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
# define TQ_NO_PACKED_REFERENCE # define TQ_NO_PACKED_REFERENCE
# endif # endif
# endif # endif

@ -429,6 +429,7 @@ TQString TQLibrary::library() const
} else { } else {
tmpfilename = TQString( "lib%1" ).arg( filename ); tmpfilename = TQString( "lib%1" ).arg( filename );
} }
if ( !filename.tqcontains(".so") )
tmpfilename += filter; tmpfilename += filter;
if(TQFile::exists(tmpfilename) || it == filters.end()) { if(TQFile::exists(tmpfilename) || it == filters.end()) {
filename = tmpfilename; filename = tmpfilename;

@ -125,13 +125,24 @@ static inline double nan()
#endif #endif
// We can't rely on -NAN, since all operations on a NAN should return a NAN. // We can't rely on -NAN, since all operations on a NAN should return a NAN.
static double be_neg_nan;
static double le_neg_nan;
static const unsigned char be_neg_nan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; static const unsigned char be_neg_nan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 };
static const unsigned char le_neg_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; static const unsigned char le_neg_nan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff };
static bool neg_nan_init = false;
static inline double negNan() static inline double negNan()
{ {
if (!neg_nan_init)
{
memcpy(&be_neg_nan,be_neg_nan_bytes,sizeof(be_neg_nan_bytes));
memcpy(&le_neg_nan,le_neg_nan_bytes,sizeof(le_neg_nan_bytes));
neg_nan_init = true;
}
return (ByteOrder == BigEndian ? return (ByteOrder == BigEndian ?
*((const double *) be_neg_nan_bytes) : be_neg_nan :
*((const double *) le_neg_nan_bytes)); le_neg_nan);
} }
// Sizes as defined by the ISO C99 standard - fallback // Sizes as defined by the ISO C99 standard - fallback

@ -60,6 +60,7 @@
#ifndef TQT_NO_STL #ifndef TQT_NO_STL
#include <iterator> #include <iterator>
#include <map> #include <map>
#include <cstddef>
#endif #endif
//#define TQT_CHECK_MAP_RANGE //#define TQT_CHECK_MAP_RANGE

@ -754,7 +754,7 @@ public:
char latin1() const { return ucs > 0xff ? 0 : (char) ucs; } char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
ushort tqunicode() const { return ucs; } ushort tqunicode() const { return ucs; }
#ifdef TQ_NO_PACKED_REFERENCE #ifdef TQ_NO_PACKED_REFERENCE
ushort &tqunicode() { return *(&ucs); } ushort &tqunicode() { return *((ushort*)&ucs); }
#else #else
ushort &tqunicode() { return ucs; } ushort &tqunicode() { return ucs; }
#endif #endif

@ -50,6 +50,7 @@
#ifndef TQT_NO_STL #ifndef TQT_NO_STL
#include <iterator> #include <iterator>
#include <list> #include <list>
#include <cstddef>
#endif #endif
//#define TQT_CHECK_VALUELIST_RANGE //#define TQT_CHECK_VALUELIST_RANGE

@ -184,7 +184,7 @@ inline const TQPixmap *TQButton::pixmap() const
inline bool TQButton::isToggleButton() const inline bool TQButton::isToggleButton() const
{ {
return toggleTyp != SingleShot; return ToggleType(toggleTyp) != SingleShot;
} }
inline bool TQButton::isDown() const inline bool TQButton::isDown() const
@ -194,7 +194,7 @@ inline bool TQButton::isDown() const
inline bool TQButton::isOn() const inline bool TQButton::isOn() const
{ {
return stat != Off; return ToggleState(stat) != Off;
} }
#ifndef TQT_NO_COMPAT #ifndef TQT_NO_COMPAT

@ -392,12 +392,8 @@ public:
inline TQListBox * listBox() { return lBox; } inline TQListBox * listBox() { return lBox; }
inline TQComboBoxPopup * popup() { return pop; } inline TQComboBoxPopup * popup() { return pop; }
void updateLinedGeometry(); void updateLinedGeometry();
void setListBox( TQListBox *l );
void setListBox( TQListBox *l ) { lBox = l ; usingLBox = TRUE; void setPopupMenu( TQComboBoxPopup * pm, bool isPopup=TRUE );
l->setMouseTracking( TRUE );}
void setPopupMenu( TQComboBoxPopup * pm, bool isPopup=TRUE )
{ pop = pm; if(isPopup) usingLBox = FALSE; }
int current; int current;
int maxCount; int maxCount;
@ -443,6 +439,30 @@ void TQComboBoxData::updateLinedGeometry()
ed->setGeometry( r ); ed->setGeometry( r );
} }
void TQComboBoxData::setListBox( TQListBox *l )
{
lBox = l;
usingLBox = TRUE;
l->setMouseTracking( TRUE );
#ifdef TQ_WS_X11
l->x11SetWindowType( TQWidget::X11WindowTypeCombo );
l->x11SetWindowTransient( combo->tqtopLevelWidget());
#endif
}
void TQComboBoxData::setPopupMenu( TQComboBoxPopup * pm, bool isPopup )
{
pop = pm;
if(isPopup)
usingLBox = FALSE;
#ifdef TQ_WS_X11
if( pm ) {
pm->x11SetWindowType( TQWidget::X11WindowTypeCombo );
pm->x11SetWindowTransient( combo->tqtopLevelWidget());
}
#endif
}
static inline bool checkInsertIndex( const char *method, const char * name, static inline bool checkInsertIndex( const char *method, const char * name,
int count, int *index) int count, int *index)
{ {

@ -40,6 +40,12 @@
#include "tqlineedit.h" #include "tqlineedit.h"
#ifndef TQT_NO_LINEEDIT #ifndef TQT_NO_LINEEDIT
// Keep this position to avoid patch rejection
#ifndef TQT_NO_IM
#include "tqinputcontext.h"
#endif
#include "tqpainter.h" #include "tqpainter.h"
#include "tqdrawutil.h" #include "tqdrawutil.h"
#include "tqfontmetrics.h" #include "tqfontmetrics.h"
@ -248,12 +254,17 @@ struct TQLineEditPrivate : public TQt
// input methods // input methods
int imstart, imend, imselstart, imselend; int imstart, imend, imselstart, imselend;
bool composeMode() const { return preeditLength(); }
bool hasIMSelection() const { return imSelectionLength(); }
int preeditLength() const { return ( imend - imstart ); }
int imSelectionLength() const { return ( imselend - imselstart ); }
// complex text tqlayout // complex text tqlayout
TQTextLayout textLayout; TQTextLayout textLayout;
void updateTextLayout(); void updateTextLayout();
void moveCursor( int pos, bool mark = FALSE ); void moveCursor( int pos, bool mark = FALSE );
void setText( const TQString& txt ); void setText( const TQString& txt );
int xToPosInternal( int x, TQTextItem::CursorPosition ) const;
int xToPos( int x, TQTextItem::CursorPosition = TQTextItem::BetweenCharacters ) const; int xToPos( int x, TQTextItem::CursorPosition = TQTextItem::BetweenCharacters ) const;
inline int visualAlignment() const { return tqalignment ? tqalignment : int( isRightToLeft() ? TQt::AlignRight : TQt::AlignLeft ); } inline int visualAlignment() const { return tqalignment ? tqalignment : int( isRightToLeft() ? TQt::AlignRight : TQt::AlignLeft ); }
TQRect cursorRect() const; TQRect cursorRect() const;
@ -591,6 +602,7 @@ void TQLineEdit::setEchoMode( EchoMode mode )
return; return;
d->echoMode = mode; d->echoMode = mode;
d->updateTextLayout(); d->updateTextLayout();
setInputMethodEnabled( mode == Normal );
update(); update();
} }
@ -1422,6 +1434,8 @@ bool TQLineEdit::event( TQEvent * e )
*/ */
void TQLineEdit::mousePressEvent( TQMouseEvent* e ) void TQLineEdit::mousePressEvent( TQMouseEvent* e )
{ {
if ( sendMouseEventToInputContext( e ) )
return;
if ( e->button() == Qt::RightButton ) if ( e->button() == Qt::RightButton )
return; return;
if ( d->tripleClickTimer && ( e->pos() - d->tripleClick ).manhattanLength() < if ( d->tripleClickTimer && ( e->pos() - d->tripleClick ).manhattanLength() <
@ -1451,7 +1465,8 @@ void TQLineEdit::mousePressEvent( TQMouseEvent* e )
*/ */
void TQLineEdit::mouseMoveEvent( TQMouseEvent * e ) void TQLineEdit::mouseMoveEvent( TQMouseEvent * e )
{ {
if ( sendMouseEventToInputContext( e ) )
return;
#ifndef TQT_NO_CURSOR #ifndef TQT_NO_CURSOR
if ( ( e->state() & Qt::MouseButtonMask ) == 0 ) { if ( ( e->state() & Qt::MouseButtonMask ) == 0 ) {
if ( !d->readOnly && d->dragEnabled if ( !d->readOnly && d->dragEnabled
@ -1480,6 +1495,8 @@ void TQLineEdit::mouseMoveEvent( TQMouseEvent * e )
*/ */
void TQLineEdit::mouseReleaseEvent( TQMouseEvent* e ) void TQLineEdit::mouseReleaseEvent( TQMouseEvent* e )
{ {
if ( sendMouseEventToInputContext( e ) )
return;
#ifndef TQT_NO_DRAGANDDROP #ifndef TQT_NO_DRAGANDDROP
if ( e->button() == Qt::LeftButton ) { if ( e->button() == Qt::LeftButton ) {
if ( d->dndTimer ) { if ( d->dndTimer ) {
@ -1506,6 +1523,8 @@ void TQLineEdit::mouseReleaseEvent( TQMouseEvent* e )
*/ */
void TQLineEdit::mouseDoubleClickEvent( TQMouseEvent* e ) void TQLineEdit::mouseDoubleClickEvent( TQMouseEvent* e )
{ {
if ( sendMouseEventToInputContext( e ) )
return;
if ( e->button() == Qt::LeftButton ) { if ( e->button() == Qt::LeftButton ) {
deselect(); deselect();
d->cursor = d->xToPos( e->pos().x() ); d->cursor = d->xToPos( e->pos().x() );
@ -1775,6 +1794,33 @@ void TQLineEdit::keyPressEvent( TQKeyEvent * e )
e->ignore(); e->ignore();
} }
/*!
This function is not intended as polymorphic usage. Just a shared code
fragment that calls TQWidget::sendMouseEventToInputContext() easily for this
class.
*/
bool TQLineEdit::sendMouseEventToInputContext( TQMouseEvent *e )
{
#ifndef TQT_NO_IM
if ( d->composeMode() ) {
int cursor = d->xToPosInternal( e->pos().x(), TQTextItem::OnCharacters );
int mousePos = cursor - d->imstart;
if ( mousePos >= 0 && mousePos < d->preeditLength() ) {
TQWidget::sendMouseEventToInputContext( mousePos, e->type(),
e->button(), e->state() );
} else if ( e->type() != TQEvent::MouseMove ) {
// send button events on out of preedit
TQWidget::sendMouseEventToInputContext( -1, e->type(),
e->button(), e->state() );
}
return TRUE;
}
#endif
return FALSE;
}
/*! \reimp /*! \reimp
*/ */
void TQLineEdit::imStartEvent( TQIMEvent *e ) void TQLineEdit::imStartEvent( TQIMEvent *e )
@ -1841,6 +1887,8 @@ void TQLineEdit::focusInEvent( TQFocusEvent* tqfe )
} }
if( !hasSelectedText() || tqstyle().tqstyleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) if( !hasSelectedText() || tqstyle().tqstyleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) )
d->setCursorVisible( TRUE ); d->setCursorVisible( TRUE );
if ( d->hasIMSelection() )
d->cursor = d->imselstart;
d->updateMicroFocusHint(); d->updateMicroFocusHint();
} }
@ -1934,6 +1982,14 @@ void TQLineEdit::drawContents( TQPainter *p )
} else if (d->hscroll < 0) { } else if (d->hscroll < 0) {
d->hscroll = 0; d->hscroll = 0;
} }
// This updateMicroFocusHint() is corresponding to update() at
// IMCompose event. Although the function is invoked from various
// other points, some situations such as "candidate selection on
// AlignHCenter'ed text" need this invocation because
// updateMicroFocusHint() requires updated contentsRect(), and
// there are no other chances in such situation that invoke the
// function.
d->updateMicroFocusHint();
// the y offset is there to keep the baseline constant in case we have script changes in the text. // the y offset is there to keep the baseline constant in case we have script changes in the text.
TQPoint topLeft = lineRect.topLeft() - TQPoint(d->hscroll, d->ascent-fm.ascent()); TQPoint topLeft = lineRect.topLeft() - TQPoint(d->hscroll, d->ascent-fm.ascent());
@ -1974,7 +2030,7 @@ void TQLineEdit::drawContents( TQPainter *p )
} }
// input method edit area // input method edit area
if ( d->imstart < d->imend && (last >= d->imstart && first < d->imend ) ) { if ( d->composeMode() && (last >= d->imstart && first < d->imend ) ) {
TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imstart - first, 0 ) ), lineRect.top() ), TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imstart - first, 0 ) ), lineRect.top() ),
TQPoint( tix + ti.cursorToX( TQMIN( d->imend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); TQPoint( tix + ti.cursorToX( TQMIN( d->imend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize();
p->save(); p->save();
@ -1987,11 +2043,16 @@ void TQLineEdit::drawContents( TQPainter *p )
imCol.setHsv( h1, s1, ( v1 + v2 ) / 2 ); imCol.setHsv( h1, s1, ( v1 + v2 ) / 2 );
p->fillRect( highlight, imCol ); p->fillRect( highlight, imCol );
p->tqdrawTextItem( topLeft, ti, textflags ); p->tqdrawTextItem( topLeft, ti, textflags );
// draw preedit's underline
if (d->imend - d->imstart > 0) {
p->setPen( cg.text() );
p->drawLine( highlight.bottomLeft(), highlight.bottomRight() );
}
p->restore(); p->restore();
} }
// input method selection // input method selection
if ( d->imselstart < d->imselend && (last >= d->imselstart && first < d->imselend ) ) { if ( d->hasIMSelection() && (last >= d->imselstart && first < d->imselend ) ) {
TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imselstart - first, 0 ) ), lineRect.top() ), TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imselstart - first, 0 ) ), lineRect.top() ),
TQPoint( tix + ti.cursorToX( TQMIN( d->imselend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); TQPoint( tix + ti.cursorToX( TQMIN( d->imselend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize();
p->save(); p->save();
@ -2019,7 +2080,11 @@ void TQLineEdit::drawContents( TQPainter *p )
} }
// draw cursor // draw cursor
if ( d->cursorVisible && !supressCursor ) { //
// Asian users regard IM selection text as cursor on candidate
// selection phase of input method, so ordinary cursor should be
// invisible if IM selection text exists.
if ( d->cursorVisible && !supressCursor && !d->hasIMSelection() ) {
TQPoint from( topLeft.x() + cix, lineRect.top() ); TQPoint from( topLeft.x() + cix, lineRect.top() );
TQPoint to = from + TQPoint( 0, lineRect.height() ); TQPoint to = from + TQPoint( 0, lineRect.height() );
p->drawLine( from, to ); p->drawLine( from, to );
@ -2134,6 +2199,10 @@ enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelect
void TQLineEdit::contextMenuEvent( TQContextMenuEvent * e ) void TQLineEdit::contextMenuEvent( TQContextMenuEvent * e )
{ {
#ifndef TQT_NO_POPUPMENU #ifndef TQT_NO_POPUPMENU
#ifndef TQT_NO_IM
if ( d->composeMode() )
return;
#endif
d->separate(); d->separate();
TQPopupMenu *menu = createPopupMenu(); TQPopupMenu *menu = createPopupMenu();
if (!menu) if (!menu)
@ -2187,6 +2256,13 @@ TQPopupMenu *TQLineEdit::createPopupMenu()
+ ACCEL_KEY( A ) + ACCEL_KEY( A )
#endif #endif
); );
#ifndef TQT_NO_IM
TQInputContext *qic = getInputContext();
if ( qic )
qic->addMenusTo( popup );
#endif
popup->setItemEnabled( id - IdUndo, d->isUndoAvailable() ); popup->setItemEnabled( id - IdUndo, d->isUndoAvailable() );
popup->setItemEnabled( id - IdRedo, d->isRedoAvailable() ); popup->setItemEnabled( id - IdRedo, d->isRedoAvailable() );
#ifndef TQT_NO_CLIPBOARD #ifndef TQT_NO_CLIPBOARD
@ -2320,7 +2396,7 @@ void TQLineEditPrivate::updateTextLayout()
textLayout.endLine(0, 0, TQt::AlignLeft|TQt::SingleLine, &ascent); textLayout.endLine(0, 0, TQt::AlignLeft|TQt::SingleLine, &ascent);
} }
int TQLineEditPrivate::xToPos( int x, TQTextItem::CursorPosition betweenOrOn ) const int TQLineEditPrivate::xToPosInternal( int x, TQTextItem::CursorPosition betweenOrOn ) const
{ {
x-= q->contentsRect().x() - hscroll + innerMargin; x-= q->contentsRect().x() - hscroll + innerMargin;
for ( int i = 0; i < textLayout.numItems(); ++i ) { for ( int i = 0; i < textLayout.numItems(); ++i ) {
@ -2329,7 +2405,13 @@ int TQLineEditPrivate::xToPos( int x, TQTextItem::CursorPosition betweenOrOn ) c
if ( x >= tir.left() && x <= tir.right() ) if ( x >= tir.left() && x <= tir.right() )
return ti.xToCursor( x - tir.x(), betweenOrOn ) + ti.from(); return ti.xToCursor( x - tir.x(), betweenOrOn ) + ti.from();
} }
return x < 0 ? 0 : text.length(); return x < 0 ? -1 : text.length();
}
int TQLineEditPrivate::xToPos( int x, TQTextItem::CursorPosition betweenOrOn ) const
{
int pos = xToPosInternal( x, betweenOrOn );
return ( pos < 0 ) ? 0 : pos;
} }
@ -2350,9 +2432,19 @@ TQRect TQLineEditPrivate::cursorRect() const
void TQLineEditPrivate::updateMicroFocusHint() void TQLineEditPrivate::updateMicroFocusHint()
{ {
// To reduce redundant microfocus update notification, we remember
// the old rect and update the microfocus if actual update is
// required. The rect o is intentionally static because some
// notifyee requires the microfocus information as global update
// rather than per notifyee update to place shared widget around
// microfocus.
static TQRect o;
if ( q->hasFocus() ) { if ( q->hasFocus() ) {
TQRect r = cursorRect(); TQRect r = cursorRect();
q->setMicroFocusHint( r.x(), r.y(), r.width(), r.height() ); if ( o != r ) {
o = r;
q->setMicroFocusHint( r.x(), r.y(), r.width(), r.height() );
}
} }
} }

@ -202,6 +202,7 @@ protected:
void dropEvent( TQDropEvent * ); void dropEvent( TQDropEvent * );
#endif #endif
void contextMenuEvent( TQContextMenuEvent * ); void contextMenuEvent( TQContextMenuEvent * );
bool sendMouseEventToInputContext( TQMouseEvent *e );
virtual TQPopupMenu *createPopupMenu(); virtual TQPopupMenu *createPopupMenu();
void windowActivationChange( bool ); void windowActivationChange( bool );
#ifndef TQT_NO_COMPAT #ifndef TQT_NO_COMPAT

@ -4569,6 +4569,7 @@ void TQListView::contentsMouseReleaseEventEx( TQMouseEvent * e )
} }
emitClicked = emitClicked && d->pressedItem == i; emitClicked = emitClicked && d->pressedItem == i;
d->pressedItem = 0; d->pressedItem = 0;
d->highlighted = 0;
if ( emitClicked ) { if ( emitClicked ) {
if ( !i || ( i && i->isEnabled() ) ) { if ( !i || ( i && i->isEnabled() ) ) {
@ -7597,21 +7598,21 @@ TQListViewItemIterator::~TQListViewItemIterator()
TQListViewItemIterator &TQListViewItemIterator::operator++() TQListViewItemIterator &TQListViewItemIterator::operator++()
{ {
if ( !curr ) do {
return *this; if ( !curr )
return *this;
TQListViewItem *item = curr->firstChild(); TQListViewItem *item = curr->firstChild();
if ( !item ) { if ( !item ) {
while ( (item = curr->nextSibling()) == 0 ) { while ( (item = curr->nextSibling()) == 0 ) {
curr = curr->tqparent(); curr = curr->tqparent();
if ( curr == 0 ) if ( curr == 0 )
break; break;
}
} }
} curr = item;
curr = item; // if the next one doesn't match the flags we try one more ahead
// if the next one doesn't match the flags we try one more ahead } while ( curr && !matchesFlags( curr ) );
if ( curr && !matchesFlags( curr ) )
++( *this );
return *this; return *this;
} }

@ -231,6 +231,10 @@ static const int motifItemFrame = 2; // menu item frame width
static const int motifItemHMargin = 5; // menu item hor text margin static const int motifItemHMargin = 5; // menu item hor text margin
static const int motifItemVMargin = 4; // menu item ver text margin static const int motifItemVMargin = 4; // menu item ver text margin
// The others are 0
static const int gtkItemHMargin = 8;
static const int gtkItemVMargin = 8;
/* /*
+----------------------------- +-----------------------------
@ -295,7 +299,14 @@ TQMenuBar::TQMenuBar( TQWidget *tqparent, const char *name )
setFrameStyle( TQFrame::MenuBarPanel | TQFrame::Raised ); setFrameStyle( TQFrame::MenuBarPanel | TQFrame::Raised );
TQFontMetrics fm = fontMetrics(); TQFontMetrics fm = fontMetrics();
int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame;
int h;
int gs = style().tqstyleHint(TQStyle::SH_GUIStyle);
if (gs == GtkStyle) {
h = fm.height() + gtkItemVMargin;
} else {
h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame;
}
setGeometry( 0, 0, width(), h ); setGeometry( 0, 0, width(), h );
@ -949,12 +960,19 @@ int TQMenuBar::calculateRects( int max_width )
h = TQMAX( mi->pixmap()->height() + 4, TQApplication::globalStrut().height() ); h = TQMAX( mi->pixmap()->height() + 4, TQApplication::globalStrut().height() );
} else if ( !mi->text().isNull() ) { // text item } else if ( !mi->text().isNull() ) { // text item
TQString s = mi->text(); TQString s = mi->text();
w = fm.boundingRect( s ).width() if ( gs == GtkStyle ) {
+ 2*motifItemHMargin; w = fm.boundingRect( s ).width() + 2*gtkItemHMargin;
} else {
w = fm.boundingRect( s ).width() + 2*motifItemHMargin;
}
w -= s.tqcontains('&')*fm.width('&'); w -= s.tqcontains('&')*fm.width('&');
w += s.tqcontains("&&")*fm.width('&'); w += s.tqcontains("&&")*fm.width('&');
w = TQMAX( w, TQApplication::globalStrut().width() ); w = TQMAX( w, TQApplication::globalStrut().width() );
h = TQMAX( fm.height() + motifItemVMargin, TQApplication::globalStrut().height() ); if (gs == GtkStyle ) {
h = TQMAX( fm.height() + gtkItemVMargin, TQApplication::globalStrut().height() );
} else {
h = TQMAX( fm.height() + motifItemVMargin, TQApplication::globalStrut().height() );
}
} else if ( mi->isSeparator() ) { // separator item } else if ( mi->isSeparator() ) { // separator item
if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle )
separator = i; //### only motif? separator = i; //### only motif?

@ -224,6 +224,8 @@ static TQMenuItem* whatsThisItem = 0;
Pop-Up\endlink Pop-Up\endlink
*/ */
static const int gtkArrowHMargin = 0; // arrow horizontal margin
static const int gtkArrowVMargin = 0; // arrow vertical margin
/*! /*!
\fn void TQPopupMenu::aboutToShow() \fn void TQPopupMenu::aboutToShow()
@ -272,6 +274,8 @@ public:
} scroll; } scroll;
TQSize calcSize; TQSize calcSize;
TQRegion mouseMoveBuffer; TQRegion mouseMoveBuffer;
uint hasmouse : 1;
TQPoint ignoremousepos;
}; };
static TQPopupMenu* active_popup_menu = 0; static TQPopupMenu* active_popup_menu = 0;
@ -291,6 +295,7 @@ TQPopupMenu::TQPopupMenu( TQWidget *tqparent, const char *name )
d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0; d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0;
d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone; d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone;
d->scroll.scrolltimer = 0; d->scroll.scrolltimer = 0;
d->hasmouse = 0;
isPopupMenu = TRUE; isPopupMenu = TRUE;
#ifndef TQT_NO_ACCEL #ifndef TQT_NO_ACCEL
autoaccel = 0; autoaccel = 0;
@ -314,6 +319,9 @@ TQPopupMenu::TQPopupMenu( TQWidget *tqparent, const char *name )
connectModalRecursionSafety = 0; connectModalRecursionSafety = 0;
setFocusPolicy( Qt::StrongFocus ); setFocusPolicy( Qt::StrongFocus );
#ifdef TQ_WS_X11
x11SetWindowType( X11WindowTypePopup );
#endif
} }
/*! /*!
@ -473,6 +481,15 @@ void TQPopupMenu::frameChanged()
menuContentsChanged(); menuContentsChanged();
} }
TQRect TQPopupMenu::screenRect( const TQPoint& pos )
{
int screen_num = TQApplication::desktop()->screenNumber( pos );
#ifdef TQ_WS_MAC
return TQApplication::desktop()->availableGeometry( screen_num );
#else
return TQApplication::desktop()->screenGeometry( screen_num );
#endif
}
/*! /*!
Displays the popup menu so that the item number \a indexAtPoint Displays the popup menu so that the item number \a indexAtPoint
will be at the specified \e global position \a pos. To translate a will be at the specified \e global position \a pos. To translate a
@ -517,6 +534,15 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint )
// point. // point.
#endif #endif
TQRect screen = screenRect( tqgeometry().center());
TQRect screen2 = screenRect( TQApplication::reverseLayout()
? pos+TQPoint(width(),0) : pos );
// if the widget is not in the screen given by the position, move it
// there, so that updateSize() uses the right size of the screen
if( screen != screen2 ) {
screen = screen2;
move( screen.x(), screen.y());
}
if(d->scroll.scrollable) { if(d->scroll.scrollable) {
d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone; d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone;
d->scroll.topScrollableIndex = d->scroll.scrollableSize = 0; d->scroll.topScrollableIndex = d->scroll.scrollableSize = 0;
@ -536,18 +562,6 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint )
updateSize(TRUE); updateSize(TRUE);
} }
int screen_num;
if (TQApplication::desktop()->isVirtualDesktop())
screen_num =
TQApplication::desktop()->screenNumber( TQApplication::reverseLayout() ?
pos+TQPoint(width(),0) : pos );
else
screen_num = TQApplication::desktop()->screenNumber( this );
#ifdef TQ_WS_MAC
TQRect screen = TQApplication::desktop()->availableGeometry( screen_num );
#else
TQRect screen = TQApplication::desktop()->screenGeometry( screen_num );
#endif
int sw = screen.width(); // screen width int sw = screen.width(); // screen width
int sh = screen.height(); // screen height int sh = screen.height(); // screen height
int sx = screen.x(); // screen pos int sx = screen.x(); // screen pos
@ -571,6 +585,29 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint )
if ( y < sy ) if ( y < sy )
y = sy; y = sy;
} }
#ifdef TQ_WS_X11
#ifndef TQT_NO_MENUBAR
TQMenuData *top = this; // find top level
while ( top->parentMenu )
top = top->parentMenu;
if( top->isMenuBar )
x11SetWindowType( X11WindowTypeDropdown );
if( parentMenu && parentMenu->isMenuBar )
x11SetWindowTransient( static_cast< TQMenuBar* >( parentMenu )->tqtopLevelWidget());
#endif
if( parentMenu && !parentMenu->isMenuBar )
x11SetWindowTransient( static_cast< TQPopupMenu* >( parentMenu ));
if( !parentMenu ) {
// hackish ... try to find the main window related to this popup
TQWidget* tqparent = parentWidget() ? parentWidget()->tqtopLevelWidget() : NULL;
if( tqparent == NULL )
tqparent = TQApplication::widgetAt( pos );
if( tqparent == NULL )
tqparent = tqApp->activeWindow();
if( tqparent != NULL )
x11SetWindowTransient( tqparent );
}
#endif
if ( x+w > sx+sw ) // the complete widget must if ( x+w > sx+sw ) // the complete widget must
x = sx+sw - w; // be visible x = sx+sw - w; // be visible
@ -1075,7 +1112,7 @@ TQSize TQPopupMenu::updateSize(bool force_update, bool do_resize)
mi->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4 ); mi->iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4 );
} }
int dh = TQApplication::desktop()->height(); int dh = screenRect( tqgeometry().center()).height();
ncols = 1; ncols = 1;
for ( TQMenuItemListIt it2( *mitems ); it2.current(); ++it2 ) { for ( TQMenuItemListIt it2( *mitems ); it2.current(); ++it2 ) {
@ -1389,6 +1426,7 @@ void TQPopupMenu::show()
popupActive = -1; popupActive = -1;
if(tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_SubMenuPopupDelay, this)) if(tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_SubMenuPopupDelay, this))
d->mouseMoveBuffer = TQRegion(); d->mouseMoveBuffer = TQRegion();
d->ignoremousepos = TQCursor::pos();
} }
/*! /*!
@ -1414,6 +1452,13 @@ void TQPopupMenu::hide()
mouseBtDn = FALSE; // mouse button up mouseBtDn = FALSE; // mouse button up
#if defined(TQT_ACCESSIBILITY_SUPPORT) #if defined(TQT_ACCESSIBILITY_SUPPORT)
TQAccessible::updateAccessibility( this, 0, TQAccessible::PopupMenuEnd ); TQAccessible::updateAccessibility( this, 0, TQAccessible::PopupMenuEnd );
#endif
#ifndef TQT_NO_MENUBAR
TQMenuData *top = this; // find top level
while ( top->parentMenu )
top = top->parentMenu;
if( top->isMenuBar )
x11SetWindowType( X11WindowTypePopup ); // reset
#endif #endif
parentMenu = 0; parentMenu = 0;
hidePopups(); hidePopups();
@ -1738,6 +1783,11 @@ void TQPopupMenu::mouseReleaseEvent( TQMouseEvent *e )
void TQPopupMenu::mouseMoveEvent( TQMouseEvent *e ) void TQPopupMenu::mouseMoveEvent( TQMouseEvent *e )
{ {
if( e->globalPos() == d->ignoremousepos ) {
return;
}
d->ignoremousepos = TQPoint();
motion++; motion++;
if ( parentMenu && parentMenu->isPopupMenu ) { if ( parentMenu && parentMenu->isPopupMenu ) {
@ -1778,6 +1828,11 @@ void TQPopupMenu::mouseMoveEvent( TQMouseEvent *e )
int item = itemAtPos( e->pos() ); int item = itemAtPos( e->pos() );
if ( item == -1 ) { // no valid item if ( item == -1 ) { // no valid item
if( !d->hasmouse ) {
tryMenuBar( e );
return;
}
d->hasmouse = 0;
int lastActItem = actItem; int lastActItem = actItem;
actItem = -1; actItem = -1;
if ( lastActItem >= 0 ) if ( lastActItem >= 0 )
@ -1789,6 +1844,7 @@ void TQPopupMenu::mouseMoveEvent( TQMouseEvent *e )
} }
} else { // mouse on valid item } else { // mouse on valid item
// but did not register mouse press // but did not register mouse press
d->hasmouse = 1;
if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn ) if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn )
mouseBtDn = TRUE; // so mouseReleaseEvent will pop down mouseBtDn = TRUE; // so mouseReleaseEvent will pop down
@ -2200,6 +2256,7 @@ void TQPopupMenu::timerEvent( TQTimerEvent *e )
*/ */
void TQPopupMenu::leaveEvent( TQEvent * ) void TQPopupMenu::leaveEvent( TQEvent * )
{ {
d->hasmouse = 0;
if ( testWFlags( TQt::WStyle_Tool ) && tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_MouseTracking, this) ) { if ( testWFlags( TQt::WStyle_Tool ) && tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_MouseTracking, this) ) {
int lastActItem = actItem; int lastActItem = actItem;
actItem = -1; actItem = -1;
@ -2329,27 +2386,37 @@ void TQPopupMenu::subMenuTimer() {
TQRect r( itemGeometry( actItem ) ); TQRect r( itemGeometry( actItem ) );
TQPoint p; TQPoint p;
TQSize ps = popup->tqsizeHint(); TQSize ps = popup->tqsizeHint();
// GUI Style
int gs = style().tqstyleHint(TQStyle::SH_GUIStyle);
int arrowHMargin, arrowVMargin;
if (gs == GtkStyle) {
arrowHMargin = gtkArrowHMargin;
arrowVMargin = gtkArrowVMargin;
} else {
arrowHMargin = motifArrowHMargin;
arrowVMargin = motifArrowVMargin;
}
if( TQApplication::reverseLayout() ) { if( TQApplication::reverseLayout() ) {
p = TQPoint( r.left() + motifArrowHMargin - ps.width(), r.top() + motifArrowVMargin ); p = TQPoint( r.left() + arrowHMargin - ps.width(), r.top() + arrowVMargin );
p = mapToGlobal( p ); p = mapToGlobal( p );
bool right = FALSE; bool right = FALSE;
if ( ( parentMenu && parentMenu->isPopupMenu && if ( ( parentMenu && parentMenu->isPopupMenu &&
((TQPopupMenu*)parentMenu)->tqgeometry().x() < tqgeometry().x() ) || ((TQPopupMenu*)parentMenu)->tqgeometry().x() < tqgeometry().x() ) ||
p.x() < 0 ) p.x() < screenRect( p ).left())
right = TRUE; right = TRUE;
if ( right && (ps.width() > TQApplication::desktop()->width() - mapToGlobal( r.topRight() ).x() ) ) if ( right && (ps.width() > screenRect( p ).right() - mapToGlobal( r.topRight() ).x() ) )
right = FALSE; right = FALSE;
if ( right ) if ( right )
p.setX( mapToGlobal( r.topRight() ).x() ); p.setX( mapToGlobal( r.topRight() ).x() );
} else { } else {
p = TQPoint( r.right() - motifArrowHMargin, r.top() + motifArrowVMargin ); p = TQPoint( r.right() - arrowHMargin, r.top() + arrowVMargin );
p = mapToGlobal( p ); p = mapToGlobal( p );
bool left = FALSE; bool left = FALSE;
if ( ( parentMenu && parentMenu->isPopupMenu && if ( ( parentMenu && parentMenu->isPopupMenu &&
((TQPopupMenu*)parentMenu)->tqgeometry().x() > tqgeometry().x() ) || ((TQPopupMenu*)parentMenu)->tqgeometry().x() > tqgeometry().x() ) ||
p.x() + ps.width() > TQApplication::desktop()->width() ) p.x() + ps.width() > screenRect( p ).right() )
left = TRUE; left = TRUE;
if ( left && (ps.width() > mapToGlobal( r.topLeft() ).x() ) ) if ( left && (ps.width() > mapToGlobal( r.topLeft() ).x() ) )
left = FALSE; left = FALSE;
@ -2357,8 +2424,8 @@ void TQPopupMenu::subMenuTimer() {
p.setX( mapToGlobal( r.topLeft() ).x() - ps.width() ); p.setX( mapToGlobal( r.topLeft() ).x() - ps.width() );
} }
TQRect pr = popup->itemGeometry(popup->count() - 1); TQRect pr = popup->itemGeometry(popup->count() - 1);
if (p.y() + ps.height() > TQApplication::desktop()->height() && if (p.y() + ps.height() > screenRect( p ).bottom() &&
p.y() - ps.height() + (TQCOORD) pr.height() >= 0) p.y() - ps.height() + (TQCOORD) pr.height() >= screenRect( p ).top())
p.setY( p.y() - ps.height() + (TQCOORD) pr.height()); p.setY( p.y() - ps.height() + (TQCOORD) pr.height());
if ( tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_SloppySubMenus, this )) { if ( tqstyle().tqstyleHint(TQStyle::SH_PopupMenu_SloppySubMenus, this )) {
@ -2569,7 +2636,7 @@ TQSize TQPopupMenu::tqsizeHint() const
constPolish(); constPolish();
TQPopupMenu* that = (TQPopupMenu*) this; TQPopupMenu* that = (TQPopupMenu*) this;
//We do not need a resize here, just the tqsizeHint.. //We do not need a resize here, just the tqsizeHint..
return that->updateSize(FALSE, FALSE).expandedTo( TQApplication::globalStrut() ); return that->updateSize(FALSE).expandedTo( TQApplication::globalStrut() );
} }
@ -2730,6 +2797,9 @@ void TQPopupMenu::toggleTearOff()
tqgeometry().topLeft(), FALSE ); tqgeometry().topLeft(), FALSE );
p->mitems->setAutoDelete( FALSE ); p->mitems->setAutoDelete( FALSE );
p->tornOff = TRUE; p->tornOff = TRUE;
#ifdef TQ_WS_X11
p->x11SetWindowType( X11WindowTypeMenu );
#endif
for ( TQMenuItemListIt it( *mitems ); it.current(); ++it ) { for ( TQMenuItemListIt it( *mitems ); it.current(); ++it ) {
if ( it.current()->id() != TQMenuData::d->aInt && !it.current()->widget() ) if ( it.current()->id() != TQMenuData::d->aInt && !it.current()->widget() )
p->mitems->append( it.current() ); p->mitems->append( it.current() );

@ -156,6 +156,7 @@ private:
TQSize updateSize(bool force_recalc=FALSE, bool do_resize=TRUE); TQSize updateSize(bool force_recalc=FALSE, bool do_resize=TRUE);
void updateRow( int row ); void updateRow( int row );
TQRect screenRect(const TQPoint& pos);
#ifndef TQT_NO_ACCEL #ifndef TQT_NO_ACCEL
void updateAccel( TQWidget * ); void updateAccel( TQWidget * );
void enableAccel( bool ); void enableAccel( bool );

@ -1553,6 +1553,9 @@ bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e )
case TQEvent::LayoutHint: case TQEvent::LayoutHint:
d->autoRetqsizeHint(this); d->autoRetqsizeHint(this);
break; break;
case TQEvent::WindowActivate:
case TQEvent::WindowDeactivate:
return TRUE;
default: default:
break; break;
} }
@ -1865,7 +1868,7 @@ void TQScrollView::viewportWheelEvent( TQWheelEvent* e )
the event itself. the event itself.
*/ */
TQWheelEvent ce( viewportToContents(e->pos()), TQWheelEvent ce( viewportToContents(e->pos()),
e->globalPos(), e->delta(), e->state()); e->globalPos(), e->delta(), e->state(), e->orientation());
contentsWheelEvent(&ce); contentsWheelEvent(&ce);
if ( ce.isAccepted() ) if ( ce.isAccepted() )
e->accept(); e->accept();

@ -42,6 +42,11 @@
#ifndef TQT_NO_TEXTEDIT #ifndef TQT_NO_TEXTEDIT
// Keep this position to avoid patch rejection
#ifndef TQT_NO_IM
#include "tqinputcontext.h"
#endif
#include "../kernel/tqrichtext_p.h" #include "../kernel/tqrichtext_p.h"
#include "tqpainter.h" #include "tqpainter.h"
#include "tqpen.h" #include "tqpen.h"
@ -111,6 +116,8 @@ public:
int id[ 7 ]; int id[ 7 ];
int preeditStart; int preeditStart;
int preeditLength; int preeditLength;
bool composeMode() const { return ( preeditLength > 0 ); }
uint ensureCursorVisibleInShowEvent : 1; uint ensureCursorVisibleInShowEvent : 1;
uint tabChangesFocus : 1; uint tabChangesFocus : 1;
TQString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized TQString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized
@ -1081,6 +1088,10 @@ void TQTextEdit::drawContents( TQPainter *p, int cx, int cy, int cw, int ch )
l += v; l += v;
} }
} }
// This invocation is required to follow dragging of active window
// by the showed candidate window.
updateMicroFocusHint();
} }
/*! /*!
@ -1555,6 +1566,35 @@ void TQTextEdit::keyPressEvent( TQKeyEvent *e )
e->ignore(); e->ignore();
} }
/*!
This function is not intended as polymorphic usage. Just a shared code
fragment that calls TQWidget::sendMouseEventToInputContext() easily for this
class.
*/
bool TQTextEdit::sendMouseEventToInputContext( TQMouseEvent *e )
{
#ifndef TQT_NO_IM
if ( d->composeMode() ) {
TQTextCursor c( doc );
if ( c.place( e->pos(), doc->firstParagraph(), FALSE, FALSE, FALSE ) ) {
int mousePos = c.index() - d->preeditStart;
if ( cursor->globalY() == c.globalY() &&
mousePos >= 0 && mousePos < d->preeditLength ) {
TQWidget::sendMouseEventToInputContext( mousePos, e->type(),
e->button(), e->state() );
}
} else if ( e->type() != TQEvent::MouseMove ) {
// send button events on out of preedit
TQWidget::sendMouseEventToInputContext( -1, e->type(),
e->button(), e->state() );
}
return TRUE;
}
#endif
return FALSE;
}
/*! /*!
\reimp \reimp
*/ */
@ -1585,11 +1625,17 @@ void TQTextEdit::imComposeEvent( TQIMEvent *e )
doc->removeSelection( TQTextDocument::IMCompositionText ); doc->removeSelection( TQTextDocument::IMCompositionText );
doc->removeSelection( TQTextDocument::IMSelectionText ); doc->removeSelection( TQTextDocument::IMSelectionText );
if ( d->preeditLength > 0 && cursor->paragraph() ) if ( d->composeMode() && cursor->paragraph() )
cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); cursor->paragraph()->remove( d->preeditStart, d->preeditLength );
cursor->setIndex( d->preeditStart ); cursor->setIndex( d->preeditStart );
d->preeditLength = e->text().length(); d->preeditLength = e->text().length();
insert( e->text() );
int sellen = e->selectionLength();
uint insertionFlags = CheckNewLines | RemoveSelected | AsIMCompositionText;
if ( sellen > 0 ) {
insertionFlags |= WithIMSelection;
}
insert( e->text(), insertionFlags );
// insert can trigger an imEnd event as it emits a textChanged signal, so better // insert can trigger an imEnd event as it emits a textChanged signal, so better
// be careful // be careful
if(d->preeditStart != -1) { if(d->preeditStart != -1) {
@ -1601,14 +1647,20 @@ void TQTextEdit::imComposeEvent( TQIMEvent *e )
cursor->setIndex( d->preeditStart + e->cursorPos() ); cursor->setIndex( d->preeditStart + e->cursorPos() );
int sellen = e->selectionLength();
if ( sellen > 0 ) { if ( sellen > 0 ) {
cursor->setIndex( d->preeditStart + e->cursorPos() + sellen ); cursor->setIndex( d->preeditStart + e->cursorPos() + sellen );
c = *cursor; c = *cursor;
cursor->setIndex( d->preeditStart + e->cursorPos() ); cursor->setIndex( d->preeditStart + e->cursorPos() );
doc->setSelectionStart( TQTextDocument::IMSelectionText, *cursor ); doc->setSelectionStart( TQTextDocument::IMSelectionText, *cursor );
doc->setSelectionEnd( TQTextDocument::IMSelectionText, c ); doc->setSelectionEnd( TQTextDocument::IMSelectionText, c );
#if 0
// Disabled for Asian input method that shows candidate
// window. This behavior is same as TQt/E 2.3.7 which supports
// Asian input methods. Asian input methods need start point
// of IM selection text to place candidate window as adjacent
// to the selection text.
cursor->setIndex( d->preeditStart + d->preeditLength ); cursor->setIndex( d->preeditStart + d->preeditLength );
#endif
} }
} }
@ -1632,11 +1684,12 @@ void TQTextEdit::imEndEvent( TQIMEvent *e )
if (undoRedoInfo.type == UndoRedoInfo::IME) if (undoRedoInfo.type == UndoRedoInfo::IME)
undoRedoInfo.type = UndoRedoInfo::Invalid; undoRedoInfo.type = UndoRedoInfo::Invalid;
if ( d->preeditLength > 0 && cursor->paragraph() ) if ( d->composeMode() && cursor->paragraph() )
cursor->paragraph()->remove( d->preeditStart, d->preeditLength ); cursor->paragraph()->remove( d->preeditStart, d->preeditLength );
if ( d->preeditStart >= 0 ) { if ( d->preeditStart >= 0 ) {
cursor->setIndex( d->preeditStart ); cursor->setIndex( d->preeditStart );
insert( e->text() ); //TODO: TQt 4 we should use the new virtual insert function
insert( e->text(), FALSE );
} }
d->preeditStart = d->preeditLength = -1; d->preeditStart = d->preeditLength = -1;
@ -2127,6 +2180,13 @@ void TQTextEdit::drawCursor( bool visible )
isReadOnly() ) isReadOnly() )
return; return;
// Asian users regard selection text as cursor on candidate
// selection phase of input method, so ordinary cursor should be
// invisible if IM selection text exists.
if ( doc->hasSelection( TQTextDocument::IMSelectionText ) ) {
visible = FALSE;
}
TQPainter p( viewport() ); TQPainter p( viewport() );
TQRect r( cursor->topParagraph()->rect() ); TQRect r( cursor->topParagraph()->rect() );
cursor->paragraph()->setChanged( TRUE ); cursor->paragraph()->setChanged( TRUE );
@ -2201,6 +2261,9 @@ void TQTextEdit::contentsMousePressEvent( TQMouseEvent *e )
} }
#endif #endif
if ( sendMouseEventToInputContext( e ) )
return;
if ( d->trippleClickTimer->isActive() && if ( d->trippleClickTimer->isActive() &&
( e->globalPos() - d->trippleClickPoint ).manhattanLength() < ( e->globalPos() - d->trippleClickPoint ).manhattanLength() <
TQApplication::startDragDistance() ) { TQApplication::startDragDistance() ) {
@ -2306,7 +2369,9 @@ void TQTextEdit::contentsMouseMoveEvent( TQMouseEvent *e )
return; return;
} }
#endif #endif
if ( mousePressed ) { if ( sendMouseEventToInputContext( e ) ) {
// don't return from here to avoid cursor vanishing
} else if ( mousePressed ) {
#ifndef TQT_NO_DRAGANDDROP #ifndef TQT_NO_DRAGANDDROP
if ( mightStartDrag ) { if ( mightStartDrag ) {
dragStartTimer->stop(); dragStartTimer->stop();
@ -2363,7 +2428,7 @@ void TQTextEdit::copyToClipboard()
void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e ) void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e )
{ {
if ( !inDoubleClick ) { // could be the release of a dblclick if ( !inDoubleClick && !d->composeMode() ) { // could be the release of a dblclick
int para = 0; int para = 0;
int index = charAt( e->pos(), &para ); int index = charAt( e->pos(), &para );
emit clicked( para, index ); emit clicked( para, index );
@ -2374,6 +2439,8 @@ void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e )
return; return;
} }
#endif #endif
if ( sendMouseEventToInputContext( e ) )
return;
TQTextCursor oldCursor = *cursor; TQTextCursor oldCursor = *cursor;
if ( scrollTimer->isActive() ) if ( scrollTimer->isActive() )
scrollTimer->stop(); scrollTimer->stop();
@ -2467,7 +2534,7 @@ void TQTextEdit::contentsMouseReleaseEvent( TQMouseEvent * e )
void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e ) void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e )
{ {
if ( e->button() != Qt::LeftButton ) { if ( e->button() != Qt::LeftButton && !d->composeMode() ) {
e->ignore(); e->ignore();
return; return;
} }
@ -2498,6 +2565,9 @@ void TQTextEdit::contentsMouseDoubleClickEvent( TQMouseEvent * e )
} else } else
#endif #endif
{ {
if ( sendMouseEventToInputContext( e ) )
return;
TQTextCursor c1 = *cursor; TQTextCursor c1 = *cursor;
TQTextCursor c2 = *cursor; TQTextCursor c2 = *cursor;
#if defined(TQ_OS_MAC) #if defined(TQ_OS_MAC)
@ -2673,10 +2743,15 @@ void TQTextEdit::contentsDropEvent( TQDropEvent *e )
*/ */
void TQTextEdit::contentsContextMenuEvent( TQContextMenuEvent *e ) void TQTextEdit::contentsContextMenuEvent( TQContextMenuEvent *e )
{ {
e->accept();
#ifndef TQT_NO_IM
if ( d->composeMode() )
return;
#endif
clearUndoRedo(); clearUndoRedo();
mousePressed = FALSE; mousePressed = FALSE;
e->accept();
#ifndef TQT_NO_POPUPMENU #ifndef TQT_NO_POPUPMENU
TQGuardedPtr<TQTextEdit> that = this; TQGuardedPtr<TQTextEdit> that = this;
TQGuardedPtr<TQPopupMenu> popup = createPopupMenu( e->pos() ); TQGuardedPtr<TQPopupMenu> popup = createPopupMenu( e->pos() );
@ -2826,6 +2901,12 @@ void TQTextEdit::placeCursor( const TQPoint &pos, TQTextCursor *c, bool link )
void TQTextEdit::updateMicroFocusHint() void TQTextEdit::updateMicroFocusHint()
{ {
TQTextCursor c( *cursor ); TQTextCursor c( *cursor );
#if 0
// Disabled for Asian input method that shows candidate
// window. This behavior is same as TQt/E 2.3.7 which supports
// Asian input methods. Asian input methods need start point of IM
// selection text to place candidate window as adjacent to the
// selection text.
if ( d->preeditStart != -1 ) { if ( d->preeditStart != -1 ) {
c.setIndex( d->preeditStart ); c.setIndex( d->preeditStart );
if(doc->hasSelection(TQTextDocument::IMSelectionText)) { if(doc->hasSelection(TQTextDocument::IMSelectionText)) {
@ -2834,6 +2915,7 @@ void TQTextEdit::updateMicroFocusHint()
c.setIndex(index); c.setIndex(index);
} }
} }
#endif
if ( hasFocus() || viewport()->hasFocus() ) { if ( hasFocus() || viewport()->hasFocus() ) {
int h = c.paragraph()->lineHeightOfChar( cursor->index() ); int h = c.paragraph()->lineHeightOfChar( cursor->index() );
@ -2998,6 +3080,8 @@ void TQTextEdit::insert( const TQString &text, uint insertionFlags )
bool indent = insertionFlags & RedoIndentation; bool indent = insertionFlags & RedoIndentation;
bool checkNewLine = insertionFlags & CheckNewLines; bool checkNewLine = insertionFlags & CheckNewLines;
bool removeSelected = insertionFlags & RemoveSelected; bool removeSelected = insertionFlags & RemoveSelected;
bool imComposition = insertionFlags & AsIMCompositionText;
bool imSelection = insertionFlags & WithIMSelection;
TQString txt( text ); TQString txt( text );
drawCursor( FALSE ); drawCursor( FALSE );
if ( !isReadOnly() && doc->hasSelection( TQTextDocument::Standard ) && removeSelected ) if ( !isReadOnly() && doc->hasSelection( TQTextDocument::Standard ) && removeSelected )
@ -3037,7 +3121,10 @@ void TQTextEdit::insert( const TQString &text, uint insertionFlags )
formatMore(); formatMore();
repaintChanged(); repaintChanged();
ensureCursorVisible(); ensureCursorVisible();
drawCursor( TRUE ); // Asian users regard selection text as cursor on candidate
// selection phase of input method, so ordinary cursor should be
// invisible if IM selection text exists.
drawCursor( !imSelection );
if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) { if ( undoEnabled && !isReadOnly() && undoRedoInfo.type != UndoRedoInfo::IME ) {
undoRedoInfo.d->text += txt; undoRedoInfo.d->text += txt;
@ -3059,7 +3146,13 @@ void TQTextEdit::insert( const TQString &text, uint insertionFlags )
doc->setSelectionEnd( TQTextDocument::Standard, *cursor ); doc->setSelectionEnd( TQTextDocument::Standard, *cursor );
repaintChanged(); repaintChanged();
} }
updateMicroFocusHint(); // updateMicroFocusHint() should not be invoked here when this
// function is invoked from imComposeEvent() because cursor
// postion is incorrect yet. imComposeEvent() invokes
// updateMicroFocusHint() later.
if ( !imComposition ) {
updateMicroFocusHint();
}
setModified(); setModified();
emit textChanged(); emit textChanged();
} }
@ -5571,6 +5664,13 @@ TQPopupMenu *TQTextEdit::createPopupMenu( const TQPoint& pos )
#else #else
d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) + ACCEL_KEY( A ) ); d->id[ IdSelectAll ] = popup->insertItem( tr( "Select All" ) + ACCEL_KEY( A ) );
#endif #endif
#ifndef TQT_NO_IM
TQInputContext *qic = getInputContext();
if ( qic )
qic->addMenusTo( popup );
#endif
popup->setItemEnabled( d->id[ IdUndo ], !isReadOnly() && doc->commands()->isUndoAvailable() ); popup->setItemEnabled( d->id[ IdUndo ], !isReadOnly() && doc->commands()->isUndoAvailable() );
popup->setItemEnabled( d->id[ IdRedo ], !isReadOnly() && doc->commands()->isRedoAvailable() ); popup->setItemEnabled( d->id[ IdRedo ], !isReadOnly() && doc->commands()->isRedoAvailable() );
#ifndef TQT_NO_CLIPBOARD #ifndef TQT_NO_CLIPBOARD

@ -216,7 +216,9 @@ public:
enum TextInsertionFlags { enum TextInsertionFlags {
RedoIndentation = 0x0001, RedoIndentation = 0x0001,
CheckNewLines = 0x0002, CheckNewLines = 0x0002,
RemoveSelected = 0x0004 RemoveSelected = 0x0004,
AsIMCompositionText = 0x0008, // internal use
WithIMSelection = 0x0010 // internal use
}; };
TQTextEdit( const TQString& text, const TQString& context = TQString::null, TQTextEdit( const TQString& text, const TQString& context = TQString::null,
@ -446,6 +448,7 @@ protected:
void contentsDropEvent( TQDropEvent *e ); void contentsDropEvent( TQDropEvent *e );
#endif #endif
void contentsContextMenuEvent( TQContextMenuEvent *e ); void contentsContextMenuEvent( TQContextMenuEvent *e );
bool sendMouseEventToInputContext( TQMouseEvent *e );
bool focusNextPrevChild( bool next ); bool focusNextPrevChild( bool next );
TQTextDocument *document() const; TQTextDocument *document() const;
TQTextCursor *textCursor() const; TQTextCursor *textCursor() const;

@ -76,6 +76,7 @@ public:
polish(); polish();
setText(text); setText(text);
adjustSize(); adjustSize();
x11SetWindowType( X11WindowTypeTooltip );
} }
void setWidth( int w ) { resize( sizeForWidth( w ) ); } void setWidth( int w ) { resize( sizeForWidth( w ) ); }
}; };
@ -534,6 +535,10 @@ void TQTipManager::showTip()
if (!widget) if (!widget)
return; return;
#ifdef TQ_WS_X11
label->x11SetWindowTransient( widget->tqtopLevelWidget());
#endif
#ifdef TQ_WS_MAC #ifdef TQ_WS_MAC
TQRect screen = TQApplication::desktop()->availableGeometry( scr ); TQRect screen = TQApplication::desktop()->availableGeometry( scr );
#else #else

@ -3,3 +3,6 @@ CONFIG += qt warn_on release
HEADERS = HEADERS =
SOURCES = main.cpp SOURCES = main.cpp
TARGET = createcw TARGET = createcw
target.path = $$bins.path
INSTALLS += target

@ -734,16 +734,7 @@ void Uic::createFormImpl( const TQDomElement &e )
} }
n2 = n2.nextSibling().toElement(); n2 = n2.nextSibling().toElement();
} }
} else if ( n.tagName() == "includehints" ) { }
TQDomElement n2 = n.firstChild().toElement();
while ( !n2.isNull() ) {
if ( n2.tagName() == "includehint" ) {
TQString file = n2.firstChild().toText().data();
localIncludes += file;
}
n2 = n2.nextSibling().toElement();
}
}
} }
// additional includes (local or global) and forward declaractions // additional includes (local or global) and forward declaractions

@ -47,7 +47,7 @@
#include <tqmemorymanager_qws.h> #include <tqmemorymanager_qws.h>
#endif #endif
#include <stdlib.h> #include <cstdlib>
class FontViewItem : public TQListViewItem { class FontViewItem : public TQListViewItem {
@ -137,8 +137,6 @@ public:
} }
}; };
extern TQString qws_topdir();
class MakeTQPF : public TQMainWindow class MakeTQPF : public TQMainWindow
{ {
TQ_OBJECT TQ_OBJECT
@ -152,7 +150,7 @@ public:
view->addColumn("Weight"); view->addColumn("Weight");
view->addColumn("Style"); view->addColumn("Style");
setCentralWidget(view); setCentralWidget(view);
TQString fontdir = qws_topdir() + "/lib/fonts"; TQString fontdir = TQString(getenv("TQTDIR")) + "/lib/fonts";
readFontDir(fontdir); readFontDir(fontdir);
connect(view,TQT_SIGNAL(selectionChanged(TQListViewItem*)), connect(view,TQT_SIGNAL(selectionChanged(TQListViewItem*)),

@ -40,6 +40,7 @@
#include <tqapplication.h> #include <tqapplication.h>
#include <tqcombobox.h> #include <tqcombobox.h>
#include <tqstylefactory.h> #include <tqstylefactory.h>
#include <tqinputcontextfactory.h>
#include <tqobjectlist.h> #include <tqobjectlist.h>
#include <tqfontdatabase.h> #include <tqfontdatabase.h>
#include <tqlineedit.h> #include <tqlineedit.h>
@ -374,13 +375,73 @@ MainWindow::MainWindow()
rtlExtensions->setChecked( settings.readBoolEntry( "/qt/useRtlExtensions", FALSE ) ); rtlExtensions->setChecked( settings.readBoolEntry( "/qt/useRtlExtensions", FALSE ) );
#ifdef TQ_WS_X11 #if defined(TQ_WS_X11)
inputStyle->setCurrentText( settings.readEntry( "/qt/XIMInputStyle", trUtf8( "On The Spot" ) ) ); inputStyle->setCurrentText( settings.readEntry( "/qt/XIMInputStyle", trUtf8( "On The Spot" ) ) );
#else #else
inputStyle->hide(); inputStyle->hide();
inputStyleLabel->hide(); inputStyleLabel->hide();
#endif #endif
#if defined(TQ_WS_X11) && !defined(TQT_NO_IM_EXTENSIONS)
/*
This code makes it possible to set up default input method.
The list of identifier names of input method which can be used
is acquired using TQInputContextFactory::keys(). And it is
translated to display name and set to inputMethodCombo which
displays the list of input method.
*/
inputMethodIdentifiers = TQInputContextFactory::keys();
TQStringList imDispNames;
{
// input method switcher should named with "imsw-" prefix to
// prevent to be listed in ordinary input method list.
TQStringList::Iterator imIt = inputMethodIdentifiers.begin();
while (imIt != inputMethodIdentifiers.end()) {
if ((*imIt).tqfind("imsw-") == 0)
imIt = inputMethodIdentifiers.remove(imIt);
else
imIt++;
}
// we should not sort the list
//inputMethodIdentifiers.sort();
for (imIt = inputMethodIdentifiers.begin();
imIt != inputMethodIdentifiers.end();
imIt++) {
TQString dispName = TQInputContextFactory::displayName(*imIt);
if (dispName.isNull() || dispName.isEmpty())
dispName = *imIt;
imDispNames << dispName;
}
}
//inputMethodCombo->insertStringList(inputMethodIdentifiers);
inputMethodCombo->insertStringList(imDispNames);
/*
input method set up as a default in the past is chosen.
If nothing is set up, default input method in the platform is chosen.
*/
// default input method is XIM in X11.
TQString currentIM = settings.readEntry("/qt/DefaultInputMethod", "xim");
{
int index = inputMethodIdentifiers.findIndex(currentIM);
// set up Selected input method.
if (0 <= index && index < inputMethodIdentifiers.count()) {
inputMethodCombo->setCurrentItem(index);
} else {
// Give up. this part is executed when specified IM is not
// installed.
TQString dispName = tr("Unknown Input Method") + " (" + currentIM + ")";
inputMethodCombo->insertItem(dispName);
inputMethodCombo->setCurrentItem(inputMethodCombo->count() - 1);
inputMethodIdentifiers << currentIM;
}
}
#else
inputMethodCombo->hide();
inputMethodLabel->hide();
#endif
fontembeddingcheckbox->setChecked( settings.readBoolEntry("/qt/embedFonts", TRUE) ); fontembeddingcheckbox->setChecked( settings.readBoolEntry("/qt/embedFonts", TRUE) );
fontpaths = settings.readListEntry("/qt/fontPath", ':'); fontpaths = settings.readListEntry("/qt/fontPath", ':');
fontpathlistbox->insertStringList(fontpaths); fontpathlistbox->insertStringList(fontpaths);
@ -457,6 +518,13 @@ void MainWindow::fileSave()
else if ( style == trUtf8( "Root" ) ) else if ( style == trUtf8( "Root" ) )
str = "Root"; str = "Root";
settings.writeEntry( "/qt/XIMInputStyle", inputStyle->currentText() ); settings.writeEntry( "/qt/XIMInputStyle", inputStyle->currentText() );
#if !defined(TQT_NO_IM_EXTENSIONS)
TQString imSwitcher = settings.readEntry("/qt/DefaultInputMethodSwitcher", "imsw-multi");
settings.writeEntry("/qt/DefaultInputMethodSwitcher", imSwitcher);
int imIndex = inputMethodCombo->currentItem();
settings.writeEntry("/qt/DefaultInputMethod", inputMethodIdentifiers[imIndex]);
#endif
#endif #endif
TQStringList effects; TQStringList effects;

@ -97,6 +97,7 @@ private:
TQPalette editPalette, previewPalette; TQPalette editPalette, previewPalette;
TQStyle *previewstyle; TQStyle *previewstyle;
TQStringList fontpaths; TQStringList fontpaths;
TQStringList inputMethodIdentifiers;
bool modified; bool modified;
}; };

@ -1029,6 +1029,19 @@
<number>0</number> <number>0</number>
</property> </property>
</widget> </widget>
<widget class=TQLABEL_OBJECT_NAME_STRING>
<property name="name">
<cstring>inputMethodLabel</cstring>
</property>
<property name="text">
<string>Default Input Method:</string>
</property>
</widget>
<widget class=TQCOMBOBOX_OBJECT_NAME_STRING>
<property name="name">
<cstring>inputMethodCombo</cstring>
</property>
</widget>
<spacer> <spacer>
<property name="name"> <property name="name">
<cstring>spacer5</cstring> <cstring>spacer5</cstring>
@ -1042,7 +1055,7 @@
<property name="tqsizeHint"> <property name="tqsizeHint">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>30</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -1717,6 +1730,12 @@
<receiver>MainWindowBase</receiver> <receiver>MainWindowBase</receiver>
<slot>somethingModified()</slot> <slot>somethingModified()</slot>
</connection> </connection>
<connection>
<sender>inputMethodCombo</sender>
<signal>activated(int)</signal>
<receiver>MainWindowBase</receiver>
<slot>somethingModified()</slot>
</connection>
<connection> <connection>
<sender>gstylecombo</sender> <sender>gstylecombo</sender>
<signal>activated(const TQString&amp;)</signal> <signal>activated(const TQString&amp;)</signal>

@ -1,4 +1,4 @@
pda_up.png pda_down.png /usr/share/qvfb/pda_up.png /usr/share/qvfb/pda_down.png
57 81 57 81
240 320 240 320
0.5 0.5

@ -94,7 +94,7 @@ void TQVFb::init( int display_id, int w, int h, int d, const TQString &skin_name
bool vis = isVisible(); bool vis = isVisible();
if ( vis ) hide(); if ( vis ) hide();
menuBar()->hide(); menuBar()->hide();
Skin *skin = new Skin( this, skin_name, w, h ); Skin *skin = new Skin( this, TQString::tqfromLatin1( "/etc/qt3/qvfb/" ) + skin_name, w, h );
view = new TQVFbView( display_id, w, h, d, skin ); view = new TQVFbView( display_id, w, h, d, skin );
skin->setView( view ); skin->setView( view );
view->setMargin( 0 ); view->setMargin( 0 );

@ -128,7 +128,7 @@ TQVFbView::TQVFbView( int display_id, int w, int h, int d, TQWidget *tqparent,
data = (unsigned char *)shmat( shmId, 0, 0 ); data = (unsigned char *)shmat( shmId, 0, 0 );
} }
if ( (int)data == -1 ) if ( (long)data == -1 )
qFatal( "Cannot attach to shared memory" ); qFatal( "Cannot attach to shared memory" );
hdr = (TQVFbHeader *)data; hdr = (TQVFbHeader *)data;

Loading…
Cancel
Save