summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-06-25 05:37:59 +0200
committerBram Moolenaar <Bram@vim.org>2010-06-25 05:37:59 +0200
commit182c5be111889643294083c830080cfbaa3dd154 (patch)
tree4c393150480418e953031c93453cedc10738185f
parentba52cde53d8eeb0bd8949ab0acc47a56f87e7963 (diff)
downloadvim-git-182c5be111889643294083c830080cfbaa3dd154.tar.gz
Remove the old and not well supported GTK 1 code. (James Vega)
-rw-r--r--runtime/doc/todo.txt5
-rw-r--r--src/Makefile10
-rwxr-xr-xsrc/auto/configure472
-rw-r--r--src/configure.in219
-rw-r--r--src/eval.c2
-rw-r--r--src/globals.h8
-rw-r--r--src/gui.c4
-rw-r--r--src/gui.h14
-rw-r--r--src/gui_beval.c63
-rw-r--r--src/gui_gtk.c1239
-rw-r--r--src/gui_gtk_f.c90
-rw-r--r--src/gui_gtk_f.h1
-rw-r--r--src/gui_gtk_x11.c1324
-rw-r--r--src/main.c2
-rw-r--r--src/mbyte.c1089
-rw-r--r--src/option.c8
-rw-r--r--src/option.h4
-rw-r--r--src/os_unix.c1
-rw-r--r--src/proto/gui_gtk.pro1
-rw-r--r--src/proto/gui_gtk_x11.pro5
-rw-r--r--src/version.c8
21 files changed, 224 insertions, 4345 deletions
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index d9351d96f..255e00f5f 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1086,8 +1086,8 @@ restored. (Luc St-Louis)
Vim 7.3:
- using NSIS 2.46: install on Windows 7 works, but no "Edit with Vim" menu.
- Use register_shell_extension()? (George Reilly, 2010 May 26)
- Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
+ Use register_shell_extension()?
+ Patch from Geoffrey Reilly, 2010 Jun 22
- Patch for conceal feature from Vince, 2010 June 16.
Needs some more testing.
- undofile: keep markers where the file was written/read, so that it's easy to
@@ -1097,7 +1097,6 @@ Vim 7.3:
Show "file saved" marker in :undolist
- Function to get undo tree: undotree(). List of lists. Each entry is a
dictionary: {'nr': 2, 'time': 1234, 'saved': 1}
-- Remove support for GTK 1? Patch by James Vega, Jun 11 (removes too much).
Patches to include:
- Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25)
- Minor patches from Dominique Pelle, 2010 May 15
diff --git a/src/Makefile b/src/Makefile
index 375b5988e..33780d00b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -325,9 +325,7 @@ CClink = $(CC)
# Uncomment one of these lines if you have that GUI but don't want to use it.
# The automatic check will use another one that can be found.
# Gnome is disabled by default, it may cause trouble.
-#CONF_OPT_GUI = --disable-gtk-check
#CONF_OPT_GUI = --disable-gtk2-check
-#CONF_OPT_GUI = --enable-gnome-check
#CONF_OPT_GUI = --enable-gnome2-check
#CONF_OPT_GUI = --disable-motif-check
#CONF_OPT_GUI = --disable-athena-check
@@ -339,6 +337,7 @@ CClink = $(CC)
#
# GTK versions that are known not to work 100% are rejected.
# Use "--disable-gtktest" to accept them anyway.
+# Only GTK 2 is supported, for GTK 1 use Vim 7.2.
#
# GNOME means GTK with Gnome support. If using GTK and --enable-gnome-check
# is used then GNOME will automatically be used if it is found. If you have
@@ -346,11 +345,8 @@ CClink = $(CC)
# --enable-gui=gtk or leave out --enable-gnome-check.
#
# If the selected GUI isn't found, the GUI is disabled automatically
-#CONF_OPT_GUI = --enable-gui=gtk
-#CONF_OPT_GUI = --enable-gui=gtk --disable-gtktest
#CONF_OPT_GUI = --enable-gui=gtk2
#CONF_OPT_GUI = --enable-gui=gtk2 --disable-gtktest
-#CONF_OPT_GUI = --enable-gui=gnome
#CONF_OPT_GUI = --enable-gui=gnome2
#CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest
#CONF_OPT_GUI = --enable-gui=motif
@@ -396,8 +392,8 @@ CClink = $(CC)
# RUBY
# Uncomment this when you want to include the Ruby interface.
# Note: you need the development package (e.g., ruby1.9.1-dev on Ubuntu).
-# CONF_OPT_RUBY = --enable-rubyinterp
-# CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
+#CONF_OPT_RUBY = --enable-rubyinterp
+#CONF_OPT_RUBY = --enable-rubyinterp --with-ruby-command=ruby1.9.1
# MZSCHEME
# Uncomment this when you want to include the MzScheme interface.
diff --git a/src/auto/configure b/src/auto/configure
index baeaebc22..42e5ed3d3 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -607,7 +607,6 @@ GUI_LIB_LOC
GUI_INC_LOC
NARROW_PROTO
MOTIF_LIBNAME
-GNOME_CONFIG
GNOME_INCLUDEDIR
GNOME_LIBDIR
GNOME_LIBS
@@ -615,8 +614,6 @@ GTK_LIBNAME
GTK_LIBS
GTK_CFLAGS
PKG_CONFIG
-GTK12_CONFIG
-GTK_CONFIG
X_LIB
X_EXTRA_LIBS
X_LIBS
@@ -765,15 +762,12 @@ enable_xim
enable_fontset
with_x
enable_gui
-enable_gtk_check
enable_gtk2_check
enable_gnome_check
enable_motif_check
enable_athena_check
enable_nextaw_check
enable_carbon_check
-with_gtk_prefix
-with_gtk_exec_prefix
enable_gtktest
with_gnome_includes
with_gnome_libs
@@ -1425,9 +1419,8 @@ Optional Features:
--enable-hangulinput Include Hangul input support.
--enable-xim Include XIM input support.
--enable-fontset Include X fontset output support.
- --enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon
- --enable-gtk-check If auto-select GUI, check for GTK default=yes
- --enable-gtk2-check If GTK GUI, check for GTK+ 2 default=yes
+ --enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon
+ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 default=yes
--enable-gnome-check If GTK GUI, check for GNOME default=no
--enable-motif-check If auto-select GUI, check for Motif default=yes
--enable-athena-check If auto-select GUI, check for Athena default=yes
@@ -1459,8 +1452,6 @@ Optional Packages:
--with-tclsh=PATH which tclsh to use (default: tclsh8.0)
--with-ruby-command=RUBY name of the Ruby command (default: ruby)
--with-x use the X Window System
- --with-gtk-prefix=PFX Prefix where GTK is installed (optional)
- --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)
--with-gnome-includes=DIR Specify location of GNOME headers
--with-gnome-libs=DIR Specify location of GNOME libs
--with-gnome Specify prefix for GNOME files
@@ -4204,7 +4195,7 @@ fi
if test "x$CARBON" = "xyes"; then
- if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk -a "X$enable_gui" != Xgtk2; then
+ if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
with_x=no
fi
fi
@@ -7004,7 +6995,6 @@ fi
enable_gui_canon=`echo "_$enable_gui" | \
sed 's/[ _+-]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
-SKIP_GTK=YES
SKIP_GTK2=YES
SKIP_GNOME=YES
SKIP_MOTIF=YES
@@ -7055,28 +7045,18 @@ else
$as_echo "no GUI support" >&6; } ;;
yes|""|auto) { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes/auto - automatic GUI support" >&5
$as_echo "yes/auto - automatic GUI support" >&6; }
- SKIP_GTK=
SKIP_GTK2=
SKIP_GNOME=
SKIP_MOTIF=
SKIP_ATHENA=
SKIP_NEXTAW=
SKIP_CARBON=;;
- gtk) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 1.x GUI support" >&5
-$as_echo "GTK+ 1.x GUI support" >&6; }
- SKIP_GTK=;;
gtk2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 2.x GUI support" >&5
$as_echo "GTK+ 2.x GUI support" >&6; }
- SKIP_GTK=
SKIP_GTK2=;;
- gnome) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GNOME 1.x GUI support" >&5
-$as_echo "GNOME 1.x GUI support" >&6; }
- SKIP_GNOME=
- SKIP_GTK=;;
gnome2) { $as_echo "$as_me:${as_lineno-$LINENO}: result: GNOME 2.x GUI support" >&5
$as_echo "GNOME 2.x GUI support" >&6; }
SKIP_GNOME=
- SKIP_GTK=
SKIP_GTK2=;;
motif) { $as_echo "$as_me:${as_lineno-$LINENO}: result: Motif GUI support" >&5
$as_echo "Motif GUI support" >&6; }
@@ -7093,24 +7073,6 @@ $as_echo "Sorry, $enable_gui GUI is not supported" >&6; } ;;
fi
-if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for GTK" >&5
-$as_echo_n "checking whether or not to look for GTK... " >&6; }
- # Check whether --enable-gtk-check was given.
-if test "${enable_gtk_check+set}" = set; then :
- enableval=$enable_gtk_check;
-else
- enable_gtk_check="yes"
-fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gtk_check" >&5
-$as_echo "$enable_gtk_check" >&6; }
- if test "x$enable_gtk_check" = "xno"; then
- SKIP_GTK=YES
- SKIP_GNOME=YES
- fi
-fi
-
if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
-a "$enable_gui_canon" != "gnome2"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for GTK+ 2" >&5
@@ -7126,11 +7088,11 @@ fi
$as_echo "$enable_gtk2_check" >&6; }
if test "x$enable_gtk2_check" = "xno"; then
SKIP_GTK2=YES
+ SKIP_GNOME=YES
fi
fi
-if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
- -a "$enable_gui_canon" != "gnome2"; then
+if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether or not to look for GNOME" >&5
$as_echo_n "checking whether or not to look for GNOME... " >&6; }
# Check whether --enable-gnome-check was given.
@@ -7232,8 +7194,7 @@ $as_echo "yes" >&6; };
datadir='${prefix}/Vim.app/Contents/Resources'
- SKIP_GTK=YES;
- SKIP_GTK2=YES;
+ SKIP_GTK2=YES;
SKIP_GNOME=YES;
SKIP_MOTIF=YES;
SKIP_ATHENA=YES;
@@ -7249,34 +7210,7 @@ fi
-
-if test -z "$SKIP_GTK"; then
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-gtk-prefix argument" >&5
-$as_echo_n "checking --with-gtk-prefix argument... " >&6; }
-
-# Check whether --with-gtk-prefix was given.
-if test "${with_gtk_prefix+set}" = set; then :
- withval=$with_gtk_prefix; gtk_config_prefix="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gtk_config_prefix" >&5
-$as_echo "$gtk_config_prefix" >&6; }
-else
- gtk_config_prefix=""; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-gtk-exec-prefix argument" >&5
-$as_echo_n "checking --with-gtk-exec-prefix argument... " >&6; }
-
-# Check whether --with-gtk-exec-prefix was given.
-if test "${with_gtk_exec_prefix+set}" = set; then :
- withval=$with_gtk_exec_prefix; gtk_config_exec_prefix="$withval"; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gtk_config_prefix" >&5
-$as_echo "$gtk_config_prefix" >&6; }
-else
- gtk_config_exec_prefix=""; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
+if test -z "$SKIP_GTK2"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-gtktest argument" >&5
$as_echo_n "checking --disable-gtktest argument... " >&6; }
@@ -7295,104 +7229,6 @@ $as_echo "gtk test enabled" >&6; }
$as_echo "gtk test disabled" >&6; }
fi
- if test "x$gtk_config_prefix" != "x" ; then
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
- fi
- if test "x$gtk_config_exec_prefix" != "x" ; then
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
- fi
- if test "X$GTK_CONFIG" = "X"; then
- # Extract the first word of "gtk-config", so it can be a program name with args.
-set dummy gtk-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GTK_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $GTK_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_GTK_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no"
- ;;
-esac
-fi
-GTK_CONFIG=$ac_cv_path_GTK_CONFIG
-if test -n "$GTK_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_CONFIG" >&5
-$as_echo "$GTK_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "X$GTK_CONFIG" = "Xno"; then
- # Extract the first word of "gtk12-config", so it can be a program name with args.
-set dummy gtk12-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GTK12_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $GTK12_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_GTK12_CONFIG="$GTK12_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_GTK12_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_GTK12_CONFIG" && ac_cv_path_GTK12_CONFIG="no"
- ;;
-esac
-fi
-GTK12_CONFIG=$ac_cv_path_GTK12_CONFIG
-if test -n "$GTK12_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK12_CONFIG" >&5
-$as_echo "$GTK12_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- GTK_CONFIG="$GTK12_CONFIG"
- fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using GTK configuration program $GTK_CONFIG" >&5
-$as_echo "Using GTK configuration program $GTK_CONFIG" >&6; }
- fi
if test "X$PKG_CONFIG" = "X"; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
@@ -7437,8 +7273,7 @@ fi
fi
- if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
- if test "X$SKIP_GTK2" != "XYES"; then
+ if test "x$PKG_CONFIG" != "xno"; then
if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
{
@@ -7459,18 +7294,6 @@ $as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; }
gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
}
- elif test "X$GTK_CONFIG" != "Xno"; then
- {
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBDIR=
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- }
else
no_gtk=yes
fi
@@ -7482,7 +7305,7 @@ $as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; }
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
- rm -f conf.gtktest
+ rm -f conf.gtktest
if test "$cross_compiling" = yes; then :
echo $ac_n "cross compiling; assumed OK... $ac_c"
else
@@ -7544,8 +7367,8 @@ $as_echo "yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_ve
$as_echo "found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&6; }
fi
GUI_LIB_LOC="$GTK_LIBDIR"
- GTK_LIBNAME="$GTK_LIBS"
- GUI_INC_LOC="$GTK_CFLAGS"
+ GTK_LIBNAME="$GTK_LIBS"
+ GUI_INC_LOC="$GTK_CFLAGS"
else
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@@ -7565,170 +7388,24 @@ $as_echo "no" >&6; }
rm -f conf.gtktest
- if test "x$GTK_CFLAGS" != "x"; then
- SKIP_ATHENA=YES
- SKIP_NEXTAW=YES
- SKIP_MOTIF=YES
- GUITYPE=GTK
-
- fi
- fi
-
- if test "x$GUITYPE" != "xGTK"; then
- SKIP_GTK2=YES
-
- if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
- {
- min_gtk_version=1.1.16
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK - version >= $min_gtk_version" >&5
-$as_echo_n "checking for GTK - version >= $min_gtk_version... " >&6; }
- no_gtk=""
- if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
- && $PKG_CONFIG --exists gtk+-2.0; then
- {
- GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
- GTK_LIBDIR=`$PKG_CONFIG --libs-only-L gtk+-2.0`
- GTK_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
- gtk_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- gtk_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- }
- elif test "X$GTK_CONFIG" != "Xno"; then
- {
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBDIR=
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- }
- else
- no_gtk=yes
- fi
-
- if test "x$enable_gtktest" = "xyes" -a "x$no_gtk" = "x"; then
- {
- ac_save_CFLAGS="$CFLAGS"
- ac_save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $GTK_CFLAGS"
- LIBS="$LIBS $GTK_LIBS"
-
- rm -f conf.gtktest
- if test "$cross_compiling" = yes; then :
- echo $ac_n "cross compiling; assumed OK... $ac_c"
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-
-int
-main ()
-{
-int major, minor, micro;
-char *tmp_version;
-
-system ("touch conf.gtktest");
-
-/* HP/UX 9 (%@#!) writes to sscanf strings */
-tmp_version = g_strdup("$min_gtk_version");
-if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_gtk_version");
- exit(1);
- }
-
-if ((gtk_major_version > major) ||
- ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
- ((gtk_major_version == major) && (gtk_minor_version == minor) &&
- (gtk_micro_version >= micro)))
-{
- return 0;
-}
-return 1;
-}
-
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- no_gtk=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+ if test "x$GTK_CFLAGS" != "x"; then
+ SKIP_ATHENA=YES
+ SKIP_NEXTAW=YES
+ SKIP_MOTIF=YES
+ GUITYPE=GTK
- CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
- }
fi
- if test "x$no_gtk" = x ; then
- if test "x$enable_gtktest" = "xyes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&5
-$as_echo "yes; found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&5
-$as_echo "found version $gtk_major_version.$gtk_minor_version.$gtk_micro_version" >&6; }
- fi
- GTK_LIBNAME="$GTK_LIBS"
- GUI_INC_LOC="$GTK_CFLAGS"
- else
- {
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- GTK_CFLAGS=""
- GTK_LIBS=""
- :
- }
- fi
- }
- else
- GTK_CFLAGS=""
- GTK_LIBS=""
- :
fi
+ if test "x$GUITYPE" = "xGTK"; then
+ $as_echo "#define HAVE_GTK2 1" >>confdefs.h
+ if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
+ || test "0$gtk_minor_version" -ge 2; then
+ $as_echo "#define HAVE_GTK_MULTIHEAD 1" >>confdefs.h
- rm -f conf.gtktest
-
- if test "x$GTK_CFLAGS" != "x"; then
- SKIP_ATHENA=YES
- SKIP_NEXTAW=YES
- SKIP_MOTIF=YES
- GUITYPE=GTK
-
- fi
fi
- fi
- if test "x$GUITYPE" = "xGTK"; then
- if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
- -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: this GTK version is old; version 1.2.3 or later is recommended" >&5
-$as_echo "this GTK version is old; version 1.2.3 or later is recommended" >&6; }
- else
+ if test -z "$SKIP_GNOME"; then
{
- if test "0$gtk_major_version" -ge 2; then
- $as_echo "#define HAVE_GTK2 1" >>confdefs.h
-
- if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
- || test "0$gtk_minor_version" -ge 2 \
- || test "0$gtk_major_version" -gt 2; then
- $as_echo "#define HAVE_GTK_MULTIHEAD 1" >>confdefs.h
-
- fi
- fi
- if test -z "$SKIP_GNOME"; then
- {
@@ -7771,7 +7448,7 @@ else
fi
- if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
+ if test "x$want_gnome" = xyes; then
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgnomeui-2.0" >&5
$as_echo_n "checking for libgnomeui-2.0... " >&6; }
@@ -7802,106 +7479,13 @@ $as_echo "not found" >&6; }
fi
fi
}
- elif test "x$want_gnome" = xyes; then
- {
- # Extract the first word of "gnome-config", so it can be a program name with args.
-set dummy gnome-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GNOME_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $GNOME_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_GNOME_CONFIG="$GNOME_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_GNOME_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_GNOME_CONFIG" && ac_cv_path_GNOME_CONFIG="no"
- ;;
-esac
-fi
-GNOME_CONFIG=$ac_cv_path_GNOME_CONFIG
-if test -n "$GNOME_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNOME_CONFIG" >&5
-$as_echo "$GNOME_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- if test "$GNOME_CONFIG" = "no"; then
- no_gnome_config="yes"
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $GNOME_CONFIG works" >&5
-$as_echo_n "checking if $GNOME_CONFIG works... " >&6; }
- if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
- GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
- GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
- have_gnome=yes
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- no_gnome_config="yes"
- fi
- fi
-
- if test x$exec_prefix = xNONE; then
- if test x$prefix = xNONE; then
- gnome_prefix=$ac_default_prefix/lib
- else
- gnome_prefix=$prefix/lib
- fi
- else
- gnome_prefix=`eval echo \`echo $libdir\``
- fi
-
- if test "$no_gnome_config" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnomeConf.sh file in $gnome_prefix" >&5
-$as_echo_n "checking for gnomeConf.sh file in $gnome_prefix... " >&6; }
- if test -f $gnome_prefix/gnomeConf.sh; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
-$as_echo "found" >&6; }
- echo "loading gnome configuration from" \
- "$gnome_prefix/gnomeConf.sh"
- . $gnome_prefix/gnomeConf.sh
- have_gnome=yes
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
- if test x = xfail; then
- as_fn_error "Could not find the gnomeConf.sh file that is generated by gnome-libs install" "$LINENO" 5
- fi
- fi
- fi
- }
fi
- if test x$have_gnome = xyes ; then
- $as_echo "#define FEAT_GUI_GNOME 1" >>confdefs.h
+ if test "x$have_gnome" = xyes ; then
+ $as_echo "#define FEAT_GUI_GNOME 1" >>confdefs.h
- GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
- GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
- fi
- }
+ GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
+ GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
fi
}
fi
@@ -8467,7 +8051,7 @@ if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
$as_echo "no GUI selected; fontset has been disabled" >&6; }
enable_fontset="no"
fi
-if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
+if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: GTK+ 2 GUI selected; fontset has been disabled" >&5
$as_echo "GTK+ 2 GUI selected; fontset has been disabled" >&6; }
enable_fontset="no"
diff --git a/src/configure.in b/src/configure.in
index f44cf0f76..043eb329e 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -183,7 +183,7 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
dnl or Motif, Athena or GTK GUI is used.
AC_CHECK_HEADER(Carbon/Carbon.h, CARBON=yes)
if test "x$CARBON" = "xyes"; then
- if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk -a "X$enable_gui" != Xgtk2; then
+ if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != Xathena -a "X$enable_gui" != Xgtk2; then
with_x=no
fi
fi
@@ -1156,7 +1156,6 @@ AC_ARG_ENABLE(xim,
[ --enable-xim Include XIM input support.],
AC_MSG_RESULT($enable_xim),
[enable_xim="auto"; AC_MSG_RESULT(defaulting to auto)])
-dnl defining FEAT_XIM is delayed, so that it can be disabled for older GTK
AC_MSG_CHECKING(--enable-fontset argument)
AC_ARG_ENABLE(fontset,
@@ -1296,7 +1295,7 @@ test "x$with_x" = xno -a "x$MACOSX" != "xyes" -a "x$QNX" != "xyes" && enable_gui
AC_MSG_CHECKING(--enable-gui argument)
AC_ARG_ENABLE(gui,
- [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
+ [ --enable-gui[=OPTS] X11 GUI [default=auto] [OPTS=auto/no/gtk2/gnome2/motif/athena/neXtaw/photon/carbon]], , enable_gui="auto")
dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
dnl Do not use character classes for portability with old tools.
@@ -1304,7 +1303,6 @@ enable_gui_canon=`echo "_$enable_gui" | \
sed 's/[[ _+-]]//g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
dnl Skip everything by default.
-SKIP_GTK=YES
SKIP_GTK2=YES
SKIP_GNOME=YES
SKIP_MOTIF=YES
@@ -1343,24 +1341,16 @@ else
case "$enable_gui_canon" in
no|none) AC_MSG_RESULT(no GUI support) ;;
yes|""|auto) AC_MSG_RESULT(yes/auto - automatic GUI support)
- SKIP_GTK=
SKIP_GTK2=
SKIP_GNOME=
SKIP_MOTIF=
SKIP_ATHENA=
SKIP_NEXTAW=
SKIP_CARBON=;;
- gtk) AC_MSG_RESULT(GTK+ 1.x GUI support)
- SKIP_GTK=;;
gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
- SKIP_GTK=
SKIP_GTK2=;;
- gnome) AC_MSG_RESULT(GNOME 1.x GUI support)
- SKIP_GNOME=
- SKIP_GTK=;;
gnome2) AC_MSG_RESULT(GNOME 2.x GUI support)
SKIP_GNOME=
- SKIP_GTK=
SKIP_GTK2=;;
motif) AC_MSG_RESULT(Motif GUI support)
SKIP_MOTIF=;;
@@ -1373,32 +1363,20 @@ else
fi
-if test "x$SKIP_GTK" != "xYES" -a "$enable_gui_canon" != "gtk" -a "$enable_gui_canon" != "gtk2"; then
- AC_MSG_CHECKING(whether or not to look for GTK)
- AC_ARG_ENABLE(gtk-check,
- [ --enable-gtk-check If auto-select GUI, check for GTK [default=yes]],
- , enable_gtk_check="yes")
- AC_MSG_RESULT($enable_gtk_check)
- if test "x$enable_gtk_check" = "xno"; then
- SKIP_GTK=YES
- SKIP_GNOME=YES
- fi
-fi
-
if test "x$SKIP_GTK2" != "xYES" -a "$enable_gui_canon" != "gtk2" \
-a "$enable_gui_canon" != "gnome2"; then
AC_MSG_CHECKING(whether or not to look for GTK+ 2)
AC_ARG_ENABLE(gtk2-check,
- [ --enable-gtk2-check If GTK GUI, check for GTK+ 2 [default=yes]],
+ [ --enable-gtk2-check If auto-select GUI, check for GTK+ 2 [default=yes]],
, enable_gtk2_check="yes")
AC_MSG_RESULT($enable_gtk2_check)
if test "x$enable_gtk2_check" = "xno"; then
SKIP_GTK2=YES
+ SKIP_GNOME=YES
fi
fi
-if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome" \
- -a "$enable_gui_canon" != "gnome2"; then
+if test "x$SKIP_GNOME" != "xYES" -a "$enable_gui_canon" != "gnome2"; then
AC_MSG_CHECKING(whether or not to look for GNOME)
AC_ARG_ENABLE(gnome-check,
[ --enable-gnome-check If GTK GUI, check for GNOME [default=no]],
@@ -1472,7 +1450,6 @@ if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
datadir='${prefix}/Vim.app/Contents/Resources'
dnl skip everything else
- SKIP_GTK=YES;
SKIP_GTK2=YES;
SKIP_GNOME=YES;
SKIP_MOTIF=YES;
@@ -1482,12 +1459,8 @@ if test "x$MACOSX" = "xyes" -a -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
SKIP_CARBON=YES
fi
-dnl
-dnl Get the cflags and libraries from the gtk-config script
-dnl
-
dnl define an autoconf function to check for a specified version of GTK, and
-dnl try to compile/link a GTK program. this gets used once for GTK 1.1.16.
+dnl try to compile/link a GTK program.
dnl
dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for GTK, and define GTK_CFLAGS, GTK_LIBDIR and GTK_LIBS
@@ -1496,7 +1469,7 @@ AC_DEFUN(AM_PATH_GTK,
[
if test "X$GTK_CONFIG" != "Xno" -o "X$PKG_CONFIG" != "Xno"; then
{
- min_gtk_version=ifelse([$1], ,0.99.7,$1)
+ min_gtk_version=ifelse([$1], ,2.2.0,$1)
AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
no_gtk=""
if (test "X$SKIP_GTK2" != "XYES" -a "X$PKG_CONFIG" != "Xno") \
@@ -1515,18 +1488,6 @@ AC_DEFUN(AM_PATH_GTK,
gtk_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
}
- elif test "X$GTK_CONFIG" != "Xno"; then
- {
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
- GTK_LIBDIR=
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
- gtk_major_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
- gtk_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
- gtk_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
- }
else
no_gtk=yes
fi
@@ -1539,8 +1500,7 @@ AC_DEFUN(AM_PATH_GTK,
LIBS="$LIBS $GTK_LIBS"
dnl
- dnl Now check if the installed GTK is sufficiently new. (Also sanity
- dnl checks the results of gtk-config to some extent
+ dnl Now check if the installed GTK is sufficiently new.
dnl
rm -f conf.gtktest
AC_TRY_RUN([
@@ -1642,7 +1602,7 @@ AC_DEFUN([GNOME_INIT_HOOK],
fi,
want_gnome=yes)
- if test "x$want_gnome" = xyes -a "0$gtk_major_version" -ge 2; then
+ if test "x$want_gnome" = xyes; then
{
AC_MSG_CHECKING(for libgnomeui-2.0)
if $PKG_CONFIG --exists libgnomeui-2.0; then
@@ -1669,51 +1629,6 @@ AC_DEFUN([GNOME_INIT_HOOK],
fi
fi
}
- elif test "x$want_gnome" = xyes; then
- {
- AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
- if test "$GNOME_CONFIG" = "no"; then
- no_gnome_config="yes"
- else
- AC_MSG_CHECKING(if $GNOME_CONFIG works)
- if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
- AC_MSG_RESULT(yes)
- GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome gnomeui`"
- GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
- GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
- $1
- else
- AC_MSG_RESULT(no)
- no_gnome_config="yes"
- fi
- fi
-
- if test x$exec_prefix = xNONE; then
- if test x$prefix = xNONE; then
- gnome_prefix=$ac_default_prefix/lib
- else
- gnome_prefix=$prefix/lib
- fi
- else
- gnome_prefix=`eval echo \`echo $libdir\``
- fi
-
- if test "$no_gnome_config" = "yes"; then
- AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
- if test -f $gnome_prefix/gnomeConf.sh; then
- AC_MSG_RESULT(found)
- echo "loading gnome configuration from" \
- "$gnome_prefix/gnomeConf.sh"
- . $gnome_prefix/gnomeConf.sh
- $1
- else
- AC_MSG_RESULT(not found)
- if test x$2 = xfail; then
- AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
- fi
- fi
- fi
- }
fi
])
@@ -1723,21 +1638,9 @@ AC_DEFUN([GNOME_INIT],[
dnl ---------------------------------------------------------------------------
-dnl Check for GTK. First checks for gtk-config, cause it needs that to get the
-dnl correct compiler flags. Then checks for GTK 1.1.16. If that fails, then
-dnl it checks for 1.0.6. If both fail, then continue on for Motif as before...
+dnl Check for GTK2. If it fails, then continue on for Motif as before...
dnl ---------------------------------------------------------------------------
-if test -z "$SKIP_GTK"; then
-
- AC_MSG_CHECKING(--with-gtk-prefix argument)
- AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)],
- gtk_config_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
- gtk_config_prefix=""; AC_MSG_RESULT(no))
-
- AC_MSG_CHECKING(--with-gtk-exec-prefix argument)
- AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
- gtk_config_exec_prefix="$withval"; AC_MSG_RESULT($gtk_config_prefix),
- gtk_config_exec_prefix=""; AC_MSG_RESULT(no))
+if test -z "$SKIP_GTK2"; then
AC_MSG_CHECKING(--disable-gtktest argument)
AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
@@ -1748,89 +1651,41 @@ if test -z "$SKIP_GTK"; then
AC_MSG_RESULT(gtk test disabled)
fi
- if test "x$gtk_config_prefix" != "x" ; then
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
- fi
- if test "x$gtk_config_exec_prefix" != "x" ; then
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
- fi
- if test "X$GTK_CONFIG" = "X"; then
- AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
- if test "X$GTK_CONFIG" = "Xno"; then
- dnl Some distributions call it gtk12-config, annoying!
- AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no)
- GTK_CONFIG="$GTK12_CONFIG"
- fi
- else
- AC_MSG_RESULT(Using GTK configuration program $GTK_CONFIG)
- fi
if test "X$PKG_CONFIG" = "X"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
- if test "x$GTK_CONFIG:$PKG_CONFIG" != "xno:no"; then
+ if test "x$PKG_CONFIG" != "xno"; then
dnl First try finding version 2.2.0 or later. The 2.0.x series has
dnl problems (bold fonts, --remote doesn't work).
- if test "X$SKIP_GTK2" != "XYES"; then
- AM_PATH_GTK(2.2.0,
- [GUI_LIB_LOC="$GTK_LIBDIR"
- GTK_LIBNAME="$GTK_LIBS"
- GUI_INC_LOC="$GTK_CFLAGS"], )
- if test "x$GTK_CFLAGS" != "x"; then
- SKIP_ATHENA=YES
- SKIP_NEXTAW=YES
- SKIP_MOTIF=YES
- GUITYPE=GTK
- AC_SUBST(GTK_LIBNAME)
- fi
- fi
-
- dnl If there is no 2.2.0 or later try the 1.x.x series. We require at
- dnl least GTK 1.1.16. 1.0.6 doesn't work. 1.1.1 to 1.1.15
- dnl were test versions.
- if test "x$GUITYPE" != "xGTK"; then
- SKIP_GTK2=YES
- AM_PATH_GTK(1.1.16,
- [GTK_LIBNAME="$GTK_LIBS"
- GUI_INC_LOC="$GTK_CFLAGS"], )
- if test "x$GTK_CFLAGS" != "x"; then
- SKIP_ATHENA=YES
- SKIP_NEXTAW=YES
- SKIP_MOTIF=YES
- GUITYPE=GTK
- AC_SUBST(GTK_LIBNAME)
- fi
+ AM_PATH_GTK(2.2.0,
+ [GUI_LIB_LOC="$GTK_LIBDIR"
+ GTK_LIBNAME="$GTK_LIBS"
+ GUI_INC_LOC="$GTK_CFLAGS"], )
+ if test "x$GTK_CFLAGS" != "x"; then
+ SKIP_ATHENA=YES
+ SKIP_NEXTAW=YES
+ SKIP_MOTIF=YES
+ GUITYPE=GTK
+ AC_SUBST(GTK_LIBNAME)
fi
fi
- dnl Give a warning if GTK is older than 1.2.3
if test "x$GUITYPE" = "xGTK"; then
- if test "$gtk_major_version" = 1 -a "0$gtk_minor_version" -lt 2 \
- -o "$gtk_major_version" = 1 -a "$gtk_minor_version" = 2 -a "0$gtk_micro_version" -lt 3; then
- AC_MSG_RESULT(this GTK version is old; version 1.2.3 or later is recommended)
- else
+ AC_DEFINE(HAVE_GTK2)
+ if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
+ || test "0$gtk_minor_version" -ge 2; then
+ AC_DEFINE(HAVE_GTK_MULTIHEAD)
+ fi
+ dnl
+ dnl if GTK exists, then check for GNOME.
+ dnl
+ if test -z "$SKIP_GNOME"; then
{
- if test "0$gtk_major_version" -ge 2; then
- AC_DEFINE(HAVE_GTK2)
- if test "$gtk_minor_version" = 1 -a "0$gtk_micro_version" -ge 1 \
- || test "0$gtk_minor_version" -ge 2 \
- || test "0$gtk_major_version" -gt 2; then
- AC_DEFINE(HAVE_GTK_MULTIHEAD)
- fi
- fi
- dnl
- dnl if GTK exists, and it's not the 1.0.x series, then check for GNOME.
- dnl
- if test -z "$SKIP_GNOME"; then
- {
- GNOME_INIT_HOOK([have_gnome=yes])
- if test x$have_gnome = xyes ; then
- AC_DEFINE(FEAT_GUI_GNOME)
- GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
- GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
- fi
- }
+ GNOME_INIT_HOOK([have_gnome=yes])
+ if test "x$have_gnome" = xyes ; then
+ AC_DEFINE(FEAT_GUI_GNOME)
+ GUI_INC_LOC="$GUI_INC_LOC $GNOME_INCLUDEDIR"
+ GTK_LIBNAME="$GTK_LIBNAME $GNOME_LIBDIR $GNOME_LIBS"
fi
}
fi
@@ -2088,7 +1943,7 @@ if test "x$GUITYPE" = "xNONE" -a "$enable_fontset" = "yes"; then
AC_MSG_RESULT(no GUI selected; fontset has been disabled)
enable_fontset="no"
fi
-if test "x$GUITYPE:$enable_fontset" = "xGTK:yes" -a "0$gtk_major_version" -ge 2; then
+if test "x$GUITYPE:$enable_fontset" = "xGTK:yes"; then
AC_MSG_RESULT(GTK+ 2 GUI selected; fontset has been disabled)
enable_fontset="no"
fi
diff --git a/src/eval.c b/src/eval.c
index 7457677c1..bf33cdddd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -11813,9 +11813,7 @@ f_has(argvars, rettv)
#endif
#ifdef FEAT_GUI_GTK
"gui_gtk",
-# ifdef HAVE_GTK2
"gui_gtk2",
-# endif
#endif
#ifdef FEAT_GUI_GNOME
"gui_gnome",
diff --git a/src/globals.h b/src/globals.h
index c9bfc1fe8..4192bd765 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -847,13 +847,7 @@ EXTERN int* (*iconv_errno) (void);
#ifdef FEAT_XIM
# ifdef FEAT_GUI_GTK
-# ifdef HAVE_GTK2
EXTERN GtkIMContext *xic INIT(= NULL);
-# else
-EXTERN GdkICAttr *xic_attr INIT(= NULL);
-EXTERN GdkIC *xic INIT(= NULL);
-EXTERN char *draw_feedback INIT(= NULL);
-# endif
/*
* Start and end column of the preedit area in virtual columns from the start
* of the text line. When there is no preedit area they are set to MAXCOL.
@@ -1402,7 +1396,7 @@ EXTERN char_u e_fontset[] INIT(= N_("E234: Unknown fontset: %s"));
|| defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN)
EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s"));
#endif
-#if (defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)) && !defined(HAVE_GTK2)
+#if defined(FEAT_GUI_X11) && !defined(HAVE_GTK2)
EXTERN char_u e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width"));
#endif
EXTERN char_u e_internal[] INIT(= N_("E473: Internal error"));
diff --git a/src/gui.c b/src/gui.c
index 33f7844e0..a77489381 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -2261,7 +2261,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
/* print the string so far if it's the last character or there is
* a composing character. */
if (i + cl >= len || (comping && i > start) || dowide
-# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
+# if defined(FEAT_GUI_X11)
|| (cn > 1
# ifdef FEAT_XFONTSET
/* No fontset: At least draw char after wide char at
@@ -2293,7 +2293,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
start += cl;
}
-# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
+# if defined(FEAT_GUI_X11)
/* No fontset: draw a space to fill the gap after a wide char
* */
if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0
diff --git a/src/gui.h b/src/gui.h
index 875b5e423..d8223d39d 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -235,13 +235,8 @@ typedef long guicolor_T; /* handle for a GUI color; for X11 this should
actual color */
#ifdef FEAT_GUI_GTK
-# ifdef HAVE_GTK2
typedef PangoFontDescription *GuiFont; /* handle for a GUI font */
typedef PangoFontDescription *GuiFontset; /* handle for a GUI fontset */
-# else
- typedef GdkFont *GuiFont; /* handle for a GUI font */
- typedef GdkFont *GuiFontset; /* handle for a GUI fontset */
-# endif
# define NOFONT (GuiFont)NULL
# define NOFONTSET (GuiFontset)NULL
#else
@@ -402,24 +397,15 @@ typedef struct Gui
GdkColor *fgcolor; /* GDK-styled foreground color */
GdkColor *bgcolor; /* GDK-styled background color */
GdkColor *spcolor; /* GDK-styled special color */
-# ifndef HAVE_GTK2
- GuiFont current_font;
-# endif
GdkGC *text_gc; /* cached GC for normal text */
-# ifdef HAVE_GTK2
PangoContext *text_context; /* the context used for all text */
PangoFont *ascii_font; /* cached font for ASCII strings */
PangoGlyphString *ascii_glyphs; /* cached code point -> glyph map */
-# endif
# ifdef FEAT_GUI_TABLINE
GtkWidget *tabline; /* tab pages line handle */
# endif
GtkAccelGroup *accel_group;
-# ifndef HAVE_GTK2
- GtkWidget *fontdlg; /* font selection dialog window */
- char_u *fontname; /* font name from font selection dialog */
-# endif
GtkWidget *filedlg; /* file selection dialog */
char_u *browse_fname; /* file name from filedlg */
#endif /* FEAT_GUI_GTK */
diff --git a/src/gui_beval.c b/src/gui_beval.c
index 90bef8b50..f9f7e0004 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -157,9 +157,6 @@ static void pointer_event __ARGS((BalloonEval *, int, int, unsigned));
static void key_event __ARGS((BalloonEval *, unsigned, int));
static gint timeout_cb __ARGS((gpointer));
static gint balloon_expose_event_cb __ARGS((GtkWidget *, GdkEventExpose *, gpointer));
-# ifndef HAVE_GTK2
-static void balloon_draw_cb __ARGS((GtkWidget *, GdkRectangle *, gpointer));
-# endif
#else
static void addEventHandler __ARGS((Widget, BalloonEval *));
static void removeEventHandler __ARGS((BalloonEval *));
@@ -534,9 +531,7 @@ target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
cancelBalloon(beval);
break;
case GDK_BUTTON_PRESS:
-# ifdef HAVE_GTK2
case GDK_SCROLL:
-# endif
cancelBalloon(beval);
break;
case GDK_KEY_PRESS:
@@ -676,25 +671,6 @@ balloon_expose_event_cb(GtkWidget *widget,
return FALSE; /* continue emission */
}
-# ifndef HAVE_GTK2
- static void
-balloon_draw_cb(GtkWidget *widget, GdkRectangle *area, gpointer data)
-{
- GtkWidget *child;
- GdkRectangle child_area;
-
- gtk_paint_flat_box(widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- area, widget, "tooltip",
- 0, 0, -1, -1);
-
- child = GTK_BIN(widget)->child;
-
- if (gtk_widget_intersect(child, area, &child_area))
- gtk_widget_draw(child, &child_area);
-}
-# endif
-
#else /* !FEAT_GUI_GTK */
static void
@@ -913,15 +889,13 @@ requestBalloon(beval)
}
#ifdef FEAT_GUI_GTK
-
-# ifdef HAVE_GTK2
/*
* Convert the string to UTF-8 if 'encoding' is not "utf-8".
* Replace any non-printable characters and invalid bytes sequences with
* "^X" or "<xx>" escapes, and apply SpecialKey highlighting to them.
* TAB and NL are passed through unscathed.
*/
-# define IS_NONPRINTABLE(c) (((c) < 0x20 && (c) != TAB && (c) != NL) \
+# define IS_NONPRINTABLE(c) (((c) < 0x20 && (c) != TAB && (c) != NL) \
|| (c) == DEL)
static void
set_printable_label_text(GtkLabel *label, char_u *text)
@@ -1059,8 +1033,7 @@ set_printable_label_text(GtkLabel *label, char_u *text)
gtk_label_set_attributes(label, attr_list);
pango_attr_list_unref(attr_list);
}
-# undef IS_NONPRINTABLE
-# endif /* HAVE_GTK2 */
+# undef IS_NONPRINTABLE
/*
* Draw a balloon.
@@ -1077,9 +1050,7 @@ drawBalloon(BalloonEval *beval)
int y;
int x_offset = EVAL_OFFSET_X;
int y_offset = EVAL_OFFSET_Y;
-# ifdef HAVE_GTK2
PangoLayout *layout;
-# endif
# ifdef HAVE_GTK_MULTIHEAD
GdkScreen *screen;
@@ -1094,7 +1065,6 @@ drawBalloon(BalloonEval *beval)
gtk_widget_ensure_style(beval->balloonShell);
gtk_widget_ensure_style(beval->balloonLabel);
-# ifdef HAVE_GTK2
set_printable_label_text(GTK_LABEL(beval->balloonLabel), beval->msg);
/*
* Dirty trick: Enable wrapping mode on the label's layout behind its
@@ -1102,11 +1072,11 @@ drawBalloon(BalloonEval *beval)
* builtin maximum value of about 65 Latin characters.
*/
layout = gtk_label_get_layout(GTK_LABEL(beval->balloonLabel));
-# ifdef PANGO_WRAP_WORD_CHAR
+# ifdef PANGO_WRAP_WORD_CHAR
pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
-# else
+# else
pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
-# endif
+# endif
pango_layout_set_width(layout,
/* try to come up with some reasonable width */
PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width,
@@ -1115,25 +1085,6 @@ drawBalloon(BalloonEval *beval)
/* Calculate the balloon's width and height. */
gtk_widget_size_request(beval->balloonShell, &requisition);
-# else
- gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE);
- gtk_label_set_text(GTK_LABEL(beval->balloonLabel),
- (const char *)beval->msg);
-
- /* Calculate the balloon's width and height. */
- gtk_widget_size_request(beval->balloonShell, &requisition);
- /*
- * Unfortunately, the dirty trick used above to get around the builtin
- * maximum wrap width of GtkLabel doesn't work with GTK+ 1. Thus if
- * and only if it's absolutely necessary to avoid drawing off-screen,
- * do enable wrapping now and recalculate the size request.
- */
- if (requisition.width > screen_w)
- {
- gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), TRUE);
- gtk_widget_size_request(beval->balloonShell, &requisition);
- }
-# endif
/* Compute position of the balloon area */
gdk_window_get_origin(beval->target->window, &x, &y);
@@ -1196,10 +1147,6 @@ createBalloonEvalWindow(BalloonEval *beval)
gtk_signal_connect((GtkObject*)(beval->balloonShell), "expose_event",
GTK_SIGNAL_FUNC(balloon_expose_event_cb), NULL);
-# ifndef HAVE_GTK2
- gtk_signal_connect((GtkObject*)(beval->balloonShell), "draw",
- GTK_SIGNAL_FUNC(balloon_draw_cb), NULL);
-# endif
beval->balloonLabel = gtk_label_new(NULL);
gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE);
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 6a657a3ee..52d75e4a2 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -62,53 +62,6 @@
# include <gnome.h>
#endif
-#if defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)
-# include "../pixmaps/alert.xpm"
-# include "../pixmaps/error.xpm"
-# include "../pixmaps/generic.xpm"
-# include "../pixmaps/info.xpm"
-# include "../pixmaps/quest.xpm"
-#endif
-
-#if defined(FEAT_TOOLBAR) && !defined(HAVE_GTK2)
-/*
- * Icons used by the toolbar code.
- */
-#include "../pixmaps/tb_new.xpm"
-#include "../pixmaps/tb_open.xpm"
-#include "../pixmaps/tb_close.xpm"
-#include "../pixmaps/tb_save.xpm"
-#include "../pixmaps/tb_print.xpm"
-#include "../pixmaps/tb_cut.xpm"
-#include "../pixmaps/tb_copy.xpm"
-#include "../pixmaps/tb_paste.xpm"
-#include "../pixmaps/tb_find.xpm"
-#include "../pixmaps/tb_find_next.xpm"
-#include "../pixmaps/tb_find_prev.xpm"
-#include "../pixmaps/tb_find_help.xpm"
-#include "../pixmaps/tb_exit.xpm"
-#include "../pixmaps/tb_undo.xpm"
-#include "../pixmaps/tb_redo.xpm"
-#include "../pixmaps/tb_help.xpm"
-#include "../pixmaps/tb_macro.xpm"
-#include "../pixmaps/tb_make.xpm"
-#include "../pixmaps/tb_save_all.xpm"
-#include "../pixmaps/tb_jump.xpm"
-#include "../pixmaps/tb_ctags.xpm"
-#include "../pixmaps/tb_load_session.xpm"
-#include "../pixmaps/tb_save_session.xpm"
-#include "../pixmaps/tb_new_session.xpm"
-#include "../pixmaps/tb_blank.xpm"
-#include "../pixmaps/tb_maximize.xpm"
-#include "../pixmaps/tb_split.xpm"
-#include "../pixmaps/tb_minimize.xpm"
-#include "../pixmaps/tb_shell.xpm"
-#include "../pixmaps/tb_replace.xpm"
-#include "../pixmaps/tb_vsplit.xpm"
-#include "../pixmaps/tb_maxwidth.xpm"
-#include "../pixmaps/tb_minwidth.xpm"
-#endif /* FEAT_TOOLBAR && !HAVE_GTK2 */
-
#ifdef FEAT_GUI_GTK
# include <gdk/gdkkeysyms.h>
# include <gdk/gdk.h>
@@ -137,11 +90,8 @@ typedef int GtkWidget;
static void entry_activate_cb(GtkWidget *widget, gpointer data);
static void entry_changed_cb(GtkWidget *entry, GtkWidget *dialog);
static void find_replace_cb(GtkWidget *widget, gpointer data);
-#ifndef HAVE_GTK2
-static void gui_gtk_position_in_parent(GtkWidget *parent, GtkWidget *child, gui_win_pos_T where);
-#endif
-#if defined(FEAT_TOOLBAR) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR)
/*
* Table from BuiltIn## icon indices to GTK+ stock IDs. Order must exactly
* match toolbar_names[] in menu.c! All stock icons including the "vim-*"
@@ -298,9 +248,9 @@ toolbar_button_focus_in_event(GtkWidget *widget UNUSED,
return TRUE;
}
-#endif /* FEAT_TOOLBAR && HAVE_GTK2 */
+#endif /* FEAT_TOOLBAR */
-#if (defined(FEAT_TOOLBAR) && defined(HAVE_GTK2)) || defined(PROTO)
+#if defined(FEAT_TOOLBAR) || defined(PROTO)
void
gui_gtk_register_stock_icons(void)
@@ -330,19 +280,8 @@ gui_gtk_register_stock_icons(void)
g_object_unref(factory);
}
-#endif /* FEAT_TOOLBAR && HAVE_GTK2 */
-
+#endif /* FEAT_TOOLBAR */
-/*
- * Only use accelerators when gtk_menu_ensure_uline_accel_group() is
- * available, which is in version 1.2.1. That was the first version where
- * accelerators properly worked (according to the change log).
- */
-#ifdef GTK_CHECK_VERSION
-# if GTK_CHECK_VERSION(1, 2, 1)
-# define GTK_USE_ACCEL
-# endif
-#endif
#if defined(FEAT_MENU) || defined(PROTO)
@@ -364,9 +303,7 @@ translate_mnemonic_tag(char_u *name, int use_mnemonic)
char_u *pdest;
int n_underscores = 0;
-# ifdef HAVE_GTK2
name = CONVERT_TO_UTF8(name);
-# endif
if (name == NULL)
return NULL;
@@ -401,14 +338,10 @@ translate_mnemonic_tag(char_u *name, int use_mnemonic)
*pdest = NUL;
}
-# ifdef HAVE_GTK2
CONVERT_TO_UTF8_FREE(name);
-# endif
return buf;
}
-# ifdef HAVE_GTK2
-
static void
menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget)
{
@@ -445,96 +378,6 @@ menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget)
gtk_widget_show_all(menu->id);
}
-# else /* !HAVE_GTK2 */
-
-/*
- * Create a highly customized menu item by hand instead of by using:
- *
- * gtk_menu_item_new_with_label(menu->dname);
- *
- * This is necessary, since there is no other way in GTK+ 1 to get the
- * not automatically parsed accelerator stuff right.
- */
- static void
-menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget)
-{
- GtkWidget *widget;
- GtkWidget *bin;
- GtkWidget *label;
- char_u *name;
- guint accel_key;
-
- widget = gtk_widget_new(GTK_TYPE_MENU_ITEM,
- "GtkWidget::visible", TRUE,
- "GtkWidget::sensitive", TRUE,
- /* "GtkWidget::parent", parent->submenu_id, */
- NULL);
- bin = gtk_widget_new(GTK_TYPE_HBOX,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", widget,
- "GtkBox::spacing", 16,
- NULL);
- label = gtk_widget_new(GTK_TYPE_ACCEL_LABEL,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", bin,
- "GtkAccelLabel::accel_widget", widget,
- "GtkMisc::xalign", 0.0,
- NULL);
- menu->label = label;
-
- if (menu->actext)
- gtk_widget_new(GTK_TYPE_LABEL,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", bin,
- "GtkLabel::label", menu->actext,
- "GtkMisc::xalign", 1.0,
- NULL);
-
- /*
- * Translate VIM accelerator tagging into GTK+'s. Note that since GTK uses
- * underscores as the accelerator key, we need to add an additional under-
- * score for each understore that appears in the menu name.
- */
-# ifdef GTK_USE_ACCEL
- name = translate_mnemonic_tag(menu->name,
- (p_wak[0] != 'n' || !GTK_IS_MENU_BAR(parent_widget)));
-# else
- name = translate_mnemonic_tag(menu->name, FALSE);
-# endif
-
- /* let GTK do its thing */
- accel_key = gtk_label_parse_uline(GTK_LABEL(label), (const char *)name);
- vim_free(name);
-
-# ifdef GTK_USE_ACCEL
- /* Don't add accelator if 'winaltkeys' is "no". */
- if (accel_key != GDK_VoidSymbol)
- {
- if (GTK_IS_MENU_BAR(parent_widget))
- {
- if (*p_wak != 'n')
- gtk_widget_add_accelerator(widget,
- "activate_item",
- gui.accel_group,
- accel_key, GDK_MOD1_MASK,
- (GtkAccelFlags)0);
- }
- else
- {
- gtk_widget_add_accelerator(widget,
- "activate_item",
- gtk_menu_ensure_uline_accel_group(GTK_MENU(parent_widget)),
- accel_key, 0,
- (GtkAccelFlags)0);
- }
- }
-# endif /* GTK_USE_ACCEL */
-
- menu->id = widget;
-}
-
-# endif /* !HAVE_GTK2 */
-
void
gui_mch_add_menu(vimmenu_T *menu, int idx)
{
@@ -562,18 +405,6 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
gtk_menu_shell_insert(GTK_MENU_SHELL(parent_widget), menu->id, idx);
-#ifndef HAVE_GTK2
- /*
- * The "Help" menu is a special case, and should be placed at the far
- * right hand side of the menu-bar. It's detected by its high priority.
- *
- * Right-aligning "Help" is considered bad UI design nowadays.
- * Thus lets disable this for GTK+ 2 to match the environment.
- */
- if (parent == NULL && menu->priority >= 9999)
- gtk_menu_item_right_justify(GTK_MENU_ITEM(menu->id));
-#endif
-
menu->submenu_id = gtk_menu_new();
gtk_menu_set_accel_group(GTK_MENU(menu->submenu_id), gui.accel_group);
@@ -590,117 +421,11 @@ menu_item_activate(GtkWidget *widget UNUSED, gpointer data)
{
gui_menu_cb((vimmenu_T *)data);
-# ifndef HAVE_GTK2
- /* Work around a bug in GTK+ 1: we don't seem to get a focus-in
- * event after clicking a menu item shown via :popup. */
- if (!gui.in_focus)
- gui_focus_change(TRUE);
-# endif
-
/* make sure the menu action is taken immediately */
if (gtk_main_level() > 0)
gtk_main_quit();
}
-# if defined(FEAT_TOOLBAR) && !defined(HAVE_GTK2)
-/*
- * These are the pixmaps used for the default buttons.
- * Order must exactly match toolbar_names[] in menu.c!
- */
-static char **(built_in_pixmaps[]) =
-{
- tb_new_xpm,
- tb_open_xpm,
- tb_save_xpm,
- tb_undo_xpm,
- tb_redo_xpm,
- tb_cut_xpm,
- tb_copy_xpm,
- tb_paste_xpm,
- tb_print_xpm,
- tb_help_xpm,
- tb_find_xpm,
- tb_save_all_xpm,
- tb_save_session_xpm,
- tb_new_session_xpm,
- tb_load_session_xpm,
- tb_macro_xpm,
- tb_replace_xpm,
- tb_close_xpm,
- tb_maximize_xpm,
- tb_minimize_xpm,
- tb_split_xpm,
- tb_shell_xpm,
- tb_find_prev_xpm,
- tb_find_next_xpm,
- tb_find_help_xpm,
- tb_make_xpm,
- tb_jump_xpm,
- tb_ctags_xpm,
- tb_vsplit_xpm,
- tb_maxwidth_xpm,
- tb_minwidth_xpm,
- tb_exit_xpm
-};
-
-/*
- * creates a blank pixmap using tb_blank
- */
- static void
-pixmap_create_from_xpm(char **xpm, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- *pixmap = gdk_pixmap_colormap_create_from_xpm_d(
- NULL,
- gtk_widget_get_colormap(gui.mainwin),
- mask,
- NULL,
- xpm);
-}
-
-/*
- * creates a pixmap by using a built-in number
- */
- static void
-pixmap_create_by_num(int pixmap_num, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- if (pixmap_num >= 0 && pixmap_num < (sizeof(built_in_pixmaps)
- / sizeof(built_in_pixmaps[0])))
- pixmap_create_from_xpm(built_in_pixmaps[pixmap_num], pixmap, mask);
-}
-
-/*
- * Creates a pixmap by using the pixmap "name" found in 'runtimepath'/bitmaps/
- */
- static void
-pixmap_create_by_dir(char_u *name, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- char_u full_pathname[MAXPATHL + 1];
-
- if (gui_find_bitmap(name, full_pathname, "xpm") == OK)
- *pixmap = gdk_pixmap_colormap_create_from_xpm(
- NULL,
- gtk_widget_get_colormap(gui.mainwin),
- mask,
- &gui.mainwin->style->bg[GTK_STATE_NORMAL],
- (const char *)full_pathname);
-}
-
-/*
- * Creates a pixmap by using the pixmap "fname".
- */
- static void
-pixmap_create_from_file(char_u *fname, GdkPixmap **pixmap, GdkBitmap **mask)
-{
- *pixmap = gdk_pixmap_colormap_create_from_xpm(
- NULL,
- gtk_widget_get_colormap(gui.mainwin),
- mask,
- &gui.mainwin->style->bg[GTK_STATE_NORMAL],
- (const char *)fname);
-}
-
-# endif /* FEAT_TOOLBAR && !HAVE_GTK2 */
-
void
gui_mch_add_menu_item(vimmenu_T *menu, int idx)
{
@@ -723,7 +448,6 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
}
else
{
-# ifdef HAVE_GTK2
char_u *text;
char_u *tooltip;
@@ -750,39 +474,6 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
CONVERT_TO_UTF8_FREE(text);
CONVERT_TO_UTF8_FREE(tooltip);
-
-# else /* !HAVE_GTK2 */
-
- GdkPixmap *pixmap = NULL;
- GdkBitmap *mask = NULL;
-
- /* First try user specified bitmap, then builtin, the a blank. */
- if (menu->iconfile != NULL)
- {
- char_u buf[MAXPATHL + 1];
-
- gui_find_iconfile(menu->iconfile, buf, "xpm");
- pixmap_create_from_file(buf, &pixmap, &mask);
- }
- if (pixmap == NULL && !menu->icon_builtin)
- pixmap_create_by_dir(menu->name, &pixmap, &mask);
- if (pixmap == NULL && menu->iconidx >= 0)
- pixmap_create_by_num(menu->iconidx, &pixmap, &mask);
- if (pixmap == NULL)
- pixmap_create_from_xpm(tb_blank_xpm, &pixmap, &mask);
- if (pixmap == NULL)
- return; /* should at least have blank pixmap, but if not... */
-
- menu->id = gtk_toolbar_insert_item(
- toolbar,
- (char *)(menu->dname),
- (char *)(menu->strings[MENU_INDEX_TIP]),
- (char *)(menu->dname),
- gtk_pixmap_new(pixmap, mask),
- GTK_SIGNAL_FUNC(menu_item_activate),
- (gpointer)menu,
- idx);
-# endif /* !HAVE_GTK2 */
}
}
else
@@ -837,45 +528,16 @@ gui_gtk_set_mnemonics(int enable)
{
vimmenu_T *menu;
char_u *name;
-# if !defined(HAVE_GTK2) && defined(GTK_USE_ACCEL)
- guint accel_key;
-# endif
for (menu = root_menu; menu != NULL; menu = menu->next)
{
if (menu->id == NULL)
continue;
-# if defined(HAVE_GTK2)
name = translate_mnemonic_tag(menu->name, enable);
gtk_label_set_text_with_mnemonic(GTK_LABEL(menu->label),
(const char *)name);
vim_free(name);
-# else
-# if defined(GTK_USE_ACCEL)
- name = translate_mnemonic_tag(menu->name, TRUE);
- if (name != NULL)
- {
- accel_key = gtk_label_parse_uline(GTK_LABEL(menu->label),
- (const char *)name);
- if (accel_key != GDK_VoidSymbol)
- gtk_widget_remove_accelerator(menu->id, gui.accel_group,
- accel_key, GDK_MOD1_MASK);
- if (enable && accel_key != GDK_VoidSymbol)
- gtk_widget_add_accelerator(menu->id, "activate_item",
- gui.accel_group,
- accel_key, GDK_MOD1_MASK,
- (GtkAccelFlags)0);
- vim_free(name);
- }
- if (!enable)
- {
- name = translate_mnemonic_tag(menu->name, FALSE);
- gtk_label_parse_uline(GTK_LABEL(menu->label), (const char *)name);
- vim_free(name);
- }
-# endif
-# endif
}
}
@@ -903,58 +565,7 @@ gui_mch_toggle_tearoffs(int enable)
}
#endif /* FEAT_MENU */
-
-#if defined(FEAT_TOOLBAR) && !defined(HAVE_GTK2)
-/*
- * Seems like there's a hole in the GTK Toolbar API: there's no provision for
- * removing an item from the toolbar. Therefore I need to resort to going
- * really deeply into the internal widget structures.
- *
- * <danielk> I'm not sure the statement above is true -- at least with
- * GTK+ 2 one can just call gtk_widget_destroy() and be done with it.
- * It is true though that you couldn't remove space items before GTK+ 2
- * (without digging into the internals that is). But the code below
- * doesn't seem to handle those either. Well, it's obsolete anyway.
- */
- static void
-toolbar_remove_item_by_text(GtkToolbar *tb, const char *text)
-{
- GtkContainer *container;
- GList *childl;
- GtkToolbarChild *gtbc;
-
- g_return_if_fail(tb != NULL);
- g_return_if_fail(GTK_IS_TOOLBAR(tb));
- container = GTK_CONTAINER(&tb->container);
-
- for (childl = tb->children; childl; childl = childl->next)
- {
- gtbc = (GtkToolbarChild *)childl->data;
-
- if (gtbc->type != GTK_TOOLBAR_CHILD_SPACE
- && strcmp(GTK_LABEL(gtbc->label)->label, text) == 0)
- {
- gboolean was_visible;
-
- was_visible = GTK_WIDGET_VISIBLE(gtbc->widget);
- gtk_widget_unparent(gtbc->widget);
-
- tb->children = g_list_remove_link(tb->children, childl);
- g_free(gtbc);
- g_list_free(childl);
- tb->num_children--;
-
- if (was_visible && GTK_WIDGET_VISIBLE(container))
- gtk_widget_queue_resize(GTK_WIDGET(container));
-
- break;
- }
- }
-}
-#endif /* FEAT_TOOLBAR && !HAVE_GTK2 */
-
-
-#if defined(FEAT_TOOLBAR) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR)
static int
get_menu_position(vimmenu_T *menu)
{
@@ -969,7 +580,7 @@ get_menu_position(vimmenu_T *menu)
return idx;
}
-#endif /* FEAT_TOOLBAR && HAVE_GTK2 */
+#endif /* FEAT_TOOLBAR */
#if defined(FEAT_TOOLBAR) || defined(PROTO)
@@ -981,18 +592,12 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
{
char_u *tooltip;
-# ifdef HAVE_GTK2
tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
if (tooltip == NULL || utf_valid_string(tooltip, NULL))
/* Only set the tooltip when it's valid utf-8. */
-# else
- tooltip = menu->strings[MENU_INDEX_TIP];
-# endif
gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips,
menu->id, (const char *)tooltip, NULL);
-# ifdef HAVE_GTK2
CONVERT_TO_UTF8_FREE(tooltip);
-# endif
}
}
#endif /* FEAT_TOOLBAR */
@@ -1008,16 +613,11 @@ gui_mch_destroy_menu(vimmenu_T *menu)
# ifdef FEAT_TOOLBAR
if (menu->parent != NULL && menu_is_toolbar(menu->parent->name))
{
-# ifdef HAVE_GTK2
if (menu_is_separator(menu->name))
gtk_toolbar_remove_space(GTK_TOOLBAR(gui.toolbar),
get_menu_position(menu));
else if (menu->id != NULL)
gtk_widget_destroy(menu->id);
-# else
- toolbar_remove_item_by_text(GTK_TOOLBAR(gui.toolbar),
- (const char *)menu->dname);
-# endif
}
else
# endif /* FEAT_TOOLBAR */
@@ -1054,21 +654,11 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
adjustment->page_increment = size < 3L ? 1L : size - 2L;
adjustment->step_increment = 1.0;
-#ifdef HAVE_GTK2
g_signal_handler_block(GTK_OBJECT(adjustment),
(gulong)sb->handler_id);
-#else
- gtk_signal_handler_block(GTK_OBJECT(adjustment),
- (guint)sb->handler_id);
-#endif
gtk_adjustment_changed(adjustment);
-#ifdef HAVE_GTK2
g_signal_handler_unblock(GTK_OBJECT(adjustment),
(gulong)sb->handler_id);
-#else
- gtk_signal_handler_unblock(GTK_OBJECT(adjustment),
- (guint)sb->handler_id);
-#endif
}
}
@@ -1108,7 +698,6 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
*/
if (sb != NULL)
{
-#ifdef HAVE_GTK2
dragging = TRUE;
if (sb->wp != NULL)
@@ -1139,9 +728,6 @@ adjustment_value_changed(GtkAdjustment *adjustment, gpointer data)
}
}
}
-#else
- dragging = (GTK_RANGE(sb->id)->scroll_type == GTK_SCROLL_NONE);
-#endif
}
gui_drag_scrollbar(sb, value, dragging);
@@ -1193,7 +779,7 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
/*
* Implementation of the file selector related stuff
*/
-#if defined(HAVE_GTK2) && GTK_CHECK_VERSION(2,4,0)
+#if GTK_CHECK_VERSION(2,4,0)
/* This has been disabled, because the GTK library rewrites
* ~/.recently-used.xbel every time the main loop is quit. For Vim that means
* on just about any event. */
@@ -1271,9 +857,7 @@ gui_mch_browse(int saving UNUSED,
#endif
char_u dirbuf[MAXPATHL];
-# ifdef HAVE_GTK2
title = CONVERT_TO_UTF8(title);
-# endif
/* GTK has a bug, it only works with an absolute path. */
if (initdir == NULL || *initdir == NUL)
@@ -1343,19 +927,13 @@ gui_mch_browse(int saving UNUSED,
gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg),
(const gchar *)dirbuf);
-# ifndef HAVE_GTK2
- gui_gtk_position_in_parent(GTK_WIDGET(gui.mainwin),
- GTK_WIDGET(gui.filedlg), VW_POS_MOUSE);
-# endif
gtk_widget_show(gui.filedlg);
while (gui.filedlg && GTK_WIDGET_DRAWABLE(gui.filedlg))
gtk_main_iteration_do(TRUE);
#endif
-# ifdef HAVE_GTK2
CONVERT_TO_UTF8_FREE(title);
-# endif
if (gui.browse_fname == NULL)
return NULL;
@@ -1363,8 +941,6 @@ gui_mch_browse(int saving UNUSED,
return vim_strsave(shorten_fname1(gui.browse_fname));
}
-#if defined(HAVE_GTK2) || defined(PROTO)
-
/*
* Put up a directory selector
* Returns the selected name in allocated memory, or NULL for Cancel.
@@ -1428,544 +1004,11 @@ gui_mch_browsedir(
return gui_mch_browse(0, title, NULL, NULL, initdir, NULL);
# endif
}
-#endif
#endif /* FEAT_BROWSE */
-#if defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)
-
-static char_u *dialog_textfield = NULL;
-static GtkWidget *dialog_textentry;
-
- static void
-dlg_destroy(GtkWidget *dlg)
-{
- if (dialog_textfield != NULL)
- {
- const char *text;
-
- text = gtk_entry_get_text(GTK_ENTRY(dialog_textentry));
- vim_strncpy(dialog_textfield, (char_u *)text, IOSIZE - 1);
- }
-
- /* Destroy the dialog, will break the waiting loop. */
- gtk_widget_destroy(dlg);
-}
-
-# ifdef FEAT_GUI_GNOME
- static int
-gui_gnome_dialog( int type,
- char_u *title,
- char_u *message,
- char_u *buttons,
- int dfltbutton,
- char_u *textfield)
-{
- GtkWidget *dlg;
- char *gdtype;
- char_u *buttons_copy, *p, *next;
- char **buttons_list;
- int butcount, cur;
-
- /* make a copy, so that we can insert NULs */
- if ((buttons_copy = vim_strsave(buttons)) == NULL)
- return -1;
-
- /* determine exact number of buttons and allocate array to hold them */
- for (butcount = 0, p = buttons; *p; p++)
- {
- if (*p == '\n')
- butcount++;
- }
- butcount++;
- buttons_list = g_new0(char *, butcount + 1);
-
- /* Add pixmap */
- switch (type)
- {
- case VIM_ERROR:
- gdtype = GNOME_MESSAGE_BOX_ERROR;
- break;
- case VIM_WARNING:
- gdtype = GNOME_MESSAGE_BOX_WARNING;
- break;
- case VIM_INFO:
- gdtype = GNOME_MESSAGE_BOX_INFO;
- break;
- case VIM_QUESTION:
- gdtype = GNOME_MESSAGE_BOX_QUESTION;
- break;
- default:
- gdtype = GNOME_MESSAGE_BOX_GENERIC;
- };
-
- p = buttons_copy;
- for (cur = 0; cur < butcount; ++cur)
- {
- for (next = p; *next; ++next)
- {
- if (*next == DLG_HOTKEY_CHAR)
- STRMOVE(next, next + 1);
- if (*next == DLG_BUTTON_SEP)
- {
- *next++ = NUL;
- break;
- }
- }
-
- /* this should probably go into a table, but oh well */
- if (g_strcasecmp((char *)p, "Ok") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_OK);
- else if (g_strcasecmp((char *)p, "Cancel") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_CANCEL);
- else if (g_strcasecmp((char *)p, "Yes") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_YES);
- else if (g_strcasecmp((char *)p, "No") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_NO);
- else if (g_strcasecmp((char *)p, "Close") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_CLOSE);
- else if (g_strcasecmp((char *)p, "Help") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_HELP);
- else if (g_strcasecmp((char *)p, "Apply") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_APPLY);
-#if 0
- /*
- * these aren't really used that often anyway, but are listed here as
- * placeholders in case we need them.
- */
- else if (g_strcasecmp((char *)p, "Next") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_NEXT);
- else if (g_strcasecmp((char *)p, "Prev") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_PREV);
- else if (g_strcasecmp((char *)p, "Up") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_UP);
- else if (g_strcasecmp((char *)p, "Down") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_DOWN);
- else if (g_strcasecmp((char *)p, "Font") == 0)
- buttons_list[cur] = g_strdup(GNOME_STOCK_BUTTON_FONT);
-#endif
- else
- buttons_list[cur] = g_strdup((char *)p);
-
- if (*next == NUL)
- break;
-
- p = next;
- }
- vim_free(buttons_copy);
-
- dlg = gnome_message_box_newv((const char *)message,
- (const char *)gdtype,
- (const char **)buttons_list);
- for (cur = 0; cur < butcount; ++cur)
- g_free(buttons_list[cur]);
- g_free(buttons_list);
-
- dialog_textfield = textfield;
- if (textfield != NULL)
- {
- /* Add text entry field */
- dialog_textentry = gtk_entry_new();
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dlg)->vbox), dialog_textentry,
- TRUE, TRUE, 0);
- gtk_entry_set_text(GTK_ENTRY(dialog_textentry),
- (const gchar *)textfield);
- gtk_entry_select_region(GTK_ENTRY(dialog_textentry), 0,
- STRLEN(textfield));
- gtk_entry_set_max_length(GTK_ENTRY(dialog_textentry), IOSIZE - 1);
- gtk_entry_set_position(GTK_ENTRY(dialog_textentry), STRLEN(textfield));
- gtk_widget_show(dialog_textentry);
- gtk_window_set_focus(GTK_WINDOW(dlg), dialog_textentry);
- }
-
- gtk_signal_connect_object(GTK_OBJECT(dlg), "destroy",
- GTK_SIGNAL_FUNC(dlg_destroy), GTK_OBJECT(dlg));
- gnome_dialog_set_default(GNOME_DIALOG(dlg), dfltbutton + 1);
- gui_gtk_position_in_parent(GTK_WIDGET(gui.mainwin),
- GTK_WIDGET(dlg), VW_POS_MOUSE);
-
- return (1 + gnome_dialog_run_and_close(GNOME_DIALOG(dlg)));
-}
-
-# endif /* FEAT_GUI_GNOME */
-
-typedef struct _ButtonData
-{
- int *status;
- int index;
- GtkWidget *dialog;
-} ButtonData;
-
-typedef struct _CancelData
-{
- int *status;
- int ignore_enter;
- GtkWidget *dialog;
-} CancelData;
-
- static void
-dlg_button_clicked(GtkWidget * widget, ButtonData *data)
-{
- *(data->status) = data->index + 1;
- dlg_destroy(data->dialog);
-}
-
-/*
- * This makes the Escape key equivalent to the cancel button.
- */
- static int
-dlg_key_press_event(GtkWidget *widget, GdkEventKey *event, CancelData *data)
-{
- /* Ignore hitting Enter (or Space) when there is no default button. */
- if (data->ignore_enter && (event->keyval == GDK_Return
- || event->keyval == ' '))
- return TRUE;
- else /* A different key was pressed, return to normal behavior */
- data->ignore_enter = FALSE;
-
- if (event->keyval != GDK_Escape && event->keyval != GDK_Return)
- return FALSE;
-
- /* The result value of 0 from a dialog is signaling cancelation.
- * 1 means OK. */
- *(data->status) = (event->keyval == GDK_Return);
- dlg_destroy(data->dialog);
-
- return TRUE;
-}
-
-/*
- * Callback function for when the dialog was destroyed by a window manager.
- */
- static void
-dlg_destroy_cb(int *p)
-{
- *p = TRUE; /* set dialog_destroyed to break out of the loop */
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-
- int
-gui_mch_dialog( int type, /* type of dialog */
- char_u *title, /* title of dialog */
- char_u *message, /* message text */
- char_u *buttons, /* names of buttons */
- int def_but, /* default button */
- char_u *textfield) /* text for textfield or NULL */
-{
- char_u *names;
- char_u *p;
- int i;
- int butcount;
- int dialog_status = -1;
- int dialog_destroyed = FALSE;
- int vertical;
-
- GtkWidget *dialog;
- GtkWidget *frame;
- GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *dialogmessage;
- GtkWidget *action_area;
- GtkWidget *sub_area;
- GtkWidget *separator;
- GtkAccelGroup *accel_group;
- GtkWidget *pixmap;
- GdkPixmap *icon = NULL;
- GdkBitmap *mask = NULL;
- char **icon_data = NULL;
-
- GtkWidget **button;
- ButtonData *data;
- CancelData cancel_data;
-
- /* if our pointer is currently hidden, then we should show it. */
- gui_mch_mousehide(FALSE);
-
-# ifdef FEAT_GUI_GNOME
- /* If Gnome is available, use it for the dialog. */
- if (gtk_socket_id == 0)
- return gui_gnome_dialog(type, title, message, buttons, def_but,
- textfield);
-# endif
-
- if (title == NULL)
- title = (char_u *)_("Vim dialog...");
-
- if ((type < 0) || (type > VIM_LAST_TYPE))
- type = VIM_GENERIC;
-
- /* Check 'v' flag in 'guioptions': vertical button placement. */
- vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
-
- dialog = gtk_window_new(GTK_WINDOW_DIALOG);
- gtk_window_set_title(GTK_WINDOW(dialog), (const gchar *)title);
- gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gui.mainwin));
- gtk_widget_realize(dialog);
- gdk_window_set_decorations(dialog->window, GDK_DECOR_BORDER);
- gdk_window_set_functions(dialog->window, GDK_FUNC_MOVE);
-
- cancel_data.status = &dialog_status;
- cancel_data.dialog = dialog;
- gtk_signal_connect_after(GTK_OBJECT(dialog), "key_press_event",
- GTK_SIGNAL_FUNC(dlg_key_press_event),
- (gpointer) &cancel_data);
- /* Catch the destroy signal, otherwise we don't notice a window manager
- * destroying the dialog window. */
- gtk_signal_connect_object(GTK_OBJECT(dialog), "destroy",
- GTK_SIGNAL_FUNC(dlg_destroy_cb),
- (gpointer)&dialog_destroyed);
-
- gtk_grab_add(dialog);
-
- /* this makes it look beter on Motif style window managers */
- frame = gtk_frame_new(NULL);
- gtk_container_add(GTK_CONTAINER(dialog), frame);
- gtk_widget_show(frame);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), vbox);
- gtk_widget_show(vbox);
-
- table = gtk_table_new(1, 3, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 4);
- gtk_table_set_col_spacings(GTK_TABLE(table), 8);
- gtk_container_border_width(GTK_CONTAINER(table), 4);
- gtk_box_pack_start(GTK_BOX(vbox), table, 4, 4, 0);
- gtk_widget_show(table);
-
- /* Add pixmap */
- switch (type)
- {
- case VIM_GENERIC:
- icon_data = generic_xpm;
- break;
- case VIM_ERROR:
- icon_data = error_xpm;
- break;
- case VIM_WARNING:
- icon_data = alert_xpm;
- break;
- case VIM_INFO:
- icon_data = info_xpm;
- break;
- case VIM_QUESTION:
- icon_data = quest_xpm;
- break;
- default:
- icon_data = generic_xpm;
- };
- icon = gdk_pixmap_colormap_create_from_xpm_d(NULL,
- gtk_widget_get_colormap(dialog),
- &mask, NULL, icon_data);
- if (icon)
- {
- pixmap = gtk_pixmap_new(icon, mask);
- /* gtk_misc_set_alignment(GTK_MISC(pixmap), 0.5, 0.5); */
- gtk_table_attach_defaults(GTK_TABLE(table), pixmap, 0, 1, 0, 1);
- gtk_widget_show(pixmap);
- }
-
- /* Add label */
- dialogmessage = gtk_label_new((const gchar *)message);
- gtk_table_attach_defaults(GTK_TABLE(table), dialogmessage, 1, 2, 0, 1);
- gtk_widget_show(dialogmessage);
-
- dialog_textfield = textfield;
- if (textfield != NULL)
- {
- /* Add text entry field */
- dialog_textentry = gtk_entry_new();
- gtk_widget_set_usize(dialog_textentry, 400, -2);
- gtk_box_pack_start(GTK_BOX(vbox), dialog_textentry, TRUE, TRUE, 0);
- gtk_entry_set_text(GTK_ENTRY(dialog_textentry),
- (const gchar *)textfield);
- gtk_entry_select_region(GTK_ENTRY(dialog_textentry), 0,
- STRLEN(textfield));
- gtk_entry_set_max_length(GTK_ENTRY(dialog_textentry), IOSIZE - 1);
- gtk_entry_set_position(GTK_ENTRY(dialog_textentry), STRLEN(textfield));
- gtk_widget_show(dialog_textentry);
- }
-
- /* Add box for buttons */
- action_area = gtk_hbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(action_area), 4);
- gtk_box_pack_end(GTK_BOX(vbox), action_area, FALSE, TRUE, 0);
- gtk_widget_show(action_area);
-
- /* Add a [vh]box in the hbox to center the buttons in the dialog. */
- if (vertical)
- sub_area = gtk_vbox_new(FALSE, 0);
- else
- sub_area = gtk_hbox_new(FALSE, 0);
- gtk_container_set_border_width(GTK_CONTAINER(sub_area), 0);
- gtk_box_pack_start(GTK_BOX(action_area), sub_area, TRUE, FALSE, 0);
- gtk_widget_show(sub_area);
-
- /*
- * Create the buttons.
- */
-
- /*
- * Translate the Vim accelerator character into an underscore for GTK+.
- * Double underscores to keep them in the label.
- */
- /* count the number of underscores */
- i = 1;
- for (p = buttons; *p; ++p)
- if (*p == '_')
- ++i;
-
- /* make a copy of "buttons" with the translated characters */
- names = alloc(STRLEN(buttons) + i);
- if (names == NULL)
- return -1;
-
- p = names;
- for (i = 0; buttons[i]; ++i)
- {
- if (buttons[i] == DLG_HOTKEY_CHAR)
- *p++ = '_';
- else
- {
- if (buttons[i] == '_')
- *p++ = '_';
- *p++ = buttons[i];
- }
- }
- *p = NUL;
-
- /* Count the number of buttons and allocate button[] and data[]. */
- butcount = 1;
- for (p = names; *p; ++p)
- if (*p == DLG_BUTTON_SEP)
- ++butcount;
- button = (GtkWidget **)alloc((unsigned)(butcount * sizeof(GtkWidget *)));
- data = (ButtonData *)alloc((unsigned)(butcount * sizeof(ButtonData)));
- if (button == NULL || data == NULL)
- {
- vim_free(names);
- vim_free(button);
- vim_free(data);
- return -1;
- }
-
- /* Attach the new accelerator group to the window. */
- accel_group = gtk_accel_group_new();
- gtk_accel_group_attach(accel_group, GTK_OBJECT(dialog));
-
- p = names;
- for (butcount = 0; *p; ++butcount)
- {
- char_u *next;
- GtkWidget *label;
-# ifdef GTK_USE_ACCEL
- guint accel_key;
-# endif
-
- /* Chunk out this single button. */
- for (next = p; *next; ++next)
- {
- if (*next == DLG_BUTTON_SEP)
- {
- *next++ = NUL;
- break;
- }
- }
-
- button[butcount] = gtk_button_new();
- GTK_WIDGET_SET_FLAGS(button[butcount], GTK_CAN_DEFAULT);
-
- label = gtk_accel_label_new("");
- gtk_accel_label_set_accel_widget(GTK_ACCEL_LABEL(label), dialog);
-
-# ifdef GTK_USE_ACCEL
- accel_key = gtk_label_parse_uline(GTK_LABEL(label), (const gchar *)p);
- /* Don't add accelator if 'winaltkeys' is "no". */
- if (accel_key != GDK_VoidSymbol)
- {
- gtk_widget_add_accelerator(button[butcount],
- "clicked",
- accel_group,
- accel_key, 0,
- (GtkAccelFlags)0);
- }
-# else
- (void)gtk_label_parse_uline(GTK_LABEL(label), (const gchar *)p);
-# endif
-
- gtk_container_add(GTK_CONTAINER(button[butcount]), label);
- gtk_widget_show_all(button[butcount]);
-
- data[butcount].status = &dialog_status;
- data[butcount].index = butcount;
- data[butcount].dialog = dialog;
- gtk_signal_connect(GTK_OBJECT(button[butcount]),
- (const char *)"clicked",
- GTK_SIGNAL_FUNC(dlg_button_clicked),
- (gpointer) &data[butcount]);
-
- gtk_box_pack_start(GTK_BOX(sub_area), button[butcount],
- TRUE, FALSE, 0);
- p = next;
- }
-
- vim_free(names);
-
- cancel_data.ignore_enter = FALSE;
- if (butcount > 0)
- {
- --def_but; /* 1 is first button */
- if (def_but >= butcount)
- def_but = -1;
- if (def_but >= 0)
- {
- gtk_widget_grab_focus(button[def_but]);
- gtk_widget_grab_default(button[def_but]);
- }
- else
- /* No default, ignore hitting Enter. */
- cancel_data.ignore_enter = TRUE;
- }
-
- if (textfield != NULL)
- gtk_window_set_focus(GTK_WINDOW(dialog), dialog_textentry);
-
- separator = gtk_hseparator_new();
- gtk_box_pack_end(GTK_BOX(vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show(separator);
-
- dialog_status = -1;
-
- gui_gtk_position_in_parent(GTK_WIDGET(gui.mainwin),
- GTK_WIDGET(dialog), VW_POS_MOUSE);
-
- gtk_widget_show(dialog);
-
- /* loop here until the dialog goes away */
- while (dialog_status == -1 && !dialog_destroyed
- && GTK_WIDGET_DRAWABLE(dialog))
- gtk_main_iteration_do(TRUE);
-
- if (dialog_status < 0)
- dialog_status = 0;
- if (dialog_status != 1 && textfield != NULL)
- *textfield = NUL; /* dialog was cancelled */
-
- /* let the garbage collector know that we don't need it any longer */
- gtk_accel_group_unref(accel_group);
-
- vim_free(button);
- vim_free(data);
-
- return dialog_status;
-}
-
-#endif /* FEAT_GUI_DIALOG && !HAVE_GTK2 */
-
-
-#if (defined(FEAT_GUI_DIALOG) && defined(HAVE_GTK2)) || defined(PROTO)
+#if defined(FEAT_GUI_DIALOG) || defined(PROTO)
static GtkWidget *
create_message_dialog(int type, char_u *title, char_u *message)
@@ -2316,7 +1359,7 @@ gui_mch_dialog(int type, /* type of dialog */
return response > 0 ? response : 0;
}
-#endif /* FEAT_GUI_DIALOG && HAVE_GTK2 */
+#endif /* FEAT_GUI_DIALOG */
#if defined(FEAT_MENU) || defined(PROTO)
@@ -2324,7 +1367,7 @@ gui_mch_dialog(int type, /* type of dialog */
void
gui_mch_show_popupmenu(vimmenu_T *menu)
{
-# if defined(FEAT_XIM) && defined(HAVE_GTK2)
+# if defined(FEAT_XIM)
/*
* Append a submenu for selecting an input method. This is
* currently the only way to switch input methods at runtime.
@@ -2355,7 +1398,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu)
g_object_set_data(G_OBJECT(menu->submenu_id),
"vim-has-im-menu", GINT_TO_POINTER(TRUE));
}
-# endif /* FEAT_XIM && HAVE_GTK2 */
+# endif /* FEAT_XIM */
gtk_menu_popup(GTK_MENU(menu->submenu_id),
NULL, NULL,
@@ -2377,9 +1420,7 @@ static int popup_mouse_pos;
static void
popup_menu_position_func(GtkMenu *menu UNUSED,
gint *x, gint *y,
-# ifdef HAVE_GTK2
gboolean *push_in UNUSED,
-# endif
gpointer user_data UNUSED)
{
gdk_window_get_origin(gui.drawarea->window, x, y);
@@ -2461,18 +1502,6 @@ find_key_press_event(
return TRUE;
}
- /*
- * What the **** is this for? Disabled for GTK+ 2 because due to
- * gtk_signal_connect_after() it doesn't have any effect anyway.
- * (Fortunately.)
- */
-#ifndef HAVE_GTK2
- /* block traversal resulting from those keys */
- if (event->keyval == GDK_Left
- || event->keyval == GDK_Right
- || event->keyval == GDK_space)
- return TRUE;
-#endif
/* It would be delightful if it where possible to do search history
* operations on the K_UP and K_DOWN keys here.
@@ -2481,7 +1510,6 @@ find_key_press_event(
return FALSE;
}
-#ifdef HAVE_GTK2
static GtkWidget *
create_image_button(const char *stock_id, const char *label)
{
@@ -2529,14 +1557,10 @@ convert_localized_message(char_u **buffer, const char *message)
return (const char *)*buffer;
}
-#endif /* HAVE_GTK2 */
static void
find_replace_dialog_create(char_u *arg, int do_replace)
{
-#ifndef HAVE_GTK2
- GtkWidget *frame;
-#endif
GtkWidget *hbox; /* main top down box */
GtkWidget *actionarea;
GtkWidget *table;
@@ -2547,45 +1571,26 @@ find_replace_dialog_create(char_u *arg, int do_replace)
char_u *entry_text;
int wword = FALSE;
int mcase = !p_ic;
-#ifdef HAVE_GTK2
char_u *conv_buffer = NULL;
# define CONV(message) convert_localized_message(&conv_buffer, (message))
-#else
-# define CONV(message) (message)
-#endif
frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
/* Get the search string to use. */
entry_text = get_find_dialog_text(arg, &wword, &mcase);
-#ifdef HAVE_GTK2
if (entry_text != NULL && output_conv.vc_type != CONV_NONE)
{
char_u *old_text = entry_text;
entry_text = string_convert(&output_conv, entry_text, NULL);
vim_free(old_text);
}
-#endif
/*
* If the dialog already exists, just raise it.
*/
if (frdp->dialog)
{
-#ifndef HAVE_GTK2
- /* always make the dialog appear where you want it even if the mainwin
- * has moved -- dbv */
- gui_gtk_position_in_parent(GTK_WIDGET(gui.mainwin),
- GTK_WIDGET(frdp->dialog), VW_POS_MOUSE);
- gui_gtk_synch_fonts();
-
- if (!GTK_WIDGET_VISIBLE(frdp->dialog))
- {
- gtk_widget_grab_focus(frdp->what);
- gtk_widget_show(frdp->dialog);
- }
-#endif
if (entry_text != NULL)
{
gtk_entry_set_text(GTK_ENTRY(frdp->what), (char *)entry_text);
@@ -2594,62 +1599,30 @@ find_replace_dialog_create(char_u *arg, int do_replace)
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->mcase),
(gboolean)mcase);
}
-#ifdef HAVE_GTK2
gtk_window_present(GTK_WINDOW(frdp->dialog));
-#else
- gdk_window_raise(frdp->dialog->window);
-#endif
vim_free(entry_text);
return;
}
-#ifdef HAVE_GTK2
frdp->dialog = gtk_dialog_new();
gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE);
gtk_window_set_transient_for(GTK_WINDOW(frdp->dialog), GTK_WINDOW(gui.mainwin));
gtk_window_set_destroy_with_parent(GTK_WINDOW(frdp->dialog), TRUE);
-#else
- frdp->dialog = gtk_window_new(GTK_WINDOW_DIALOG);
-#endif
if (do_replace)
{
-#ifndef HAVE_GTK2
- gtk_window_set_wmclass(GTK_WINDOW(frdp->dialog), "searchrepl", "gvim");
-#endif
gtk_window_set_title(GTK_WINDOW(frdp->dialog),
CONV(_("VIM - Search and Replace...")));
}
else
{
-#ifndef HAVE_GTK2
- gtk_window_set_wmclass(GTK_WINDOW(frdp->dialog), "search", "gvim");
-#endif
gtk_window_set_title(GTK_WINDOW(frdp->dialog),
CONV(_("VIM - Search...")));
}
-#ifndef HAVE_GTK2 /* Utter crack. Shudder. */
- gtk_widget_realize(frdp->dialog);
- gdk_window_set_decorations(frdp->dialog->window,
- GDK_DECOR_TITLE | GDK_DECOR_BORDER | GDK_DECOR_RESIZEH);
- gdk_window_set_functions(frdp->dialog->window,
- GDK_FUNC_RESIZE | GDK_FUNC_MOVE);
-#endif
-
-#ifndef HAVE_GTK2
- /* this makes it look better on Motif style window managers */
- frame = gtk_frame_new(NULL);
- gtk_container_add(GTK_CONTAINER(frdp->dialog), frame);
-#endif
-
hbox = gtk_hbox_new(FALSE, 0);
-#ifdef HAVE_GTK2
gtk_container_set_border_width(GTK_CONTAINER(hbox), 10);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(frdp->dialog)->vbox), hbox);
-#else
- gtk_container_add(GTK_CONTAINER(frame), hbox);
-#endif
if (do_replace)
table = gtk_table_new(1024, 4, FALSE);
@@ -2747,30 +1720,16 @@ find_replace_dialog_create(char_u *arg, int do_replace)
gtk_radio_button_group(GTK_RADIO_BUTTON(frdp->up)),
CONV(_("Down")));
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(frdp->down), TRUE);
-#ifdef HAVE_GTK2
gtk_container_set_border_width(GTK_CONTAINER(vbox), 2);
-#endif
gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0);
/* vbox to hold the action buttons */
actionarea = gtk_vbutton_box_new();
gtk_container_border_width(GTK_CONTAINER(actionarea), 2);
-#ifndef HAVE_GTK2
- if (do_replace)
- {
- gtk_button_box_set_layout(GTK_BUTTON_BOX(actionarea),
- GTK_BUTTONBOX_END);
- gtk_button_box_set_spacing(GTK_BUTTON_BOX(actionarea), 0);
- }
-#endif
gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0);
/* 'Find Next' button */
-#ifdef HAVE_GTK2
frdp->find = create_image_button(GTK_STOCK_FIND, _("Find Next"));
-#else
- frdp->find = gtk_button_new_with_label(_("Find Next"));
-#endif
gtk_widget_set_sensitive(frdp->find, sensitive);
gtk_signal_connect(GTK_OBJECT(frdp->find), "clicked",
@@ -2785,11 +1744,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
if (do_replace)
{
/* 'Replace' button */
-#ifdef HAVE_GTK2
frdp->replace = create_image_button(GTK_STOCK_CONVERT, _("Replace"));
-#else
- frdp->replace = gtk_button_new_with_label(_("Replace"));
-#endif
gtk_widget_set_sensitive(frdp->replace, sensitive);
GTK_WIDGET_SET_FLAGS(frdp->replace, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(actionarea), frdp->replace, FALSE, FALSE, 0);
@@ -2798,11 +1753,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
GINT_TO_POINTER(FRD_REPLACE));
/* 'Replace All' button */
-#ifdef HAVE_GTK2
frdp->all = create_image_button(GTK_STOCK_CONVERT, _("Replace All"));
-#else
- frdp->all = gtk_button_new_with_label(_("Replace All"));
-#endif
gtk_widget_set_sensitive(frdp->all, sensitive);
GTK_WIDGET_SET_FLAGS(frdp->all, GTK_CAN_DEFAULT);
gtk_box_pack_start(GTK_BOX(actionarea), frdp->all, FALSE, FALSE, 0);
@@ -2812,11 +1763,7 @@ find_replace_dialog_create(char_u *arg, int do_replace)
}
/* 'Cancel' button */
-#ifdef HAVE_GTK2
tmp = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-#else
- tmp = gtk_button_new_with_label(_("Cancel"));
-#endif
GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX(actionarea), tmp, FALSE, FALSE, 0);
gtk_signal_connect_object(GTK_OBJECT(tmp),
@@ -2827,36 +1774,15 @@ find_replace_dialog_create(char_u *arg, int do_replace)
GTK_OBJECT(frdp->dialog));
tmp = gtk_vseparator_new();
-#ifdef HAVE_GTK2
gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10);
-#else
- gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, TRUE, 0);
-#endif
-#ifndef HAVE_GTK2
- gtk_widget_grab_focus(frdp->what);
-
- /* show the frame and realize the frdp->dialog this gives us a window size
- * request that we'll use to position the window within the boundary of
- * the mainwin --dbv */
- gtk_widget_show_all(frame);
- gui_gtk_position_in_parent(GTK_WIDGET(gui.mainwin),
- GTK_WIDGET(frdp->dialog), VW_POS_MOUSE);
- gui_gtk_synch_fonts();
- gtk_widget_show_all(frdp->dialog);
-#endif
-
-#ifdef HAVE_GTK2
/* Suppress automatic show of the unused action area */
gtk_widget_hide(GTK_DIALOG(frdp->dialog)->action_area);
gtk_widget_show_all(hbox);
gtk_widget_show(frdp->dialog);
-#endif
vim_free(entry_text);
-#ifdef HAVE_GTK2
vim_free(conv_buffer);
-#endif
#undef CONV
}
@@ -2874,65 +1800,6 @@ gui_mch_replace_dialog(exarg_T *eap)
find_replace_dialog_create(eap->arg, TRUE);
}
-
-#if !defined(HAVE_GTK2) || defined(PROTO)
-/*
- * Synchronize all gui elements, which are dependant upon the
- * main text font used. Those are in esp. the find/replace dialogs.
- * If you don't understand why this should be needed, please try to
- * search for "pięść" in iso8859-2.
- *
- * (<danielk> I converted the comment above to UTF-8 to put
- * a stopper to the encoding mess. Forgive me :)
- *
- * Obsolete with GTK2.
- */
- void
-gui_gtk_synch_fonts(void)
-{
- SharedFindReplace *frdp;
- int do_replace;
-
- /* OK this loop is a bit tricky... */
- for (do_replace = 0; do_replace <= 1; ++do_replace)
- {
- frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
- if (frdp->dialog)
- {
- GtkStyle *style;
-
- /* synch the font with whats used by the text itself */
- style = gtk_style_copy(gtk_widget_get_style(frdp->what));
- gdk_font_unref(style->font);
-# ifdef FEAT_XFONTSET
- if (gui.fontset != NOFONTSET)
- style->font = gui.fontset;
- else
-# endif
- style->font = gui.norm_font;
- gdk_font_ref(style->font);
- gtk_widget_set_style(frdp->what, style);
- gtk_style_unref(style);
- if (do_replace)
- {
- style = gtk_style_copy(gtk_widget_get_style(frdp->with));
- gdk_font_unref(style->font);
-# ifdef FEAT_XFONTSET
- if (gui.fontset != NOFONTSET)
- style->font = gui.fontset;
- else
-# endif
- style->font = gui.norm_font;
- gdk_font_ref(style->font);
- gtk_widget_set_style(frdp->with, style);
- gtk_style_unref(style);
- }
- }
- }
-}
-#endif /* !HAVE_GTK2 */
-
-
/*
* Callback for actions of the find and replace dialogs
*/
@@ -2968,15 +1835,11 @@ find_replace_cb(GtkWidget *widget UNUSED, gpointer data)
if (GTK_TOGGLE_BUTTON(sfr->mcase)->active)
flags |= FRD_MATCH_CASE;
-#ifdef HAVE_GTK2
repl_text = CONVERT_FROM_UTF8(repl_text);
find_text = CONVERT_FROM_UTF8(find_text);
-#endif
rc = gui_do_findrepl(flags, find_text, repl_text, direction_down);
-#ifdef HAVE_GTK2
CONVERT_FROM_UTF8_FREE(repl_text);
CONVERT_FROM_UTF8_FREE(find_text);
-#endif
if (rc && gtk_main_level() > 0)
gtk_main_quit(); /* make sure cmd will be handled immediately */
@@ -3035,83 +1898,3 @@ ex_helpfind(eap)
* backwards compatibility anyway. */
do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp");
}
-
-#if !defined(HAVE_GTK2) || defined(PROTO) /* Crack crack crack. Brrrr. */
-
-/* gui_gtk_position_in_parent
- *
- * this function causes a child window to be placed within the boundary of
- * the parent (mainwin) window.
- *
- * you can specify where the window will be positioned by the third argument
- * (defined in gui.h):
- * VW_POS_CENTER at center of parent window
- * VW_POS_MOUSE center of child at mouse position
- * VW_POS_TOP_CENTER top of child at top of parent centered
- * horizontally about the mouse.
- *
- * NOTE: for this function to act as desired the child window must have a
- * window size requested. this can be accomplished by packing/placing
- * child widgets onto a gtk_frame widget rather than the gtk_window
- * widget...
- *
- * brent -- dbv
- */
- static void
-gui_gtk_position_in_parent(
- GtkWidget *parent,
- GtkWidget *child,
- gui_win_pos_T where)
-{
- GtkRequisition c_size;
- gint xPm, yPm;
- gint xP, yP, wP, hP, pos_x, pos_y;
-
- /* make sure the child widget is set up then get its size. */
- gtk_widget_size_request(child, &c_size);
-
- /* get origin and size of parent window */
- gdk_window_get_origin((GdkWindow *)(parent->window), &xP, &yP);
- gdk_window_get_size((GdkWindow *)(parent->window), &wP, &hP);
-
- if (c_size.width > wP || c_size.height > hP)
- {
- /* doh! maybe the user should consider giving gVim a little more
- * screen real estate */
- gtk_widget_set_uposition(child , xP + 2 , yP + 2);
- return;
- }
-
- if (where == VW_POS_MOUSE)
- {
- /* position window at mouse pointer */
- gtk_widget_get_pointer(parent, &xPm, &yPm);
- pos_x = xP + xPm - (c_size.width) / 2;
- pos_y = yP + yPm - (c_size.height) / 2;
- }
- else
- {
- /* set child x origin so it is in center of Vim window */
- pos_x = xP + (wP - c_size.width) / 2;
-
- if (where == VW_POS_TOP_CENTER)
- pos_y = yP + 2;
- else
- /* where == VW_POS_CENTER */
- pos_y = yP + (hP - c_size.height) / 2;
- }
-
- /* now, make sure the window will be inside the Vim window... */
- if (pos_x < xP)
- pos_x = xP + 2;
- if (pos_y < yP)
- pos_y = yP + 2;
- if ((pos_x + c_size.width) > (wP + xP))
- pos_x = xP + wP - c_size.width - 2;
- /* Assume 'guiheadroom' indicates the title bar height... */
- if ((pos_y + c_size.height + p_ghr / 2) > (hP + yP))
-
- gtk_widget_set_uposition(child, pos_x, pos_y);
-}
-
-#endif /* !HAVE_GTK2 */
diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c
index 2caded85d..0eb50652c 100644
--- a/src/gui_gtk_f.c
+++ b/src/gui_gtk_f.c
@@ -54,10 +54,6 @@ static void gtk_form_size_request(GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_form_size_allocate(GtkWidget *widget,
GtkAllocation *allocation);
-#ifndef HAVE_GTK2 /* this isn't needed in gtk2 */
-static void gtk_form_draw(GtkWidget *widget,
- GdkRectangle *area);
-#endif
static gint gtk_form_expose(GtkWidget *widget,
GdkEventExpose *event);
@@ -172,27 +168,6 @@ gtk_form_move(GtkForm *form,
}
}
-#if !defined(HAVE_GTK2) || defined(PROTO)
- void
-gtk_form_set_size(GtkForm *form, guint width, guint height)
-{
- g_return_if_fail(GTK_IS_FORM(form));
-
- /* prevent useless calls */
- if (form->width == width && form->height == height)
- return;
- form->width = width;
- form->height = height;
-
- /* signal the change */
-#ifdef HAVE_GTK2
- gtk_widget_queue_resize(gtk_widget_get_parent(GTK_WIDGET(form)));
-#else
- gtk_container_queue_resize(GTK_CONTAINER(GTK_WIDGET(form)->parent));
-#endif
-}
-#endif
-
void
gtk_form_freeze(GtkForm *form)
{
@@ -211,11 +186,7 @@ gtk_form_thaw(GtkForm *form)
if (!(--form->freeze_count))
{
gtk_form_position_children(form);
-#ifdef HAVE_GTK2
gtk_widget_queue_draw(GTK_WIDGET(form));
-#else
- gtk_widget_draw(GTK_WIDGET(form), NULL);
-#endif
}
}
}
@@ -259,9 +230,6 @@ gtk_form_class_init(GtkFormClass *klass)
widget_class->map = gtk_form_map;
widget_class->size_request = gtk_form_size_request;
widget_class->size_allocate = gtk_form_size_allocate;
-#ifndef HAVE_GTK2 /* not needed for GTK2 */
- widget_class->draw = gtk_form_draw;
-#endif
widget_class->expose_event = gtk_form_expose;
container_class->remove = gtk_form_remove;
@@ -421,37 +389,6 @@ gtk_form_unrealize(GtkWidget *widget)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
-#ifndef HAVE_GTK2
- static void
-gtk_form_draw(GtkWidget *widget, GdkRectangle *area)
-{
- GtkForm *form;
- GList *children;
- GtkFormChild *child;
- GdkRectangle child_area;
-
- g_return_if_fail(GTK_IS_FORM(widget));
-
- if (GTK_WIDGET_DRAWABLE(widget))
- {
- form = GTK_FORM(widget);
-
- children = form->children;
-
- while (children)
- {
- child = children->data;
-
- if (GTK_WIDGET_DRAWABLE(child->widget)
- && gtk_widget_intersect(child->widget, area, &child_area))
- gtk_widget_draw(child->widget, &child_area);
-
- children = children->next;
- }
- }
-}
-#endif /* !HAVE_GTK2 */
-
static void
gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition)
{
@@ -536,7 +473,6 @@ gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
{
-#ifdef HAVE_GTK2
GtkFormChild *formchild = tmp_list->data;
GtkWidget *child = formchild->widget;
/*
@@ -557,12 +493,6 @@ gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
gtk_widget_send_expose(child, (GdkEvent *)&child_event);
}
}
-#else /* !HAVE_GTK2 */
- GtkFormChild *child = tmp_list->data;
-
- if (event->window == child->window)
- return gtk_widget_event(child->widget, (GdkEvent *) event);
-#endif /* !HAVE_GTK2 */
}
return FALSE;
@@ -854,28 +784,12 @@ gtk_form_main_filter(GdkXEvent *gdk_xevent,
return GDK_FILTER_CONTINUE;
}
-/* Routines to set the window gravity, and check whether it is
- * functional. Extra capabilities need to be added to GDK, so
- * we don't have to use Xlib here.
- */
static void
gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
{
-#ifdef HAVE_GTK2
/* We don't check if static gravity is actually supported, because it
* results in an annoying assertion error message. */
gdk_window_set_static_gravities(window, use_static);
-#else
- XSetWindowAttributes xattributes;
-
- xattributes.win_gravity = (use_static) ? StaticGravity : NorthWestGravity;
- xattributes.bit_gravity = (use_static) ? StaticGravity : NorthWestGravity;
-
- XChangeWindowAttributes(GDK_WINDOW_XDISPLAY(window),
- GDK_WINDOW_XWINDOW(window),
- CWBitGravity | CWWinGravity,
- &xattributes);
-#endif
}
void
@@ -903,11 +817,7 @@ gtk_form_send_configure(GtkForm *form)
event.width = widget->allocation.width;
event.height = widget->allocation.height;
-#ifdef HAVE_GTK2
gtk_main_do_event((GdkEvent*)&event);
-#else
- gtk_widget_event(widget, (GdkEvent*)&event);
-#endif
}
static void
diff --git a/src/gui_gtk_f.h b/src/gui_gtk_f.h
index 767f88a5d..73b0024f8 100644
--- a/src/gui_gtk_f.h
+++ b/src/gui_gtk_f.h
@@ -62,7 +62,6 @@ void gtk_form_move(GtkForm *form, GtkWidget * widget,
void gtk_form_move_resize(GtkForm * form, GtkWidget * widget,
gint x, gint y,
gint w, gint h);
-void gtk_form_set_size(GtkForm * form, guint width, guint height);
/* These disable and enable moving and repainting respectively. If you
* want to update the layout's offsets but do not want it to repaint
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 5cbe9a3c3..23651bdb6 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -45,10 +45,8 @@
# endif
# include <gnome.h>
# include "version.h"
-# ifdef HAVE_GTK2
/* missing prototype in bonobo-dock-item.h */
extern void bonobo_dock_item_set_behavior(BonoboDockItem *dock_item, BonoboDockItemBehavior beh);
-# endif
#endif
#if !defined(FEAT_GUI_GTK) && defined(PROTO)
@@ -124,10 +122,8 @@ static const GtkTargetEntry selection_targets[] =
{
{VIMENC_ATOM_NAME, 0, TARGET_VIMENC},
{VIM_ATOM_NAME, 0, TARGET_VIM},
-#ifdef FEAT_MBYTE
{"text/html", 0, TARGET_HTML},
{"UTF8_STRING", 0, TARGET_UTF8_STRING},
-#endif
{"COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT},
{"TEXT", 0, TARGET_TEXT},
{"STRING", 0, TARGET_STRING}
@@ -142,10 +138,8 @@ static const GtkTargetEntry selection_targets[] =
static const GtkTargetEntry dnd_targets[] =
{
{"text/uri-list", 0, TARGET_TEXT_URI_LIST},
-# ifdef FEAT_MBYTE
{"text/html", 0, TARGET_HTML},
{"UTF8_STRING", 0, TARGET_UTF8_STRING},
-# endif
{"STRING", 0, TARGET_STRING},
{"text/plain", 0, TARGET_TEXT_PLAIN}
};
@@ -153,22 +147,12 @@ static const GtkTargetEntry dnd_targets[] =
#endif
-#ifdef HAVE_GTK2
/*
* "Monospace" is a standard font alias that should be present
* on all proper Pango/fontconfig installations.
*/
# define DEFAULT_FONT "Monospace 10"
-#else /* !HAVE_GTK2 */
-/*
- * This is the single only fixed width font in X11, which seems to be present
- * on all servers and available in all the variants we need.
- */
-# define DEFAULT_FONT "-adobe-courier-medium-r-normal-*-14-*-*-*-m-*-*-*"
-
-#endif /* !HAVE_GTK2 */
-
#if !(defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION))
/*
* Atoms used to communicate save-yourself from the X11 session manager. There
@@ -181,18 +165,10 @@ static GdkAtom save_yourself_atom = GDK_NONE;
/*
* Atoms used to control/reference X11 selections.
*/
-#ifdef FEAT_MBYTE
static GdkAtom html_atom = GDK_NONE;
static GdkAtom utf8_string_atom = GDK_NONE;
-#endif
-#ifndef HAVE_GTK2
-static GdkAtom compound_text_atom = GDK_NONE;
-static GdkAtom text_atom = GDK_NONE;
-#endif
static GdkAtom vim_atom = GDK_NONE; /* Vim's own special selection format */
-#ifdef FEAT_MBYTE
static GdkAtom vimenc_atom = GDK_NONE; /* Vim's extended selection format */
-#endif
/*
* Keycodes recognized by vim.
@@ -348,23 +324,13 @@ static const cmdline_option_T cmdline_options[] =
{"-fg", ARG_FOREGROUND|ARG_HAS_VALUE},
{"-foreground", ARG_FOREGROUND|ARG_HAS_VALUE},
{"-iconic", ARG_ICONIC},
-#ifdef HAVE_GTK2
{"--role", ARG_ROLE|ARG_HAS_VALUE},
-#endif
#ifdef FEAT_NETBEANS_INTG
{"-nb", ARG_NETBEANS}, /* non-standard value format */
{"-xrm", ARG_XRM|ARG_HAS_VALUE}, /* not implemented */
{"-mf", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */
{"-menufont", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */
#endif
-#if 0 /* not implemented; these arguments don't make sense for GTK+ */
- {"-boldfont", ARG_HAS_VALUE},
- {"-italicfont", ARG_HAS_VALUE},
- {"-bw", ARG_HAS_VALUE},
- {"-borderwidth", ARG_HAS_VALUE},
- {"-sw", ARG_HAS_VALUE},
- {"-scrollbarwidth", ARG_HAS_VALUE},
-#endif
/* Arguments handled by GTK (and GNOME) internally. */
{"--g-fatal-warnings", ARG_FOR_GTK},
{"--gdk-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
@@ -376,17 +342,9 @@ static const cmdline_option_T cmdline_options[] =
{"--display", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
{"--name", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
{"--class", ARG_FOR_GTK|ARG_HAS_VALUE|ARG_COMPAT_LONG},
-#ifdef HAVE_GTK2
{"--screen", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gxid-host", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--gxid-port", ARG_FOR_GTK|ARG_HAS_VALUE},
-#else /* these don't seem to exist anymore */
- {"--no-xshm", ARG_FOR_GTK},
- {"--xim-preedit", ARG_FOR_GTK|ARG_HAS_VALUE},
- {"--xim-status", ARG_FOR_GTK|ARG_HAS_VALUE},
- {"--gxid_host", ARG_FOR_GTK|ARG_HAS_VALUE},
- {"--gxid_port", ARG_FOR_GTK|ARG_HAS_VALUE},
-#endif
#ifdef FEAT_GUI_GNOME
{"--load-modules", ARG_FOR_GTK|ARG_HAS_VALUE},
{"--sm-client-id", ARG_FOR_GTK|ARG_HAS_VALUE},
@@ -412,9 +370,7 @@ static const cmdline_option_T cmdline_options[] =
static int gui_argc = 0;
static char **gui_argv = NULL;
-#ifdef HAVE_GTK2
static const char *role_argument = NULL;
-#endif
#if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
static const char *restart_command = NULL;
static char *abs_restart_command = NULL;
@@ -561,11 +517,9 @@ gui_mch_prepare(int *argc, char **argv)
case ARG_ICONIC:
found_iconic_arg = TRUE;
break;
-#ifdef HAVE_GTK2
case ARG_ROLE:
role_argument = value; /* used later in gui_mch_open() */
break;
-#endif
#ifdef FEAT_NETBEANS_INTG
case ARG_NETBEANS:
gui.dofork = FALSE; /* don't fork() when starting GUI */
@@ -859,7 +813,6 @@ focus_out_event(GtkWidget *widget UNUSED,
}
-#ifdef HAVE_GTK2
/*
* Translate a GDK key value to UTF-8 independently of the current locale.
* The output is written to string, which must have room for at least 6 bytes
@@ -935,7 +888,6 @@ keyval_to_string(unsigned int keyval, unsigned int state, char_u *string)
return len;
}
-#endif /* HAVE_GTK2 */
static int
modifiers_gdk2vim(guint state)
@@ -981,14 +933,9 @@ key_press_event(GtkWidget *widget UNUSED,
GdkEventKey *event,
gpointer data UNUSED)
{
-#ifdef HAVE_GTK2
- /* 256 bytes is way over the top, but for safety let's reduce it only
- * for GTK+ 2 where we know for sure how large the string might get.
+ /* For GTK+ 2 we know for sure how large the string might get.
* (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) */
char_u string[32], string2[32];
-#else
- char_u string[256], string2[256];
-#endif
guint key_sym;
int len;
int i;
@@ -1000,25 +947,6 @@ key_press_event(GtkWidget *widget UNUSED,
clipboard_event_time = event->time;
key_sym = event->keyval;
state = event->state;
-#ifndef HAVE_GTK2 /* deprecated */
- len = event->length;
- g_assert(len <= sizeof(string));
-#endif
-
-#ifndef HAVE_GTK2
- /*
- * It appears as if we always want to consume a key-press (there currently
- * aren't any 'return FALSE's), so we always do this: when running in a
- * GtkPlug and not a window, we must prevent emission of the key_press
- * EVENT from continuing (which is 'beyond' the level of stopping mere
- * signals by returning FALSE), otherwise things like tab/cursor-keys are
- * processed by the GtkPlug default handler, which moves input focus away
- * from us!
- * Note: This should no longer be necessary with GTK+ 2.
- */
- if (gtk_socket_id != 0)
- gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "key_press_event");
-#endif
#ifdef FEAT_XIM
if (xim_queue_key_press_event(event, TRUE))
@@ -1044,7 +972,6 @@ key_press_event(GtkWidget *widget UNUSED,
else
#endif
{
-#ifdef HAVE_GTK2
len = keyval_to_string(key_sym, state, string2);
/* Careful: convert_input() doesn't handle the NUL character.
@@ -1053,19 +980,6 @@ key_press_event(GtkWidget *widget UNUSED,
len = convert_input(string2, len, sizeof(string2));
s = string2;
-#else
-# ifdef FEAT_MBYTE
- if (input_conv.vc_type != CONV_NONE)
- {
- mch_memmove(string2, event->string, len);
- len = convert_input(string2, len, sizeof(string2));
- s = string2;
- }
- else
-# endif
- s = (char_u *)event->string;
-#endif
-
d = string;
for (i = 0; i < len; ++i)
{
@@ -1087,21 +1001,6 @@ key_press_event(GtkWidget *widget UNUSED,
state |= GDK_SHIFT_MASK;
}
-#ifndef HAVE_GTK2 /* for GTK+ 2, we handle this in keyval_to_string() */
- if ((key_sym == GDK_2 || key_sym == GDK_at) && (state & GDK_CONTROL_MASK))
- {
- string[0] = NUL; /* CTRL-2 and CTRL-@ is NUL */
- len = 1;
- }
- else if (len == 0 && (key_sym == GDK_space || key_sym == GDK_Tab))
- {
- /* When there are modifiers, these keys get zero length; we need the
- * original key here to be able to add a modifier below. */
- string[0] = (key_sym & 0xff);
- len = 1;
- }
-#endif
-
#ifdef FEAT_MENU
/* If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key
* is a menu shortcut, we ignore everything with the ALT modifier. */
@@ -1111,13 +1010,9 @@ key_press_event(GtkWidget *widget UNUSED,
|| (*p_wak == 'm'
&& len == 1
&& gui_is_menu_shortcut(string[0]))))
-# ifdef HAVE_GTK2
/* For GTK2 we return false to signify that we haven't handled the
* keypress, so that gtk will handle the mnemonic or accelerator. */
return FALSE;
-# else
- return TRUE;
-# endif
#endif
/* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
@@ -1134,14 +1029,11 @@ key_press_event(GtkWidget *widget UNUSED,
&& !(key_sym == GDK_BackSpace || key_sym == GDK_Delete)
&& (string[0] & 0x80) == 0
&& !(key_sym == GDK_Tab && (state & GDK_SHIFT_MASK))
-#ifdef FEAT_MBYTE
&& !enc_dbcs
-#endif
)
{
string[0] |= 0x80;
state &= ~GDK_MOD1_MASK; /* don't use it again */
-#ifdef FEAT_MBYTE
if (enc_utf8) /* convert to utf-8 */
{
string[1] = string[0] & 0xbf;
@@ -1155,7 +1047,6 @@ key_press_event(GtkWidget *widget UNUSED,
else
len = 2;
}
-#endif
}
/* Check for special keys. Also do this when len == 1 (key has an ASCII
@@ -1178,26 +1069,17 @@ key_press_event(GtkWidget *widget UNUSED,
if (len == 0) /* Unrecognized key */
return TRUE;
-#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) && !defined(HAVE_GTK2)
- /* Cancel or type backspace. For GTK2, im_commit_cb() does the same. */
- preedit_start_col = MAXCOL;
- xim_changed_while_preediting = TRUE;
-#endif
-
/* Special keys (and a few others) may have modifiers. Also when using a
* double-byte encoding (can't set the 8th bit). */
if (len == -3 || key_sym == GDK_space || key_sym == GDK_Tab
|| key_sym == GDK_Return || key_sym == GDK_Linefeed
|| key_sym == GDK_Escape || key_sym == GDK_KP_Tab
|| key_sym == GDK_ISO_Enter || key_sym == GDK_3270_Enter
-#ifdef FEAT_MBYTE
|| (enc_dbcs && len == 1 && ((state & GDK_MOD1_MASK)
-# ifdef GDK_SUPER_MASK
+#ifdef GDK_SUPER_MASK
|| (state & GDK_SUPER_MASK)
-# endif
- ))
#endif
- )
+ )))
{
modifiers = modifiers_gdk2vim(state);
@@ -1254,7 +1136,7 @@ key_press_event(GtkWidget *widget UNUSED,
return TRUE;
}
-#if defined(FEAT_XIM) && defined(HAVE_GTK2)
+#if defined(FEAT_XIM)
static gboolean
key_release_event(GtkWidget *widget UNUSED,
GdkEventKey *event,
@@ -1305,9 +1187,7 @@ selection_received_cb(GtkWidget *widget UNUSED,
VimClipboard *cbd;
char_u *text;
char_u *tmpbuf = NULL;
-#ifdef HAVE_GTK2
guchar *tmpbuf_utf8 = NULL;
-#endif
int len;
int motion_type;
@@ -1337,7 +1217,6 @@ selection_received_cb(GtkWidget *widget UNUSED,
--len;
}
-#ifdef FEAT_MBYTE
else if (data->type == vimenc_atom)
{
char_u *enc;
@@ -1362,9 +1241,7 @@ selection_received_cb(GtkWidget *widget UNUSED,
convert_setup(&conv, NULL, NULL);
}
}
-#endif
-#ifdef HAVE_GTK2
/* gtk_selection_data_get_text() handles all the nasty details
* and targets and encodings etc. This rocks so hard. */
else
@@ -1401,51 +1278,6 @@ selection_received_cb(GtkWidget *widget UNUSED,
text = tmpbuf;
}
}
-#else /* !HAVE_GTK2 */
-# ifdef FEAT_MBYTE
- else if (data->type == utf8_string_atom)
- {
- vimconv_T conv;
-
- conv.vc_type = CONV_NONE;
- convert_setup(&conv, (char_u *)"utf-8", p_enc);
-
- if (conv.vc_type != CONV_NONE)
- {
- tmpbuf = string_convert(&conv, text, &len);
- convert_setup(&conv, NULL, NULL);
- }
- if (tmpbuf != NULL)
- text = tmpbuf;
- }
-# endif
- else if (data->type == compound_text_atom || data->type == text_atom)
- {
- char **list = NULL;
- int count;
- int i;
- unsigned tmplen = 0;
-
- count = gdk_text_property_to_text_list(data->type, data->format,
- data->data, data->length,
- &list);
- for (i = 0; i < count; ++i)
- tmplen += strlen(list[i]);
-
- tmpbuf = alloc(tmplen + 1);
- if (tmpbuf != NULL)
- {
- tmpbuf[0] = NUL;
- for (i = 0; i < count; ++i)
- STRCAT(tmpbuf, list[i]);
- text = tmpbuf;
- len = tmplen;
- }
-
- if (list != NULL)
- gdk_free_text_list(list);
- }
-#endif /* !HAVE_GTK2 */
/* Chop off any traiing NUL bytes. OpenOffice sends these. */
while (len > 0 && text[len - 1] == NUL)
@@ -1454,9 +1286,7 @@ selection_received_cb(GtkWidget *widget UNUSED,
clip_yank_selection(motion_type, text, (long)len, cbd);
received_selection = RS_OK;
vim_free(tmpbuf);
-#ifdef HAVE_GTK2
g_free(tmpbuf_utf8);
-#endif
if (gtk_main_level() > 0)
gtk_main_quit();
@@ -1490,11 +1320,9 @@ selection_get_cb(GtkWidget *widget UNUSED,
return; /* Shouldn't ever happen */
if (info != (guint)TARGET_STRING
-#ifdef FEAT_MBYTE
&& (!clip_html || info != (guint)TARGET_HTML)
&& info != (guint)TARGET_UTF8_STRING
&& info != (guint)TARGET_VIMENC
-#endif
&& info != (guint)TARGET_VIM
&& info != (guint)TARGET_COMPOUND_TEXT
&& info != (guint)TARGET_TEXT)
@@ -1526,7 +1354,6 @@ selection_get_cb(GtkWidget *widget UNUSED,
type = vim_atom;
}
-#ifdef FEAT_MBYTE
else if (info == (guint)TARGET_HTML)
{
vimconv_T conv;
@@ -1578,9 +1405,7 @@ selection_get_cb(GtkWidget *widget UNUSED,
string = tmpbuf;
type = vimenc_atom;
}
-#endif
-#ifdef HAVE_GTK2
/* gtk_selection_data_set_text() handles everything for us. This is
* so easy and simple and cool, it'd be insane not to use it. */
else
@@ -1602,50 +1427,6 @@ selection_get_cb(GtkWidget *widget UNUSED,
vim_free(string);
return;
}
-#else /* !HAVE_GTK2 */
-# ifdef FEAT_MBYTE
- else if (info == (guint)TARGET_UTF8_STRING)
- {
- vimconv_T conv;
-
- conv.vc_type = CONV_NONE;
- convert_setup(&conv, p_enc, (char_u *)"utf-8");
-
- if (conv.vc_type != CONV_NONE)
- {
- tmpbuf = string_convert(&conv, string, &length);
- convert_setup(&conv, NULL, NULL);
- vim_free(string);
- string = tmpbuf;
- }
- type = utf8_string_atom;
- }
-# endif
- else if (info == (guint)TARGET_COMPOUND_TEXT
- || info == (guint)TARGET_TEXT)
- {
- int format;
-
- /* Copy the string to ensure NUL-termination */
- tmpbuf = vim_strnsave(string, length);
- vim_free(string);
- if (tmpbuf != NULL)
- {
- gdk_string_to_compound_text((const char *)tmpbuf,
- &type, &format, &string, &length);
- vim_free(tmpbuf);
- selection_data->type = type;
- selection_data->format = format;
- gtk_selection_data_set(selection_data, type, format, string, length);
- gdk_free_compound_text(string);
- }
- return;
- }
- else
- {
- type = GDK_TARGET_STRING;
- }
-#endif /* !HAVE_GTK2 */
if (string != NULL)
{
@@ -1664,12 +1445,6 @@ selection_get_cb(GtkWidget *widget UNUSED,
int
gui_mch_init_check(void)
{
-#ifndef HAVE_GTK2
- /* This is needed to make the locale handling consistent between the GUI
- * and the rest of VIM. */
- gtk_set_locale();
-#endif
-
#ifdef FEAT_GUI_GNOME
if (gtk_socket_id == 0)
using_gnome = 1;
@@ -1912,14 +1687,6 @@ button_press_event(GtkWidget *widget,
case 3:
button = MOUSE_RIGHT;
break;
-#ifndef HAVE_GTK2
- case 4:
- button = MOUSE_4;
- break;
- case 5:
- button = MOUSE_5;
- break;
-#endif
default:
return FALSE; /* Unknown button */
}
@@ -1939,10 +1706,8 @@ button_press_event(GtkWidget *widget,
return TRUE;
}
-#ifdef HAVE_GTK2
/*
- * GTK+ 2 doesn't handle mouse buttons 4, 5, 6 and 7 the same way as GTK+ 1.
- * Instead, it abstracts scrolling via the new GdkEventScroll.
+ * GTK+ 2 abstracts scrolling via the GdkEventScroll.
*/
static gboolean
scroll_event(GtkWidget *widget,
@@ -1983,7 +1748,6 @@ scroll_event(GtkWidget *widget,
return TRUE;
}
-#endif /* HAVE_GTK2 */
static gint
@@ -2143,41 +1907,22 @@ drag_handle_text(GdkDragContext *context,
char_u dropkey[6] = {CSI, KS_MODIFIER, 0, CSI, KS_EXTRA, (char_u)KE_DROP};
char_u *text;
int len;
-# ifdef FEAT_MBYTE
char_u *tmpbuf = NULL;
-# endif
text = data->data;
len = data->length;
-# ifdef FEAT_MBYTE
if (data->type == utf8_string_atom)
{
-# ifdef HAVE_GTK2
if (input_conv.vc_type != CONV_NONE)
tmpbuf = string_convert(&input_conv, text, &len);
-# else
- vimconv_T conv;
-
- conv.vc_type = CONV_NONE;
- convert_setup(&conv, (char_u *)"utf-8", p_enc);
-
- if (conv.vc_type != CONV_NONE)
- {
- tmpbuf = string_convert(&conv, text, &len);
- convert_setup(&conv, NULL, NULL);
- }
-# endif
if (tmpbuf != NULL)
text = tmpbuf;
}
-# endif /* FEAT_MBYTE */
dnd_yank_drag_data(text, (long)len);
gtk_drag_finish(context, TRUE, FALSE, time_); /* accept */
-# ifdef FEAT_MBYTE
vim_free(tmpbuf);
-# endif
dropkey[2] = modifiers_gdk2vim(state);
@@ -2407,10 +2152,8 @@ sm_client_save_yourself(GnomeClient *client,
argv[i++] = restart_command;
argv[i++] = "-f";
argv[i++] = "-g";
-# ifdef HAVE_GTK2
argv[i++] = "--role";
argv[i++] = gtk_window_get_role(GTK_WINDOW(gui.mainwin));
-# endif
argv[i++] = "-S";
argv[i++] = session_file;
argv[i] = NULL;
@@ -2551,13 +2294,11 @@ setup_save_yourself(void)
}
}
-# ifdef HAVE_GTK2
/*
* Installing a global event filter seems to be the only way to catch
* client messages of type WM_PROTOCOLS without overriding GDK's own
* client message event filter. Well, that's still better than trying
* to guess what the GDK filter had done if it had been invoked instead
- * (This is what we did for GTK+ 1.2, see below).
*
* GTK2_FIXME: This doesn't seem to work. For some reason we never
* receive WM_SAVE_YOURSELF even though everything is set up correctly.
@@ -2596,51 +2337,6 @@ global_event_filter(GdkXEvent *xev,
return GDK_FILTER_CONTINUE;
}
-
-# else /* !HAVE_GTK2 */
-
-/*
- * GDK handler for X ClientMessage events.
- */
- static GdkFilterReturn
-gdk_wm_protocols_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
-{
- /* From example in gdkevents.c/gdk_wm_protocols_filter */
- XEvent *xevent = (XEvent *)xev;
-
- if (xevent != NULL)
- {
- if (xevent->xclient.data.l[0] == GET_X_ATOM(save_yourself_atom))
- {
- out_flush();
- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
-
- /* Set the window's WM_COMMAND property, to let the window manager
- * know we are done saving ourselves. We don't want to be
- * restarted, thus set argv to NULL. */
- XSetCommand(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window),
- NULL, 0);
- }
- /*
- * Functionality from gdkevents.c/gdk_wm_protocols_filter;
- * Registering this filter apparently overrides the default GDK one,
- * so we need to perform its functionality. There seems no way to
- * register for WM_PROTOCOLS, and only process the WM_SAVE_YOURSELF
- * bit; it's all or nothing. Update: No, there is a way -- but it
- * only works with GTK+ 2 apparently. See above.
- */
- else if (xevent->xclient.data.l[0] == GET_X_ATOM(gdk_wm_delete_window))
- {
- event->any.type = GDK_DELETE;
- return GDK_FILTER_TRANSLATE;
- }
- }
-
- return GDK_FILTER_REMOVE;
-}
-# endif /* !HAVE_GTK2 */
-
#endif /* !(FEAT_GUI_GNOME && FEAT_SESSION) */
@@ -2655,10 +2351,8 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
#ifdef magick
# undef magick
#endif
-#ifdef HAVE_GTK2
/* A bit hackish, but avoids casting later and allows optimization */
# define static static const
-#endif
#define magick vim32x32
#include "../runtime/vim32x32.xpm"
#undef magick
@@ -2668,9 +2362,7 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
#define magick vim48x48
#include "../runtime/vim48x48.xpm"
#undef magick
-#ifdef HAVE_GTK2
# undef static
-#endif
/* When started with "--echo-wid" argument, write window ID on stdout. */
if (echo_wid_arg)
@@ -2684,7 +2376,6 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
/*
* Add an icon to the main window. For fun and convenience of the user.
*/
-#ifdef HAVE_GTK2
GList *icons = NULL;
icons = g_list_prepend(icons, gdk_pixbuf_new_from_xpm_data(vim16x16));
@@ -2695,53 +2386,11 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
g_list_foreach(icons, (GFunc)&g_object_unref, NULL);
g_list_free(icons);
-
-#else /* !HAVE_GTK2 */
-
- GdkPixmap *icon;
- GdkBitmap *icon_mask = NULL;
- char **magick = vim32x32;
- Display *xdisplay;
- Window root_window;
- XIconSize *size;
- int number_sizes;
- /*
- * Adjust the icon to the preferences of the actual window manager.
- * This is once again a workaround for a deficiency in GTK+ 1.2.
- */
- xdisplay = GDK_WINDOW_XDISPLAY(gui.mainwin->window);
- root_window = XRootWindow(xdisplay, DefaultScreen(xdisplay));
- if (XGetIconSizes(xdisplay, root_window, &size, &number_sizes))
- {
- if (number_sizes > 0)
- {
- if (size->max_height >= 48 && size->max_height >= 48)
- magick = vim48x48;
- else if (size->max_height >= 32 && size->max_height >= 32)
- magick = vim32x32;
- else if (size->max_height >= 16 && size->max_height >= 16)
- magick = vim16x16;
- }
- XFree(size);
- }
- icon = gdk_pixmap_create_from_xpm_d(gui.mainwin->window,
- &icon_mask, NULL, magick);
- if (icon != NULL)
- /* Note: for some reason gdk_window_set_icon() doesn't acquire
- * a reference on the pixmap, thus we _have_ to leak it. */
- gdk_window_set_icon(gui.mainwin->window, NULL, icon, icon_mask);
-
-#endif /* !HAVE_GTK2 */
}
#if !(defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION))
/* Register a handler for WM_SAVE_YOURSELF with GDK's low-level X I/F */
-# ifdef HAVE_GTK2
gdk_window_add_filter(NULL, &global_event_filter, NULL);
-# else
- gdk_add_client_message_filter(wm_protocols_atom,
- &gdk_wm_protocols_filter, NULL);
-# endif
#endif
/* Setup to indicate to the window manager that we want to catch the
* WM_SAVE_YOURSELF event. For GNOME, this connects to the session
@@ -2884,7 +2533,6 @@ drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
#ifdef FEAT_XIM
im_shutdown();
#endif
-#ifdef HAVE_GTK2
if (gui.ascii_glyphs != NULL)
{
pango_glyph_string_free(gui.ascii_glyphs);
@@ -2903,13 +2551,6 @@ drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
gdk_cursor_unref(gui.blank_pointer);
gui.blank_pointer = NULL;
-#else
- gdk_gc_unref(gui.text_gc);
- gui.text_gc = NULL;
-
- gdk_cursor_destroy(gui.blank_pointer);
- gui.blank_pointer = NULL;
-#endif
}
static void
@@ -2942,7 +2583,6 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
#ifdef FEAT_GUI_GNOME
if (using_gnome && widget != NULL)
{
-# ifdef HAVE_GTK2
GtkWidget *parent;
BonoboDockItem *dockitem;
@@ -2958,16 +2598,6 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
return 0;
item_orientation = bonobo_dock_item_get_orientation(dockitem);
}
-# else
- GnomeDockItem *dockitem;
-
- widget = widget->parent;
- dockitem = GNOME_DOCK_ITEM(widget);
-
- if (dockitem == NULL || dockitem->is_floating)
- return 0;
- item_orientation = gnome_dock_item_get_orientation(dockitem);
-# endif
}
#endif
if (widget != NULL
@@ -3065,10 +2695,8 @@ update_window_manager_hints(int force_width, int force_height)
# ifdef FEAT_MENU
height += tabline_height() * gui.char_height;
# endif
-# ifdef HAVE_GTK2
width += get_menu_tool_width();
height += get_menu_tool_height();
-# endif
/* GtkSockets use GtkPlug's [gui,mainwin] min-size hints to determine
* their actual widget size. When we set our size ourselves (e.g.,
@@ -3106,16 +2734,11 @@ update_window_manager_hints(int force_width, int force_height)
geometry.min_height = min_height;
geometry_mask = GDK_HINT_BASE_SIZE|GDK_HINT_RESIZE_INC
|GDK_HINT_MIN_SIZE;
-# ifdef HAVE_GTK2
/* Using gui.formwin as geometry widget doesn't work as expected
* with GTK+ 2 -- dunno why. Presumably all the resizing hacks
* in Vim confuse GTK+. */
gtk_window_set_geometry_hints(GTK_WINDOW(gui.mainwin), gui.mainwin,
&geometry, geometry_mask);
-# else
- gtk_window_set_geometry_hints(GTK_WINDOW(gui.mainwin), gui.formwin,
- &geometry, geometry_mask);
-# endif
old_width = width;
old_height = height;
old_min_width = min_width;
@@ -3127,7 +2750,6 @@ update_window_manager_hints(int force_width, int force_height)
#ifdef FEAT_TOOLBAR
-# ifdef HAVE_GTK2
/*
* This extra effort wouldn't be necessary if we only used stock icons in the
* toolbar, as we do for all builtin icons. But user-defined toolbar icons
@@ -3161,24 +2783,18 @@ icon_size_changed_foreach(GtkWidget *widget, gpointer user_data)
user_data);
}
}
-# endif /* HAVE_GTK2 */
static void
set_toolbar_style(GtkToolbar *toolbar)
{
GtkToolbarStyle style;
-# ifdef HAVE_GTK2
GtkIconSize size;
GtkIconSize oldsize;
-# endif
-# ifdef HAVE_GTK2
if ((toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS | TOOLBAR_HORIZ))
== (TOOLBAR_TEXT | TOOLBAR_ICONS | TOOLBAR_HORIZ))
style = GTK_TOOLBAR_BOTH_HORIZ;
- else
-# endif
- if ((toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS))
+ else if ((toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS))
== (TOOLBAR_TEXT | TOOLBAR_ICONS))
style = GTK_TOOLBAR_BOTH;
else if (toolbar_flags & TOOLBAR_TEXT)
@@ -3189,7 +2805,6 @@ set_toolbar_style(GtkToolbar *toolbar)
gtk_toolbar_set_style(toolbar, style);
gtk_toolbar_set_tooltips(toolbar, (toolbar_flags & TOOLBAR_TOOLTIPS) != 0);
-# ifdef HAVE_GTK2
switch (tbis_flags)
{
case TBIS_TINY: size = GTK_ICON_SIZE_MENU; break;
@@ -3213,7 +2828,6 @@ set_toolbar_style(GtkToolbar *toolbar)
GINT_TO_POINTER((int)size));
}
gtk_toolbar_set_icon_size(toolbar, size);
-# endif
}
#endif /* FEAT_TOOLBAR */
@@ -3313,11 +2927,6 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
if (send_tabline_event(x < 50 ? -1 : 0) && gtk_main_level() > 0)
gtk_main_quit();
}
-#ifndef HAVE_GTK2
- else
- gtk_notebook_set_page(GTK_NOTEBOOK(gui.tabline),
- clicked_page - 1);
-#endif
}
}
@@ -3342,10 +2951,6 @@ on_select_tab(
}
}
-#ifndef HAVE_GTK2
-static int showing_tabline = 0;
-#endif
-
/*
* Show or hide the tabline.
*/
@@ -3355,19 +2960,11 @@ gui_mch_show_tabline(int showit)
if (gui.tabline == NULL)
return;
-#ifdef HAVE_GTK2
- /* gtk_notebook_get_show_tabs does not exist in gtk+-1.2.10 */
if (!showit != !gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline)))
-#else
- if (!showit != !showing_tabline)
-#endif
{
/* Note: this may cause a resize event */
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit);
update_window_manager_hints(0, 0);
-#ifndef HAVE_GTK2
- showing_tabline = showit;
-#endif
if (showit)
GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(gui.tabline), GTK_CAN_FOCUS);
}
@@ -3382,13 +2979,7 @@ gui_mch_show_tabline(int showit)
gui_mch_showing_tabline(void)
{
return gui.tabline != NULL
-#ifdef HAVE_GTK2
- /* gtk_notebook_get_show_tabs does not exist in gtk+-1.2.10 */
- && gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline))
-#else
- && showing_tabline
-#endif
- ;
+ && gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline));
}
/*
@@ -3496,14 +3087,12 @@ gui_gtk_set_selection_targets(void)
for (i = 0; i < (int)N_SELECTION_TARGETS; ++i)
{
-#ifdef FEAT_MBYTE
/* OpenOffice tries to use TARGET_HTML and fails when it doesn't
* return something, instead of trying another target. Therefore only
* offer TARGET_HTML when it works. */
if (!clip_html && selection_targets[i].info == TARGET_HTML)
n_targets--;
else
-#endif
targets[j++] = selection_targets[i];
}
@@ -3529,11 +3118,9 @@ gui_gtk_set_dnd_targets(void)
for (i = 0; i < (int)N_DND_TARGETS; ++i)
{
-#ifdef FEAT_MBYTE
if (!clip_html && selection_targets[i].info == TARGET_HTML)
n_targets--;
else
-#endif
targets[j++] = dnd_targets[i];
}
@@ -3558,21 +3145,16 @@ gui_mch_init(void)
* exits on failure, but that's a non-issue because we already called
* gtk_init_check() in gui_mch_init_check(). */
if (using_gnome)
-# ifdef HAVE_GTK2
gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT,
LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL);
-# else
- gnome_init(VIMPACKAGE, VIM_VERSION_SHORT, gui_argc, gui_argv);
-# endif
#endif
vim_free(gui_argv);
gui_argv = NULL;
-#ifdef HAVE_GTK2
-# if GLIB_CHECK_VERSION(2,1,3)
+#if GLIB_CHECK_VERSION(2,1,3)
/* Set the human-readable application name */
g_set_application_name("Vim");
-# endif
+#endif
/*
* Force UTF-8 output no matter what the value of 'encoding' is.
* did_set_string_option() in option.c prohibits changing 'termencoding'
@@ -3580,14 +3162,13 @@ gui_mch_init(void)
*/
set_option_value((char_u *)"termencoding", 0L, (char_u *)"utf-8", 0);
-# ifdef FEAT_TOOLBAR
+#ifdef FEAT_TOOLBAR
gui_gtk_register_stock_icons();
-# endif
+#endif
/* FIXME: Need to install the classic icons and a gtkrc.classic file.
* The hard part is deciding install locations and the Makefile magic. */
-# if 0
+#if 0
gtk_rc_parse("gtkrc");
-# endif
#endif
/* Initialize values */
@@ -3602,14 +3183,8 @@ gui_mch_init(void)
gui.spcolor = g_new0(GdkColor, 1);
/* Initialise atoms */
-#ifdef FEAT_MBYTE
html_atom = gdk_atom_intern("text/html", FALSE);
utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
-#endif
-#ifndef HAVE_GTK2
- compound_text_atom = gdk_atom_intern("COMPOUND_TEXT", FALSE);
- text_atom = gdk_atom_intern("TEXT", FALSE);
-#endif
/* Set default foreground and background colors. */
gui.norm_pixel = gui.def_norm_pixel;
@@ -3657,15 +3232,10 @@ gui_mch_init(void)
gtk_widget_set_name(gui.mainwin, "vim-main-window");
-#ifdef HAVE_GTK2
/* Create the PangoContext used for drawing all text. */
gui.text_context = gtk_widget_create_pango_context(gui.mainwin);
pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR);
-#endif
-#ifndef HAVE_GTK2
- gtk_window_set_policy(GTK_WINDOW(gui.mainwin), TRUE, TRUE, TRUE);
-#endif
gtk_container_border_width(GTK_CONTAINER(gui.mainwin), 0);
gtk_widget_add_events(gui.mainwin, GDK_VISIBILITY_NOTIFY_MASK);
@@ -3678,12 +3248,8 @@ gui_mch_init(void)
g_signal_connect(G_OBJECT(gui.mainwin), "screen_changed",
G_CALLBACK(&mainwin_screen_changed_cb), NULL);
#endif
-#ifdef HAVE_GTK2
gui.accel_group = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(gui.mainwin), gui.accel_group);
-#else
- gui.accel_group = gtk_accel_group_get_default();
-#endif
/* A vertical box holds the menubar, toolbar and main text window. */
vbox = gtk_vbox_new(FALSE, 0);
@@ -3691,7 +3257,7 @@ gui_mch_init(void)
#ifdef FEAT_GUI_GNOME
if (using_gnome)
{
-# if defined(HAVE_GTK2) && defined(FEAT_MENU)
+# if defined(FEAT_MENU)
/* automagically restore menubar/toolbar placement */
gnome_app_enable_layout_config(GNOME_APP(gui.mainwin), TRUE);
# endif
@@ -3711,7 +3277,6 @@ gui_mch_init(void)
gui.menubar = gtk_menu_bar_new();
gtk_widget_set_name(gui.menubar, "vim-menubar");
-# ifdef HAVE_GTK2
/* Avoid that GTK takes <F10> away from us. */
{
GtkSettings *gtk_settings;
@@ -3719,13 +3284,11 @@ gui_mch_init(void)
gtk_settings = gtk_settings_get_for_screen(gdk_screen_get_default());
g_object_set(gtk_settings, "gtk-menu-bar-accel", NULL, NULL);
}
-# endif
# ifdef FEAT_GUI_GNOME
if (using_gnome)
{
-# ifdef HAVE_GTK2
BonoboDockItem *dockitem;
gnome_app_set_menus(GNOME_APP(gui.mainwin), GTK_MENU_BAR(gui.menubar));
@@ -3736,21 +3299,6 @@ gui_mch_init(void)
bonobo_dock_item_get_behavior(dockitem)
| BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING);
gui.menubar_h = GTK_WIDGET(dockitem);
-# else
- gui.menubar_h = gnome_dock_item_new("VimMainMenu",
- GNOME_DOCK_ITEM_BEH_EXCLUSIVE |
- GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL);
- gtk_container_add(GTK_CONTAINER(gui.menubar_h), gui.menubar);
-
- gnome_dock_add_item(GNOME_DOCK(GNOME_APP(gui.mainwin)->dock),
- GNOME_DOCK_ITEM(gui.menubar_h),
- GNOME_DOCK_TOP, /* placement */
- 1, /* band_num */
- 0, /* band_position */
- 0, /* offset */
- TRUE);
- gtk_widget_show(gui.menubar);
-# endif
}
else
# endif /* FEAT_GUI_GNOME */
@@ -3766,7 +3314,6 @@ gui_mch_init(void)
/*
* Create the toolbar and handle
*/
-# ifdef HAVE_GTK2
/* some aesthetics on the toolbar */
gtk_rc_parse_string(
"style \"vim-toolbar-style\" {\n"
@@ -3775,17 +3322,11 @@ gui_mch_init(void)
"widget \"*.vim-toolbar\" style \"vim-toolbar-style\"\n");
gui.toolbar = gtk_toolbar_new();
gtk_widget_set_name(gui.toolbar, "vim-toolbar");
-# else
- gui.toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,
- GTK_TOOLBAR_ICONS);
- gtk_toolbar_set_button_relief(GTK_TOOLBAR(gui.toolbar), GTK_RELIEF_NONE);
-# endif
set_toolbar_style(GTK_TOOLBAR(gui.toolbar));
# ifdef FEAT_GUI_GNOME
if (using_gnome)
{
-# ifdef HAVE_GTK2
BonoboDockItem *dockitem;
gnome_app_set_toolbar(GNOME_APP(gui.mainwin), GTK_TOOLBAR(gui.toolbar));
@@ -3798,31 +3339,10 @@ gui_mch_init(void)
bonobo_dock_item_get_behavior(dockitem)
| BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING);
gtk_container_set_border_width(GTK_CONTAINER(gui.toolbar), 0);
-# else
- GtkWidget *dockitem;
-
- dockitem = gnome_dock_item_new("VimToolBar",
- GNOME_DOCK_ITEM_BEH_EXCLUSIVE);
- gtk_container_add(GTK_CONTAINER(dockitem), GTK_WIDGET(gui.toolbar));
- gui.toolbar_h = dockitem;
-
- gnome_dock_add_item(GNOME_DOCK(GNOME_APP(gui.mainwin)->dock),
- GNOME_DOCK_ITEM(dockitem),
- GNOME_DOCK_TOP, /* placement */
- 1, /* band_num */
- 1, /* band_position */
- 0, /* offset */
- TRUE);
- gtk_container_border_width(GTK_CONTAINER(gui.toolbar), 2);
- gtk_widget_show(gui.toolbar);
-# endif
}
else
# endif /* FEAT_GUI_GNOME */
{
-# ifndef HAVE_GTK2
- gtk_container_border_width(GTK_CONTAINER(gui.toolbar), 1);
-# endif
if (vim_strchr(p_go, GO_TOOLBAR) != NULL
&& (toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS)))
gtk_widget_show(gui.toolbar);
@@ -3885,9 +3405,7 @@ gui_mch_init(void)
GDK_LEAVE_NOTIFY_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
-#ifdef HAVE_GTK2
GDK_SCROLL_MASK |
-#endif
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
@@ -3904,7 +3422,7 @@ gui_mch_init(void)
: GTK_OBJECT(gui.drawarea),
"key_press_event",
GTK_SIGNAL_FUNC(key_press_event), NULL);
-#if defined(FEAT_XIM) && defined(HAVE_GTK2)
+#if defined(FEAT_XIM)
/* Also forward key release events for the benefit of GTK+ 2 input
* modules. Try CTRL-SHIFT-xdigits to enter a Unicode code point. */
g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin)
@@ -3935,9 +3453,7 @@ gui_mch_init(void)
* Set clipboard specific atoms
*/
vim_atom = gdk_atom_intern(VIM_ATOM_NAME, FALSE);
-#ifdef FEAT_MBYTE
vimenc_atom = gdk_atom_intern(VIMENC_ATOM_NAME, FALSE);
-#endif
clip_star.gtk_sel_atom = GDK_SELECTION_PRIMARY;
clip_plus.gtk_sel_atom = gdk_atom_intern("CLIPBOARD", FALSE);
@@ -3994,10 +3510,8 @@ gui_mch_init(void)
GTK_SIGNAL_FUNC(button_press_event), NULL);
gtk_signal_connect(GTK_OBJECT(gui.drawarea), "button_release_event",
GTK_SIGNAL_FUNC(button_release_event), NULL);
-#ifdef HAVE_GTK2
g_signal_connect(G_OBJECT(gui.drawarea), "scroll_event",
G_CALLBACK(&scroll_event), NULL);
-#endif
/*
* Add selection handler functions.
@@ -4142,7 +3656,6 @@ gui_mch_open(void)
guint pixel_width;
guint pixel_height;
-#ifdef HAVE_GTK2
/*
* Allow setting a window role on the command line, or invent one
* if none was specified. This is mainly useful for GNOME session
@@ -4165,14 +3678,9 @@ gui_mch_open(void)
gtk_window_set_role(GTK_WINDOW(gui.mainwin), role);
g_free(role);
}
-#endif
if (gui_win_x != -1 && gui_win_y != -1)
-#ifdef HAVE_GTK2
gtk_window_move(GTK_WINDOW(gui.mainwin), gui_win_x, gui_win_y);
-#else
- gtk_widget_set_uposition(gui.mainwin, gui_win_x, gui_win_y);
-#endif
/* Determine user specified geometry, if present. */
if (gui.geom != NULL)
@@ -4196,10 +3704,8 @@ gui_mch_open(void)
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
-#ifdef HAVE_GTK2
pixel_width += get_menu_tool_width();
pixel_height += get_menu_tool_height();
-#endif
if (mask & (XValue | YValue))
{
@@ -4211,11 +3717,7 @@ gui_mch_open(void)
x += ww - pixel_width;
if (mask & YNegative)
y += hh - pixel_height;
-#ifdef HAVE_GTK2
gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
-#else
- gtk_widget_set_uposition(gui.mainwin, x, y);
-#endif
}
vim_free(gui.geom);
gui.geom = NULL;
@@ -4235,14 +3737,10 @@ gui_mch_open(void)
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
-#ifdef HAVE_GTK2
/* For GTK2 changing the size of the form widget doesn't cause window
* resizing. */
if (gtk_socket_id == 0)
gtk_window_resize(GTK_WINDOW(gui.mainwin), pixel_width, pixel_height);
-#else
- gtk_form_set_size(GTK_FORM(gui.formwin), pixel_width, pixel_height);
-#endif
update_window_manager_hints(0, 0);
if (foreground_argument != NULL)
@@ -4305,18 +3803,13 @@ gui_mch_open(void)
GTK_SIGNAL_FUNC(drag_data_received_cb), NULL);
#endif
-#ifdef HAVE_GTK2
/* With GTK+ 2, we need to iconify the window before calling show()
- * to avoid mapping the window for a short time. This is just as one
- * would expect it to work, but it's different in GTK+ 1. The funny
- * thing is that iconifying after show() _does_ work with GTK+ 1.
- * (BTW doing this in the "realize" handler makes no difference.) */
+ * to avoid mapping the window for a short time. */
if (found_iconic_arg && gtk_socket_id == 0)
gui_mch_iconify();
-#endif
{
-#if defined(FEAT_GUI_GNOME) && defined(HAVE_GTK2) && defined(FEAT_MENU)
+#if defined(FEAT_GUI_GNOME) && defined(FEAT_MENU)
unsigned long menu_handler = 0;
# ifdef FEAT_TOOLBAR
unsigned long tool_handler = 0;
@@ -4343,7 +3836,7 @@ gui_mch_open(void)
#endif
gtk_widget_show(gui.mainwin);
-#if defined(FEAT_GUI_GNOME) && defined(HAVE_GTK2) && defined(FEAT_MENU)
+#if defined(FEAT_GUI_GNOME) && defined(FEAT_MENU)
if (menu_handler != 0)
g_signal_handler_disconnect(gui.menubar_h, menu_handler);
# ifdef FEAT_TOOLBAR
@@ -4353,13 +3846,6 @@ gui_mch_open(void)
#endif
}
-#ifndef HAVE_GTK2
- /* With GTK+ 1, we need to iconify the window after calling show().
- * See the comment above for details. */
- if (found_iconic_arg && gtk_socket_id == 0)
- gui_mch_iconify();
-#endif
-
return OK;
}
@@ -4380,13 +3866,7 @@ gui_mch_exit(int rc UNUSED)
int
gui_mch_get_winpos(int *x, int *y)
{
-#ifdef HAVE_GTK2
gtk_window_get_position(GTK_WINDOW(gui.mainwin), x, y);
-#else
- /* For some people this must be gdk_window_get_origin() for a correct
- * result. Where is the documentation! */
- gdk_window_get_root_origin(gui.mainwin->window, x, y);
-#endif
return OK;
}
@@ -4397,14 +3877,9 @@ gui_mch_get_winpos(int *x, int *y)
void
gui_mch_set_winpos(int x, int y)
{
-#ifdef HAVE_GTK2
gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
-#else
- gdk_window_move(gui.mainwin->window, x, y);
-#endif
}
-#ifdef HAVE_GTK2
#if 0
static int resize_idle_installed = FALSE;
/*
@@ -4442,9 +3917,7 @@ force_shell_resize_idle(gpointer data)
return FALSE; /* don't call me again */
}
#endif
-#endif /* HAVE_GTK2 */
-#if defined(HAVE_GTK2) || defined(PROTO)
/*
* Return TRUE if the main window is maximized.
*/
@@ -4465,7 +3938,6 @@ gui_mch_unmaximize()
if (gui.mainwin != NULL)
gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
}
-#endif
/*
* Set the windows size.
@@ -4476,27 +3948,9 @@ gui_mch_set_shellsize(int width, int height,
int base_width UNUSED, int base_height UNUSED,
int direction UNUSED)
{
-#ifndef HAVE_GTK2
- /* Hack: When the form already is at the desired size, the window might
- * have been resized with the mouse. Force a resize by setting a
- * different size first. */
- if (GTK_FORM(gui.formwin)->width == width
- && GTK_FORM(gui.formwin)->height == height)
- {
- gtk_form_set_size(GTK_FORM(gui.formwin), width + 1, height + 1);
- gui_mch_update();
- }
- gtk_form_set_size(GTK_FORM(gui.formwin), width, height);
-#endif
-
/* give GTK+ a chance to put all widget's into place */
gui_mch_update();
-#ifndef HAVE_GTK2
- /* this will cause the proper resizement to happen too */
- update_window_manager_hints(0, 0);
-
-#else
/* this will cause the proper resizement to happen too */
if (gtk_socket_id == 0)
update_window_manager_hints(0, 0);
@@ -4528,7 +3982,6 @@ gui_mch_set_shellsize(int width, int height,
* on top, while the GUI expects to be the boss.
*/
gui_mch_update();
-#endif
}
@@ -4571,17 +4024,13 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
void
gui_mch_settitle(char_u *title, char_u *icon UNUSED)
{
-# ifdef HAVE_GTK2
if (title != NULL && output_conv.vc_type != CONV_NONE)
title = string_convert(&output_conv, title, NULL);
-# endif
gtk_window_set_title(GTK_WINDOW(gui.mainwin), (const char *)title);
-# ifdef HAVE_GTK2
if (output_conv.vc_type != CONV_NONE)
vim_free(title);
-# endif
}
#endif /* FEAT_TITLE */
@@ -4642,48 +4091,6 @@ gui_mch_show_toolbar(int showit)
}
#endif /* FEAT_TOOLBAR */
-#ifndef HAVE_GTK2
-/*
- * Get a font structure for highlighting.
- * "cbdata" is a pointer to the global gui structure.
- */
- static void
-font_sel_ok(GtkWidget *wgt, gpointer cbdata)
-{
- gui_T *vw = (gui_T *)cbdata;
- GtkFontSelectionDialog *fs = (GtkFontSelectionDialog *)vw->fontdlg;
-
- if (vw->fontname)
- g_free(vw->fontname);
-
- vw->fontname = (char_u *)gtk_font_selection_dialog_get_font_name(fs);
- gtk_widget_hide(vw->fontdlg);
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-
- static void
-font_sel_cancel(GtkWidget *wgt, gpointer cbdata)
-{
- gui_T *vw = (gui_T *)cbdata;
-
- gtk_widget_hide(vw->fontdlg);
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-
- static void
-font_sel_destroy(GtkWidget *wgt, gpointer cbdata)
-{
- gui_T *vw = (gui_T *)cbdata;
-
- vw->fontdlg = NULL;
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-#endif /* !HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
/*
* Check if a given font is a CJK font. This is done in a very crude manner. It
* just see if U+04E00 for zh and ja and U+AC00 for ko are covered in a given
@@ -4726,7 +4133,6 @@ is_cjk_font(PangoFontDescription *font_desc)
return is_cjk;
}
-#endif /* HAVE_GTK2 */
/*
* Adjust gui.char_height (after 'linespace' was changed).
@@ -4734,7 +4140,6 @@ is_cjk_font(PangoFontDescription *font_desc)
int
gui_mch_adjust_charheight(void)
{
-#ifdef HAVE_GTK2
PangoFontMetrics *metrics;
int ascent;
int descent;
@@ -4751,14 +4156,6 @@ gui_mch_adjust_charheight(void)
/* LINTED: avoid warning: bitwise operation on signed value */
gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2);
-#else /* !HAVE_GTK2 */
-
- gui.char_height = gui.current_font->ascent + gui.current_font->descent
- + p_linespace;
- gui.char_ascent = gui.current_font->ascent + p_linespace / 2;
-
-#endif /* !HAVE_GTK2 */
-
/* A not-positive value of char_height may crash Vim. Only happens
* if 'linespace' is negative (which does make sense sometimes). */
gui.char_ascent = MAX(gui.char_ascent, 0);
@@ -4767,106 +4164,6 @@ gui_mch_adjust_charheight(void)
return OK;
}
-#if defined(FEAT_XFONTSET) || defined(PROTO)
-/*
- * Try to load the requested fontset.
- */
- GuiFontset
-gui_mch_get_fontset(char_u *name, int report_error, int fixed_width)
-{
- GdkFont *font;
-
- if (!gui.in_use || name == NULL)
- return NOFONT;
-
- font = gdk_fontset_load((gchar *)name);
-
- if (font == NULL)
- {
- if (report_error)
- EMSG2(_(e_fontset), name);
- return NOFONT;
- }
- /* TODO: check if the font is fixed width. */
-
- /* reference this font as being in use */
- gdk_font_ref(font);
-
- return (GuiFontset)font;
-}
-#endif /* FEAT_XFONTSET */
-
-#ifndef HAVE_GTK2
-/*
- * Put up a font dialog and return the selected font name in allocated memory.
- * "oldval" is the previous value.
- * Return NULL when cancelled.
- */
- char_u *
-gui_mch_font_dialog(char_u *oldval)
-{
- char_u *fontname = NULL;
-
- if (!gui.fontdlg)
- {
- GtkFontSelectionDialog *fsd = NULL;
-
- gui.fontdlg = gtk_font_selection_dialog_new(_("Font Selection"));
- fsd = GTK_FONT_SELECTION_DIALOG(gui.fontdlg);
- gtk_window_set_modal(GTK_WINDOW(gui.fontdlg), TRUE);
- gtk_window_set_transient_for(GTK_WINDOW(gui.fontdlg),
- GTK_WINDOW(gui.mainwin));
- gtk_signal_connect(GTK_OBJECT(gui.fontdlg), "destroy",
- GTK_SIGNAL_FUNC(font_sel_destroy), &gui);
- gtk_signal_connect(GTK_OBJECT(fsd->ok_button), "clicked",
- GTK_SIGNAL_FUNC(font_sel_ok), &gui);
- gtk_signal_connect(GTK_OBJECT(fsd->cancel_button), "clicked",
- GTK_SIGNAL_FUNC(font_sel_cancel), &gui);
- }
-
- if (oldval != NULL && *oldval != NUL)
- gtk_font_selection_dialog_set_font_name(
- GTK_FONT_SELECTION_DIALOG(gui.fontdlg), (char *)oldval);
- else
- gtk_font_selection_dialog_set_font_name(
- GTK_FONT_SELECTION_DIALOG(gui.fontdlg), DEFAULT_FONT);
-
- if (gui.fontname)
- {
- g_free(gui.fontname);
- gui.fontname = NULL;
- }
- gtk_window_position(GTK_WINDOW(gui.fontdlg), GTK_WIN_POS_MOUSE);
- gtk_widget_show(gui.fontdlg);
- {
- static gchar *spacings[] = {"c", "m", NULL};
-
- /* In GTK 1.2.3 this must be after the gtk_widget_show() call,
- * otherwise everything is blocked for ten seconds. */
- gtk_font_selection_dialog_set_filter(
- GTK_FONT_SELECTION_DIALOG(gui.fontdlg),
- GTK_FONT_FILTER_BASE,
- GTK_FONT_ALL, NULL, NULL,
- NULL, NULL, spacings, NULL);
- }
-
- /* Wait for the font dialog to be closed. */
- while (gui.fontdlg && GTK_WIDGET_DRAWABLE(gui.fontdlg))
- gtk_main_iteration_do(TRUE);
-
- if (gui.fontname != NULL)
- {
- /* Apparently some font names include a comma, need to escape that,
- * because in 'guifont' it separates names. */
- fontname = vim_strsave_escaped(gui.fontname, (char_u *)",");
- g_free(gui.fontname);
- gui.fontname = NULL;
- }
- return fontname;
-}
-#endif /* !HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
/*
* Put up a font dialog and return the selected font name in allocated memory.
* "oldval" is the previous value. Return NULL when cancelled.
@@ -4997,102 +4294,6 @@ get_styled_font_variants(void)
g_object_unref(plain_font);
}
-#else /* !HAVE_GTK2 */
-
-/*
- * There is only one excuse I can give for the following attempt to manage font
- * styles:
- *
- * I HATE THE BRAIN DEAD WAY X11 IS HANDLING FONTS (--mdcki)
- * (Me too. --danielk)
- */
- static void
-get_styled_font_variants(char_u * font_name)
-{
- char *chunk[32];
- char *sdup;
- char *tmp;
- int len, i;
- GuiFont *styled_font[3];
-
- styled_font[0] = &gui.bold_font;
- styled_font[1] = &gui.ital_font;
- styled_font[2] = &gui.boldital_font;
-
- /* First free whatever was previously there. */
- for (i = 0; i < 3; ++i)
- if (*styled_font[i])
- {
- gdk_font_unref(*styled_font[i]);
- *styled_font[i] = NULL;
- }
-
- if ((sdup = g_strdup((const char *)font_name)) == NULL)
- return;
-
- /* split up the whole */
- i = 0;
- for (tmp = sdup; *tmp != '\0'; ++tmp)
- {
- if (*tmp == '-')
- {
- *tmp = '\0';
-
- if (i == 32)
- break;
-
- chunk[i] = tmp + 1;
- ++i;
- }
- }
-
- if (i == 14)
- {
- GdkFont *font = NULL;
- const char *bold_chunk[3] = { "bold", NULL, "bold" };
- const char *italic_chunk[3] = { NULL, "o", "o" };
-
- /* font name was complete */
- len = strlen((const char *)font_name) + 32;
-
- for (i = 0; i < 3; ++i)
- {
- char *styled_name;
- int j;
-
- styled_name = (char *)alloc(len);
- if (styled_name == NULL)
- {
- g_free(sdup);
- return;
- }
-
- *styled_name = '\0';
-
- for (j = 0; j < 14; ++j)
- {
- strcat(styled_name, "-");
- if (j == 2 && bold_chunk[i] != NULL)
- strcat(styled_name, bold_chunk[i]);
- else if (j == 3 && italic_chunk[i] != NULL)
- strcat(styled_name, italic_chunk[i]);
- else
- strcat(styled_name, chunk[j]);
- }
-
- font = gui_mch_get_font((char_u *)styled_name, FALSE);
- if (font != NULL)
- *styled_font[i] = font;
-
- vim_free(styled_name);
- }
- }
-
- g_free(sdup);
-}
-#endif /* !HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
static PangoEngineShape *default_shape_engine = NULL;
/*
@@ -5162,7 +4363,6 @@ ascii_glyph_table_init(void)
g_list_free(item_list);
pango_attr_list_unref(attr_list);
}
-#endif /* HAVE_GTK2 */
/*
* Initialize Vim to use the font or fontset with the given name.
@@ -5171,7 +4371,6 @@ ascii_glyph_table_init(void)
int
gui_mch_init_font(char_u *font_name, int fontset UNUSED)
{
-#ifdef HAVE_GTK2
PangoFontDescription *font_desc;
PangoLayout *layout;
int width;
@@ -5248,94 +4447,6 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
gui.wide_font = NULL;
}
-#else /* !HAVE_GTK2 */
-
- GdkFont *font = NULL;
-
-# ifdef FEAT_XFONTSET
- /* Try loading a fontset. If this fails we try loading a normal font. */
- if (fontset && font_name != NULL)
- font = gui_mch_get_fontset(font_name, TRUE, TRUE);
-
- if (font == NULL)
-# endif
- {
- /* If font_name is NULL, this means to use the default, which should
- * be present on all X11 servers. */
- if (font_name == NULL)
- font_name = (char_u *)DEFAULT_FONT;
- font = gui_mch_get_font(font_name, FALSE);
- }
-
- if (font == NULL)
- return FAIL;
-
- gui_mch_free_font(gui.norm_font);
-# ifdef FEAT_XFONTSET
- gui_mch_free_fontset(gui.fontset);
- if (font->type == GDK_FONT_FONTSET)
- {
- gui.norm_font = NOFONT;
- gui.fontset = (GuiFontset)font;
- /* Use two bytes, this works around the problem that the result would
- * be zero if no 8-bit font was found. */
- gui.char_width = gdk_string_width(font, "xW") / 2;
- }
- else
-# endif
- {
- gui.norm_font = font;
-# ifdef FEAT_XFONTSET
- gui.fontset = NOFONTSET;
-# endif
- gui.char_width = ((XFontStruct *)
- GDK_FONT_XFONT(font))->max_bounds.width;
- }
-
- /* A zero width may cause a crash. Happens for semi-invalid fontsets. */
- if (gui.char_width <= 0)
- gui.char_width = 8;
-
- gui.char_height = font->ascent + font->descent + p_linespace;
- gui.char_ascent = font->ascent + p_linespace / 2;
-
- /* A not-positive value of char_height may crash Vim. Only happens
- * if 'linespace' is negative (which does make sense sometimes). */
- gui.char_ascent = MAX(gui.char_ascent, 0);
- gui.char_height = MAX(gui.char_height, gui.char_ascent + 1);
-
- /* Set the fontname, which will be used for information purposes */
- hl_set_font_name(font_name);
-
- if (font->type != GDK_FONT_FONTSET)
- get_styled_font_variants(font_name);
-
- /* Synchronize the fonts used in user input dialogs, since otherwise
- * search/replace will be esp. annoying in case of international font
- * usage.
- */
- gui_gtk_synch_fonts();
-
-# ifdef FEAT_XIM
- /* Adjust input management behaviour to the capabilities of the new
- * fontset */
- xim_decide_input_style();
- if (xim_get_status_area_height())
- {
- /* Status area is required. Just create the empty container so that
- * mainwin will allocate the extra space for status area. */
- GtkWidget *alignment = gtk_alignment_new((gfloat)0.5, (gfloat)0.5,
- (gfloat)1.0, (gfloat)1.0);
-
- gtk_widget_set_usize(alignment, 20, gui.char_height + 2);
- gtk_box_pack_end(GTK_BOX(GTK_BIN(gui.mainwin)->child),
- alignment, FALSE, FALSE, 0);
- gtk_widget_show(alignment);
- }
-# endif
-#endif /* !HAVE_GTK2 */
-
-#ifdef HAVE_GTK2
if (gui_mch_maximized())
{
int w, h;
@@ -5348,7 +4459,6 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
gui_resize_shell(w, h);
}
else
-#endif
{
/* Preserve the logical dimensions of the screen. */
update_window_manager_hints(0, 0);
@@ -5364,17 +4474,12 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
GuiFont
gui_mch_get_font(char_u *name, int report_error)
{
-#ifdef HAVE_GTK2
PangoFontDescription *font;
-#else
- GdkFont *font;
-#endif
/* can't do this when GUI is not running */
if (!gui.in_use || name == NULL)
return NULL;
-#ifdef HAVE_GTK2
if (output_conv.vc_type != CONV_NONE)
{
char_u *buf;
@@ -5409,9 +4514,6 @@ gui_mch_get_font(char_u *name, int report_error)
else
g_object_unref(real_font);
}
-#else
- font = gdk_font_load((const gchar *)name);
-#endif
if (font == NULL)
{
@@ -5420,7 +4522,6 @@ gui_mch_get_font(char_u *name, int report_error)
return NULL;
}
-#ifdef HAVE_GTK2
/*
* The fixed-width check has been disabled for GTK+ 2. Rationale:
*
@@ -5434,7 +4535,7 @@ gui_mch_get_font(char_u *name, int report_error)
* - The font dialog displays all fonts unfiltered, and it's rather
* annoying if 95% of the listed fonts produce an error message.
*/
-# if 0
+#if 0
{
/* Check that this is a mono-spaced font. Naturally, this is a bit
* hackish -- fixed-width isn't really suitable for i18n text :/ */
@@ -5465,29 +4566,6 @@ gui_mch_get_font(char_u *name, int report_error)
g_object_unref(layout);
}
-# endif
-#else /* !HAVE_GTK2 */
- {
- XFontStruct *xfont;
-
- /* reference this font as being in use */
- gdk_font_ref(font);
-
- /* Check that this is a mono-spaced font.
- */
- xfont = (XFontStruct *) GDK_FONT_XFONT(font);
-
- if (xfont->max_bounds.width != xfont->min_bounds.width)
- {
- gdk_font_unref(font);
- font = NULL;
- }
- }
-#endif /* !HAVE_GTK2 */
-
-#if !defined(HAVE_GTK2) || 0 /* disabled for GTK+ 2, see above */
- if (font == NULL && report_error)
- EMSG2(_(e_fontwidth), name);
#endif
return font;
@@ -5500,7 +4578,6 @@ gui_mch_get_font(char_u *name, int report_error)
char_u *
gui_mch_get_fontname(GuiFont font, char_u *name UNUSED)
{
-# ifdef HAVE_GTK2
if (font != NOFONT)
{
char *pangoname = pango_font_description_to_string(font);
@@ -5513,39 +4590,10 @@ gui_mch_get_fontname(GuiFont font, char_u *name UNUSED)
return s;
}
}
-# else
- /* Don't know how to get the name, return what we got. */
- if (name != NULL)
- return vim_strsave(name);
-# endif
return NULL;
}
#endif
-#if !defined(HAVE_GTK2) || defined(PROTO)
-/*
- * Set the current text font.
- * Since we create all GC on demand, we use just gui.current_font to
- * indicate the desired current font.
- */
- void
-gui_mch_set_font(GuiFont font)
-{
- gui.current_font = font;
-}
-#endif
-
-#if defined(FEAT_XFONTSET) || defined(PROTO)
-/*
- * Set the current text fontset.
- */
- void
-gui_mch_set_fontset(GuiFontset fontset)
-{
- gui.current_font = fontset;
-}
-#endif
-
/*
* If a font is not going to be used, free its structure.
*/
@@ -5553,26 +4601,9 @@ gui_mch_set_fontset(GuiFontset fontset)
gui_mch_free_font(GuiFont font)
{
if (font != NOFONT)
-#ifdef HAVE_GTK2
pango_font_description_free(font);
-#else
- gdk_font_unref(font);
-#endif
}
-#if defined(FEAT_XFONTSET) || defined(PROTO)
-/*
- * If a fontset is not going to be used, free its structure.
- */
- void
-gui_mch_free_fontset(GuiFontset fontset)
-{
- if (fontset != NOFONTSET)
- gdk_font_unref(fontset);
-}
-#endif
-
-
/*
* Return the Pixel value (color) for the given color name. This routine was
* pretty much taken from example code in the Silicon Graphics OSF/Motif
@@ -5626,47 +4657,10 @@ gui_mch_get_color(char_u *name)
parsed = gdk_color_parse((const char *)name, &color);
-#ifndef HAVE_GTK2 /* ohh, lovely GTK+ 2, eases our pain :) */
- /*
- * Since we have already called gtk_set_locale here the bugger
- * XParseColor will accept only explicit color names in the language
- * of the current locale. However this will interfere with:
- * 1. Vim's global startup files
- * 2. Explicit color names in .vimrc
- *
- * Therefore we first try to parse the color in the current locale and
- * if it fails, we fall back to the portable "C" one.
- */
- if (!parsed)
- {
- char *current;
-
- current = setlocale(LC_ALL, NULL);
- if (current != NULL)
- {
- char *saved;
-
- saved = g_strdup(current);
- setlocale(LC_ALL, "C");
-
- parsed = gdk_color_parse((const gchar *)name, &color);
-
- setlocale(LC_ALL, saved);
- gtk_set_locale();
-
- g_free(saved);
- }
- }
-#endif /* !HAVE_GTK2 */
-
if (parsed)
{
-#ifdef HAVE_GTK2
gdk_colormap_alloc_color(gtk_widget_get_colormap(gui.drawarea),
&color, FALSE, TRUE);
-#else
- gdk_color_alloc(gtk_widget_get_colormap(gui.drawarea), &color);
-#endif
return (guicolor_T)color.pixel;
}
/* add a few builtin names and try again */
@@ -5715,7 +4709,6 @@ gui_mch_set_sp_color(guicolor_T color)
gui.spcolor->pixel = (unsigned long)color;
}
-#ifdef HAVE_GTK2
/*
* Function-like convenience macro for the sake of efficiency.
*/
@@ -5892,8 +4885,6 @@ draw_glyph_string(int row, int col, int num_cells, int flags,
glyphs);
}
-#endif /* HAVE_GTK2 */
-
/*
* Draw underline and undercurl at the bottom of the character cell.
*/
@@ -5930,7 +4921,6 @@ draw_under(int flags, int row, int col, int cells)
}
}
-#if defined(HAVE_GTK2) || defined(PROTO)
int
gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags)
{
@@ -6200,129 +5190,6 @@ skipitall:
return column_offset;
}
-#endif /* HAVE_GTK2 */
-
-#if !defined(HAVE_GTK2) || defined(PROTO)
- void
-gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
-{
- static XChar2b *buf = NULL;
- static int buflen = 0;
- int is_wide;
- XChar2b *text;
- int textlen;
- XFontStruct *xfont;
- char_u *p;
-# ifdef FEAT_MBYTE
- unsigned c;
-# endif
- int width;
-
- if (gui.current_font == NULL || gui.drawarea->window == NULL)
- return;
-
- /*
- * Yeah yeah apparently the font support in GTK+ 1.2 only cares for either:
- * asians or 8-bit fonts. It is broken there, but no wonder the whole font
- * stuff is broken in X11 in first place. And the internationalization API
- * isn't something you would really like to use.
- */
-
- xfont = (XFontStruct *)((GdkFontPrivate*)gui.current_font)->xfont;
- is_wide = ((xfont->min_byte1 != 0 || xfont->max_byte1 != 0)
-# ifdef FEAT_XFONTSET
- && gui.fontset == NOFONTSET
-# endif
- );
-
- if (is_wide)
- {
- /* Convert a byte sequence to 16 bit characters for the Gdk functions.
- * Need a buffer for the 16 bit characters. Keep it between calls,
- * because allocating it each time is slow. */
- if (buflen < len)
- {
- XtFree((char *)buf);
- buf = (XChar2b *)XtMalloc(len * sizeof(XChar2b));
- buflen = len;
- }
-
- p = s;
- textlen = 0;
- width = 0;
- while (p < s + len)
- {
-# ifdef FEAT_MBYTE
- if (enc_utf8)
- {
- int pcc[MAX_MCO];
-
- /* TODO: use the composing characters */
- c = utfc_ptr2char_len(p, pcc, len - (p - s));
- if (c >= 0x10000) /* show chars > 0xffff as ? */
- c = 0xbf;
- buf[textlen].byte1 = c >> 8;
- buf[textlen].byte2 = c;
- p += utfc_ptr2len_len(p, len - (p - s));
- width += utf_char2cells(c);
- }
- else
-# endif
- {
- buf[textlen].byte1 = '\0'; /* high eight bits */
- buf[textlen].byte2 = *p; /* low eight bits */
- ++p;
- ++width;
- }
- ++textlen;
- }
- text = buf;
- textlen = textlen * 2;
- }
- else
- {
- text = (XChar2b *)s;
- textlen = len;
-# ifdef FEAT_MBYTE
- if (has_mbyte)
- {
- width = 0;
- for (p = s; p < s + len; p += (*mb_ptr2len_len)(p, len - (p - s)))
- width += (*mb_ptr2cells_len)(p, len - (p - s));
- }
- else
-# endif
- width = len;
- }
-
- if (!(flags & DRAW_TRANSP))
- {
- gdk_gc_set_foreground(gui.text_gc, gui.bgcolor);
- gdk_draw_rectangle(gui.drawarea->window,
- gui.text_gc,
- TRUE,
- FILL_X(col), FILL_Y(row),
- width * gui.char_width, gui.char_height);
- }
- gdk_gc_set_foreground(gui.text_gc, gui.fgcolor);
- gdk_draw_text(gui.drawarea->window,
- gui.current_font,
- gui.text_gc,
- TEXT_X(col), TEXT_Y(row),
- (const gchar *)text, textlen);
-
- /* redraw the contents with an offset of 1 to emulate bold */
- if (flags & DRAW_BOLD)
- gdk_draw_text(gui.drawarea->window,
- gui.current_font,
- gui.text_gc,
- TEXT_X(col) + 1, TEXT_Y(row),
- (const gchar *)text, textlen);
-
- /* Draw underline and undercurl. */
- draw_under(flags, row, col, width);
-}
-#endif /* !HAVE_GTK2 */
/*
* Return OK if the key with the termcap name "name" is supported.
@@ -6340,7 +5207,6 @@ gui_mch_haskey(char_u *name)
}
#if defined(FEAT_TITLE) \
- || (defined(FEAT_XIM) && !defined(HAVE_GTK2)) \
|| defined(PROTO)
/*
* Return the text window-id and display. Only required for X-based GUI's
@@ -6471,13 +5337,7 @@ gui_mch_invert_rectangle(int r, int c, int nr, int nc)
void
gui_mch_iconify(void)
{
-#ifdef HAVE_GTK2
gtk_window_iconify(GTK_WINDOW(gui.mainwin));
-#else
- XIconifyWindow(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
- GDK_WINDOW_XWINDOW(gui.mainwin->window),
- DefaultScreen(GDK_WINDOW_XDISPLAY(gui.mainwin->window)));
-#endif
}
#if defined(FEAT_EVAL) || defined(PROTO)
@@ -6487,11 +5347,7 @@ gui_mch_iconify(void)
void
gui_mch_set_foreground(void)
{
-# ifdef HAVE_GTK2
gtk_window_present(GTK_WINDOW(gui.mainwin));
-# else
- gdk_window_raise(gui.mainwin->window);
-# endif
}
#endif
@@ -6509,10 +5365,8 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
gui_mch_set_fg_color(color);
gdk_gc_set_foreground(gui.text_gc, gui.fgcolor);
-#ifdef FEAT_MBYTE
if (mb_lefthalve(gui.row, gui.col))
i = 2;
-#endif
gdk_draw_rectangle(gui.drawarea->window, gui.text_gc,
FALSE,
FILL_X(gui.col), FILL_Y(gui.row),
@@ -6696,12 +5550,10 @@ gui_mch_flush(void)
#else
gdk_flush(); /* historical misnomer: calls XSync(), not XFlush() */
#endif
-#ifdef HAVE_GTK2
/* This happens to actually do what gui_mch_flush() is supposed to do,
* according to the comment above. */
if (gui.drawarea != NULL && gui.drawarea->window != NULL)
gdk_window_process_updates(gui.drawarea->window, FALSE);
-#endif
}
/*
@@ -6841,10 +5693,8 @@ clip_mch_request_selection(VimClipboard *cbd)
for (i = 0; i < N_SELECTION_TARGETS; ++i)
{
-#ifdef FEAT_MBYTE
if (!clip_html && selection_targets[i].info == TARGET_HTML)
continue;
-#endif
received_selection = RS_NONE;
target = gdk_atom_intern(selection_targets[i].target, FALSE);
@@ -6990,19 +5840,8 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
gui_mch_get_rgb(guicolor_T pixel)
{
GdkColor color;
-#ifndef HAVE_GTK2
- GdkColorContext *cc;
-
- cc = gdk_color_context_new(gtk_widget_get_visual(gui.drawarea),
- gtk_widget_get_colormap(gui.drawarea));
- color.pixel = pixel;
- gdk_color_context_query_color(cc, &color);
-
- gdk_color_context_free(cc);
-#else
gdk_colormap_query_color(gtk_widget_get_colormap(gui.drawarea),
(unsigned long)pixel, &color);
-#endif
return (((unsigned)color.red & 0xff00) << 8)
| ((unsigned)color.green & 0xff00)
@@ -7138,8 +5977,6 @@ mch_set_mouse_shape(int shape)
# define SIGN_HEIGHT (gui.char_height)
# define SIGN_ASPECT ((double)SIGN_HEIGHT / (double)SIGN_WIDTH)
-# ifdef HAVE_GTK2
-
void
gui_mch_drawsign(int row, int col, int typenr)
{
@@ -7200,19 +6037,6 @@ gui_mch_drawsign(int row, int col, int typenr)
SIGN_WIDTH,
SIGN_HEIGHT);
-# if GTK_CHECK_VERSION(2,1,1)
- gdk_draw_pixbuf(gui.drawarea->window,
- NULL,
- sign,
- MAX(0, xoffset),
- MAX(0, yoffset),
- FILL_X(col) - MIN(0, xoffset),
- FILL_Y(row) - MIN(0, yoffset),
- MIN(width, SIGN_WIDTH),
- MIN(height, SIGN_HEIGHT),
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
-# else
gdk_pixbuf_render_to_drawable_alpha(sign,
gui.drawarea->window,
MAX(0, xoffset),
@@ -7225,7 +6049,6 @@ gui_mch_drawsign(int row, int col, int typenr)
127,
GDK_RGB_DITHER_NORMAL,
0, 0);
-# endif
if (need_scale)
g_object_unref(sign);
}
@@ -7272,115 +6095,4 @@ gui_mch_destroy_sign(void *sign)
g_object_unref(sign);
}
-# else /* !HAVE_GTK2 */
-
-typedef struct
-{
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-}
-signicon_T;
-
- void
-gui_mch_drawsign(int row, int col, int typenr)
-{
- signicon_T *sign;
-
- sign = (signicon_T *)sign_get_image(typenr);
-
- if (sign != NULL && sign->pixmap != NULL
- && gui.drawarea != NULL && gui.drawarea->window != NULL)
- {
- int width;
- int height;
- int xoffset;
- int yoffset;
-
- gdk_window_get_size(sign->pixmap, &width, &height);
-
- /* The origin is the upper-left corner of the pixmap. Therefore
- * these offset may become negative if the pixmap is smaller than
- * the 2x1 cells reserved for the sign icon. */
- xoffset = (width - SIGN_WIDTH) / 2;
- yoffset = (height - SIGN_HEIGHT) / 2;
-
- gdk_gc_set_foreground(gui.text_gc, gui.bgcolor);
-
- gdk_draw_rectangle(gui.drawarea->window,
- gui.text_gc,
- TRUE,
- FILL_X(col),
- FILL_Y(row),
- SIGN_WIDTH,
- SIGN_HEIGHT);
-
- /* Set the clip mask for bilevel transparency */
- if (sign->mask != NULL)
- {
- gdk_gc_set_clip_origin(gui.text_gc,
- FILL_X(col) - xoffset,
- FILL_Y(row) - yoffset);
- gdk_gc_set_clip_mask(gui.text_gc, sign->mask);
- }
-
- gdk_draw_pixmap(gui.drawarea->window,
- gui.text_gc,
- sign->pixmap,
- MAX(0, xoffset),
- MAX(0, yoffset),
- FILL_X(col) - MIN(0, xoffset),
- FILL_Y(row) - MIN(0, yoffset),
- MIN(width, SIGN_WIDTH),
- MIN(height, SIGN_HEIGHT));
-
- gdk_gc_set_clip_mask(gui.text_gc, NULL);
- }
-}
-
- void *
-gui_mch_register_sign(char_u *signfile)
-{
- signicon_T *sign = NULL;
-
- if (signfile[0] != NUL && signfile[0] != '-'
- && gui.drawarea != NULL && gui.drawarea->window != NULL)
- {
- sign = (signicon_T *)alloc(sizeof(signicon_T));
-
- if (sign != NULL) /* NULL == OOM == "cannot really happen" */
- {
- sign->mask = NULL;
- sign->pixmap = gdk_pixmap_colormap_create_from_xpm(
- gui.drawarea->window, NULL,
- &sign->mask, NULL,
- (const char *)signfile);
-
- if (sign->pixmap == NULL)
- {
- vim_free(sign);
- sign = NULL;
- EMSG(_(e_signdata));
- }
- }
- }
- return sign;
-}
-
- void
-gui_mch_destroy_sign(void *sign)
-{
- if (sign != NULL)
- {
- signicon_T *signicon = (signicon_T *)sign;
-
- if (signicon->pixmap != NULL)
- gdk_pixmap_unref(signicon->pixmap);
- if (signicon->mask != NULL)
- gdk_bitmap_unref(signicon->mask);
-
- vim_free(signicon);
- }
-}
-# endif /* !HAVE_GTK2 */
-
#endif /* FEAT_SIGN_ICONS */
diff --git a/src/main.c b/src/main.c
index 1b2e6ee69..2ca1ebe84 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3233,9 +3233,7 @@ usage()
main_msg(_("-geometry <geom>\tUse <geom> for initial geometry (also: -geom)"));
main_msg(_("-reverse\t\tUse reverse video (also: -rv)"));
main_msg(_("-display <display>\tRun vim on <display> (also: --display)"));
-# ifdef HAVE_GTK2
main_msg(_("--role <role>\tSet a unique role to identify the main window"));
-# endif
main_msg(_("--socketid <xid>\tOpen Vim inside another GTK widget"));
#endif
#ifdef FEAT_GUI_W32
diff --git a/src/mbyte.c b/src/mbyte.c
index e4df00ad5..1eeede30b 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -100,7 +100,7 @@
#include <X11/Xlocale.h>
#endif
-#if defined(FEAT_GUI_GTK) && defined(FEAT_XIM) && defined(HAVE_GTK2)
+#if defined(FEAT_GUI_GTK) && defined(FEAT_XIM)
# include <gdk/gdkkeysyms.h>
# ifdef WIN3264
# include <gdk/gdkwin32.h>
@@ -5068,147 +5068,6 @@ static XIMStyle input_style;
static int status_area_enabled = TRUE;
#endif
-#ifdef FEAT_GUI_GTK
-# ifdef WIN3264
-# include <gdk/gdkwin32.h>
-# else
-# include <gdk/gdkx.h>
-# endif
-#else
-# ifdef PROTO
-/* Define a few things to be able to generate prototypes while not configured
- * for GTK. */
-# define GSList int
-# define gboolean int
- typedef int GdkEvent;
- typedef int GdkEventKey;
-# define GdkIC int
-# endif
-#endif
-
-#if defined(FEAT_GUI_GTK) || defined(PROTO)
-static int preedit_buf_len = 0;
-static int xim_can_preediting INIT(= FALSE); /* XIM in showmode() */
-static int xim_input_style;
-#ifndef FEAT_GUI_GTK
-# define gboolean int
-#endif
-static gboolean use_status_area = 0;
-
-static int im_xim_str2keycode __ARGS((unsigned int *code, unsigned int *state));
-static void im_xim_send_event_imactivate __ARGS((void));
-
-/*
- * Convert string to keycode and state for XKeyEvent.
- * When string is valid return OK, when invalid return FAIL.
- *
- * See 'imactivatekey' documentation for the format.
- */
- static int
-im_xim_str2keycode(code, state)
- unsigned int *code;
- unsigned int *state;
-{
- int retval = OK;
- int len;
- unsigned keycode = 0, keystate = 0;
- Window window;
- Display *display;
- char_u *flag_end;
- char_u *str;
-
- if (*p_imak != NUL)
- {
- len = STRLEN(p_imak);
- for (flag_end = p_imak + len - 1;
- flag_end > p_imak && *flag_end != '-'; --flag_end)
- ;
-
- /* Parse modifier keys */
- for (str = p_imak; str < flag_end; ++str)
- {
- switch (*str)
- {
- case 's': case 'S':
- keystate |= ShiftMask;
- break;
- case 'l': case 'L':
- keystate |= LockMask;
- break;
- case 'c': case 'C':
- keystate |= ControlMask;
- break;
- case '1':
- keystate |= Mod1Mask;
- break;
- case '2':
- keystate |= Mod2Mask;
- break;
- case '3':
- keystate |= Mod3Mask;
- break;
- case '4':
- keystate |= Mod4Mask;
- break;
- case '5':
- keystate |= Mod5Mask;
- break;
- case '-':
- break;
- default:
- retval = FAIL;
- }
- }
- if (*str == '-')
- ++str;
-
- /* Get keycode from string. */
- gui_get_x11_windis(&window, &display);
- if (display)
- keycode = XKeysymToKeycode(display, XStringToKeysym((char *)str));
- if (keycode == 0)
- retval = FAIL;
-
- if (code != NULL)
- *code = keycode;
- if (state != NULL)
- *state = keystate;
- }
- return retval;
-}
-
- static void
-im_xim_send_event_imactivate()
-{
- /* Force turn on preedit state by simulating keypress event.
- * Keycode and state is specified by 'imactivatekey'.
- */
- XKeyEvent ev;
-
- gui_get_x11_windis(&ev.window, &ev.display);
- ev.root = RootWindow(ev.display, DefaultScreen(ev.display));
- ev.subwindow = None;
- ev.time = CurrentTime;
- ev.x = 1;
- ev.y = 1;
- ev.x_root = 1;
- ev.y_root = 1;
- ev.same_screen = 1;
- ev.type = KeyPress;
- if (im_xim_str2keycode(&ev.keycode, &ev.state) == OK)
- XSendEvent(ev.display, ev.window, 1, KeyPressMask, (XEvent*)&ev);
-}
-
-/*
- * Return TRUE if 'imactivatekey' has a valid value.
- */
- int
-im_xim_isvalid_imactivate()
-{
- return im_xim_str2keycode(NULL, NULL) == OK;
-}
-#endif /* FEAT_GUI_GTK */
-
/*
* Switch using XIM on/off. This is used by the code that changes "State".
*/
@@ -5232,124 +5091,6 @@ im_set_active(active)
/* Remember the active state, it is needed when Vim gets keyboard focus. */
xim_is_active = active;
-
-#ifdef FEAT_GUI_GTK
- /* When 'imactivatekey' has valid key-string, try to control XIM preedit
- * state. When 'imactivatekey' has no or invalid string, try old XIM
- * focus control.
- */
- if (*p_imak != NUL)
- {
- /* BASIC STRATEGY:
- * Destroy old Input Context (XIC), and create new one. New XIC
- * would have a state of preedit that is off. When argument:active
- * is false, that's all. Else argument:active is true, send a key
- * event specified by 'imactivatekey' to activate XIM preedit state.
- */
-
- xim_is_active = TRUE; /* Disable old XIM focus control */
- /* If we can monitor preedit state with preedit callback functions,
- * try least creation of new XIC.
- */
- if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
- {
- if (xim_can_preediting && !active)
- {
- /* Force turn off preedit state. With some IM
- * implementations, we cannot turn off preedit state by
- * simulating keypress event. It is why using such a method
- * that destroy old IC (input context), and create new one.
- * When create new IC, its preedit state is usually off.
- */
- xim_reset();
- xim_set_focus(FALSE);
- gdk_ic_destroy(xic);
- xim_init();
- xim_can_preediting = FALSE;
- }
- else if (!xim_can_preediting && active)
- im_xim_send_event_imactivate();
- }
- else
- {
- /* First, force destroy old IC, and create new one. It
- * simulates "turning off preedit state".
- */
- xim_set_focus(FALSE);
- gdk_ic_destroy(xic);
- xim_init();
- xim_can_preediting = FALSE;
-
- /* 2nd, when requested to activate IM, simulate this by sending
- * the event.
- */
- if (active)
- {
- im_xim_send_event_imactivate();
- xim_can_preediting = TRUE;
- }
- }
- }
- else
- {
-# ifndef XIMPreeditUnKnown
- /* X11R5 doesn't have these, it looks safe enough to define here. */
- typedef unsigned long XIMPreeditState;
-# define XIMPreeditUnKnown 0L
-# define XIMPreeditEnable 1L
-# define XIMPreeditDisable (1L<<1)
-# define XNPreeditState "preeditState"
-# endif
- XIMPreeditState preedit_state = XIMPreeditUnKnown;
- XVaNestedList preedit_attr;
- XIC pxic;
-
- preedit_attr = XVaCreateNestedList(0,
- XNPreeditState, &preedit_state,
- NULL);
- pxic = ((GdkICPrivate *)xic)->xic;
-
- if (!XGetICValues(pxic, XNPreeditAttributes, preedit_attr, NULL))
- {
- XFree(preedit_attr);
- preedit_attr = XVaCreateNestedList(0,
- XNPreeditState,
- active ? XIMPreeditEnable : XIMPreeditDisable,
- NULL);
- XSetICValues(pxic, XNPreeditAttributes, preedit_attr, NULL);
- xim_can_preediting = active;
- xim_is_active = active;
- }
- XFree(preedit_attr);
- }
- if (xim_input_style & XIMPreeditCallbacks)
- {
- preedit_buf_len = 0;
- init_preedit_start_col();
- }
-#else
-# if 0
- /* When had tested kinput2 + canna + Athena GUI version with
- * 'imactivatekey' is "s-space", im_xim_send_event_imactivate() did not
- * work correctly. It just inserted one space. I don't know why we
- * couldn't switch state of XIM preediting. This is reason why these
- * codes are commented out.
- */
- /* First, force destroy old IC, and create new one. It simulates
- * "turning off preedit state".
- */
- xim_set_focus(FALSE);
- XDestroyIC(xic);
- xic = NULL;
- xim_init();
-
- /* 2nd, when requested to activate IM, simulate this by sending the
- * event.
- */
- if (active)
- im_xim_send_event_imactivate();
-# endif
-#endif
xim_set_preedit();
}
@@ -5373,11 +5114,7 @@ xim_set_focus(focus)
if (!xim_has_focus)
{
xim_has_focus = TRUE;
-#ifdef FEAT_GUI_GTK
- gdk_im_begin(xic, gui.drawarea->window);
-#else
XSetICFocus(xic);
-#endif
}
}
else
@@ -5385,11 +5122,7 @@ xim_set_focus(focus)
if (xim_has_focus)
{
xim_has_focus = FALSE;
-#ifdef FEAT_GUI_GTK
- gdk_im_end();
-#else
XUnsetICFocus(xic);
-#endif
}
}
}
@@ -5413,135 +5146,50 @@ xim_set_preedit()
xim_set_focus(TRUE);
-#ifdef FEAT_GUI_GTK
- if (gdk_im_ready())
- {
- int attrmask;
- GdkICAttr *attr;
+ XVaNestedList attr_list;
+ XRectangle spot_area;
+ XPoint over_spot;
+ int line_space;
- if (!xic_attr)
- return;
-
- attr = xic_attr;
- attrmask = 0;
-
-# ifdef FEAT_XFONTSET
- if ((xim_input_style & (int)GDK_IM_PREEDIT_POSITION)
- && gui.fontset != NOFONTSET
- && gui.fontset->type == GDK_FONT_FONTSET)
- {
- if (!xim_has_focus)
- {
- if (attr->spot_location.y >= 0)
- {
- attr->spot_location.x = 0;
- attr->spot_location.y = -100;
- attrmask |= (int)GDK_IC_SPOT_LOCATION;
- }
- }
- else
- {
- gint width, height;
-
- if (attr->spot_location.x != TEXT_X(gui.col)
- || attr->spot_location.y != TEXT_Y(gui.row))
- {
- attr->spot_location.x = TEXT_X(gui.col);
- attr->spot_location.y = TEXT_Y(gui.row);
- attrmask |= (int)GDK_IC_SPOT_LOCATION;
- }
-
- gdk_window_get_size(gui.drawarea->window, &width, &height);
- width -= 2 * gui.border_offset;
- height -= 2 * gui.border_offset;
- if (xim_input_style & (int)GDK_IM_STATUS_AREA)
- height -= gui.char_height;
- if (attr->preedit_area.width != width
- || attr->preedit_area.height != height)
- {
- attr->preedit_area.x = gui.border_offset;
- attr->preedit_area.y = gui.border_offset;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attrmask |= (int)GDK_IC_PREEDIT_AREA;
- }
-
- if (attr->preedit_fontset != gui.current_font)
- {
- attr->preedit_fontset = gui.current_font;
- attrmask |= (int)GDK_IC_PREEDIT_FONTSET;
- }
- }
- }
-# endif /* FEAT_XFONTSET */
+ if (!xim_has_focus)
+ {
+ /* hide XIM cursor */
+ over_spot.x = 0;
+ over_spot.y = -100; /* arbitrary invisible position */
+ attr_list = (XVaNestedList) XVaCreateNestedList(0,
+ XNSpotLocation,
+ &over_spot,
+ NULL);
+ XSetICValues(xic, XNPreeditAttributes, attr_list, NULL);
+ XFree(attr_list);
+ return;
+ }
+ if (input_style & XIMPreeditPosition)
+ {
if (xim_fg_color == INVALCOLOR)
{
xim_fg_color = gui.def_norm_pixel;
xim_bg_color = gui.def_back_pixel;
}
- if (attr->preedit_foreground.pixel != xim_fg_color)
- {
- attr->preedit_foreground.pixel = xim_fg_color;
- attrmask |= (int)GDK_IC_PREEDIT_FOREGROUND;
- }
- if (attr->preedit_background.pixel != xim_bg_color)
- {
- attr->preedit_background.pixel = xim_bg_color;
- attrmask |= (int)GDK_IC_PREEDIT_BACKGROUND;
- }
-
- if (attrmask != 0)
- gdk_ic_set_attr(xic, attr, (GdkICAttributesType)attrmask);
+ over_spot.x = TEXT_X(gui.col);
+ over_spot.y = TEXT_Y(gui.row);
+ spot_area.x = 0;
+ spot_area.y = 0;
+ spot_area.height = gui.char_height * Rows;
+ spot_area.width = gui.char_width * Columns;
+ line_space = gui.char_height;
+ attr_list = (XVaNestedList) XVaCreateNestedList(0,
+ XNSpotLocation, &over_spot,
+ XNForeground, (Pixel) xim_fg_color,
+ XNBackground, (Pixel) xim_bg_color,
+ XNArea, &spot_area,
+ XNLineSpace, line_space,
+ NULL);
+ if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL))
+ EMSG(_("E284: Cannot set IC values"));
+ XFree(attr_list);
}
-#else /* FEAT_GUI_GTK */
- {
- XVaNestedList attr_list;
- XRectangle spot_area;
- XPoint over_spot;
- int line_space;
-
- if (!xim_has_focus)
- {
- /* hide XIM cursor */
- over_spot.x = 0;
- over_spot.y = -100; /* arbitrary invisible position */
- attr_list = (XVaNestedList) XVaCreateNestedList(0,
- XNSpotLocation,
- &over_spot,
- NULL);
- XSetICValues(xic, XNPreeditAttributes, attr_list, NULL);
- XFree(attr_list);
- return;
- }
-
- if (input_style & XIMPreeditPosition)
- {
- if (xim_fg_color == INVALCOLOR)
- {
- xim_fg_color = gui.def_norm_pixel;
- xim_bg_color = gui.def_back_pixel;
- }
- over_spot.x = TEXT_X(gui.col);
- over_spot.y = TEXT_Y(gui.row);
- spot_area.x = 0;
- spot_area.y = 0;
- spot_area.height = gui.char_height * Rows;
- spot_area.width = gui.char_width * Columns;
- line_space = gui.char_height;
- attr_list = (XVaNestedList) XVaCreateNestedList(0,
- XNSpotLocation, &over_spot,
- XNForeground, (Pixel) xim_fg_color,
- XNBackground, (Pixel) xim_bg_color,
- XNArea, &spot_area,
- XNLineSpace, line_space,
- NULL);
- if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL))
- EMSG(_("E284: Cannot set IC values"));
- XFree(attr_list);
- }
- }
-#endif /* FEAT_GUI_GTK */
}
/*
@@ -5558,137 +5206,98 @@ xim_set_status_area()
if (xic == NULL)
return;
-#ifdef FEAT_GUI_GTK
-# if defined(FEAT_XFONTSET)
- if (use_status_area)
- {
- GdkICAttr *attr;
- int style;
- gint width, height;
- GtkWidget *widget;
- int attrmask;
-
- if (!xic_attr)
- return;
+ XVaNestedList preedit_list = 0, status_list = 0, list = 0;
+ XRectangle pre_area, status_area;
- attr = xic_attr;
- attrmask = 0;
- style = (int)gdk_ic_get_style(xic);
- if ((style & (int)GDK_IM_STATUS_MASK) == (int)GDK_IM_STATUS_AREA)
- {
- if (gui.fontset != NOFONTSET
- && gui.fontset->type == GDK_FONT_FONTSET)
- {
- widget = gui.mainwin;
- gdk_window_get_size(widget->window, &width, &height);
-
- attrmask |= (int)GDK_IC_STATUS_AREA;
- attr->status_area.x = 0;
- attr->status_area.y = height - gui.char_height - 1;
- attr->status_area.width = width;
- attr->status_area.height = gui.char_height;
- }
- }
- if (attrmask != 0)
- gdk_ic_set_attr(xic, attr, (GdkICAttributesType)attrmask);
- }
-# endif
-#else
+ if (input_style & XIMStatusArea)
{
- XVaNestedList preedit_list = 0, status_list = 0, list = 0;
- XRectangle pre_area, status_area;
-
- if (input_style & XIMStatusArea)
+ if (input_style & XIMPreeditArea)
{
- if (input_style & XIMPreeditArea)
- {
- XRectangle *needed_rect;
+ XRectangle *needed_rect;
- /* to get status_area width */
- status_list = XVaCreateNestedList(0, XNAreaNeeded,
- &needed_rect, NULL);
- XGetICValues(xic, XNStatusAttributes, status_list, NULL);
- XFree(status_list);
+ /* to get status_area width */
+ status_list = XVaCreateNestedList(0, XNAreaNeeded,
+ &needed_rect, NULL);
+ XGetICValues(xic, XNStatusAttributes, status_list, NULL);
+ XFree(status_list);
- status_area.width = needed_rect->width;
- }
- else
- status_area.width = gui.char_width * Columns;
+ status_area.width = needed_rect->width;
+ }
+ else
+ status_area.width = gui.char_width * Columns;
- status_area.x = 0;
- status_area.y = gui.char_height * Rows + gui.border_offset;
- if (gui.which_scrollbars[SBAR_BOTTOM])
- status_area.y += gui.scrollbar_height;
+ status_area.x = 0;
+ status_area.y = gui.char_height * Rows + gui.border_offset;
+ if (gui.which_scrollbars[SBAR_BOTTOM])
+ status_area.y += gui.scrollbar_height;
#ifdef FEAT_MENU
- if (gui.menu_is_active)
- status_area.y += gui.menu_height;
+ if (gui.menu_is_active)
+ status_area.y += gui.menu_height;
#endif
- status_area.height = gui.char_height;
- status_list = XVaCreateNestedList(0, XNArea, &status_area, NULL);
- }
- else
- {
- status_area.x = 0;
- status_area.y = gui.char_height * Rows + gui.border_offset;
- if (gui.which_scrollbars[SBAR_BOTTOM])
- status_area.y += gui.scrollbar_height;
+ status_area.height = gui.char_height;
+ status_list = XVaCreateNestedList(0, XNArea, &status_area, NULL);
+ }
+ else
+ {
+ status_area.x = 0;
+ status_area.y = gui.char_height * Rows + gui.border_offset;
+ if (gui.which_scrollbars[SBAR_BOTTOM])
+ status_area.y += gui.scrollbar_height;
#ifdef FEAT_MENU
- if (gui.menu_is_active)
- status_area.y += gui.menu_height;
+ if (gui.menu_is_active)
+ status_area.y += gui.menu_height;
#endif
- status_area.width = 0;
- status_area.height = gui.char_height;
- }
+ status_area.width = 0;
+ status_area.height = gui.char_height;
+ }
- if (input_style & XIMPreeditArea) /* off-the-spot */
- {
- pre_area.x = status_area.x + status_area.width;
- pre_area.y = gui.char_height * Rows + gui.border_offset;
- pre_area.width = gui.char_width * Columns - pre_area.x;
- if (gui.which_scrollbars[SBAR_BOTTOM])
- pre_area.y += gui.scrollbar_height;
+ if (input_style & XIMPreeditArea) /* off-the-spot */
+ {
+ pre_area.x = status_area.x + status_area.width;
+ pre_area.y = gui.char_height * Rows + gui.border_offset;
+ pre_area.width = gui.char_width * Columns - pre_area.x;
+ if (gui.which_scrollbars[SBAR_BOTTOM])
+ pre_area.y += gui.scrollbar_height;
#ifdef FEAT_MENU
- if (gui.menu_is_active)
- pre_area.y += gui.menu_height;
+ if (gui.menu_is_active)
+ pre_area.y += gui.menu_height;
#endif
- pre_area.height = gui.char_height;
- preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL);
- }
- else if (input_style & XIMPreeditPosition) /* over-the-spot */
- {
- pre_area.x = 0;
- pre_area.y = 0;
- pre_area.height = gui.char_height * Rows;
- pre_area.width = gui.char_width * Columns;
- preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL);
- }
+ pre_area.height = gui.char_height;
+ preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL);
+ }
+ else if (input_style & XIMPreeditPosition) /* over-the-spot */
+ {
+ pre_area.x = 0;
+ pre_area.y = 0;
+ pre_area.height = gui.char_height * Rows;
+ pre_area.width = gui.char_width * Columns;
+ preedit_list = XVaCreateNestedList(0, XNArea, &pre_area, NULL);
+ }
- if (preedit_list && status_list)
- list = XVaCreateNestedList(0, XNPreeditAttributes, preedit_list,
- XNStatusAttributes, status_list, NULL);
- else if (preedit_list)
- list = XVaCreateNestedList(0, XNPreeditAttributes, preedit_list,
- NULL);
- else if (status_list)
- list = XVaCreateNestedList(0, XNStatusAttributes, status_list,
- NULL);
- else
- list = NULL;
+ if (preedit_list && status_list)
+ list = XVaCreateNestedList(0, XNPreeditAttributes, preedit_list,
+ XNStatusAttributes, status_list, NULL);
+ else if (preedit_list)
+ list = XVaCreateNestedList(0, XNPreeditAttributes, preedit_list,
+ NULL);
+ else if (status_list)
+ list = XVaCreateNestedList(0, XNStatusAttributes, status_list,
+ NULL);
+ else
+ list = NULL;
- if (list)
- {
- XSetICValues(xic, XNVaNestedList, list, NULL);
- XFree(list);
- }
- if (status_list)
- XFree(status_list);
- if (preedit_list)
- XFree(preedit_list);
+ if (list)
+ {
+ XSetICValues(xic, XNVaNestedList, list, NULL);
+ XFree(list);
}
-#endif
+ if (status_list)
+ XFree(status_list);
+ if (preedit_list)
+ XFree(preedit_list);
}
-#if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
+#if defined(FEAT_GUI_X11)
static char e_xim[] = N_("E285: Failed to create input context");
#endif
@@ -5998,483 +5607,11 @@ xim_real_init(x11_window, x11_display)
#endif /* FEAT_GUI_X11 */
-#if defined(FEAT_GUI_GTK) || defined(PROTO)
-
-# ifdef FEAT_XFONTSET
-static char e_overthespot[] = N_("E290: over-the-spot style requires fontset");
-# endif
-
-# ifdef PROTO
-typedef int GdkIC;
-# endif
-
- void
-xim_decide_input_style()
-{
- /* GDK_IM_STATUS_CALLBACKS was disabled, enabled it to allow Japanese
- * OverTheSpot. */
- int supported_style = (int)GDK_IM_PREEDIT_NONE |
- (int)GDK_IM_PREEDIT_NOTHING |
- (int)GDK_IM_PREEDIT_POSITION |
- (int)GDK_IM_PREEDIT_CALLBACKS |
- (int)GDK_IM_STATUS_CALLBACKS |
- (int)GDK_IM_STATUS_AREA |
- (int)GDK_IM_STATUS_NONE |
- (int)GDK_IM_STATUS_NOTHING;
-
-#ifdef XIM_DEBUG
- xim_log("xim_decide_input_style()\n");
-#endif
-
- if (!gdk_im_ready())
- xim_input_style = 0;
- else
- {
- if (gtk_major_version > 1
- || (gtk_major_version == 1
- && (gtk_minor_version > 2
- || (gtk_minor_version == 2 && gtk_micro_version >= 3))))
- use_status_area = TRUE;
- else
- {
- EMSG(_("E291: Your GTK+ is older than 1.2.3. Status area disabled"));
- use_status_area = FALSE;
- }
-#ifdef FEAT_XFONTSET
- if (gui.fontset == NOFONTSET || gui.fontset->type != GDK_FONT_FONTSET)
-#endif
- supported_style &= ~((int)GDK_IM_PREEDIT_POSITION
- | (int)GDK_IM_STATUS_AREA);
- if (!use_status_area)
- supported_style &= ~(int)GDK_IM_STATUS_AREA;
- xim_input_style = (int)gdk_im_decide_style((GdkIMStyle)supported_style);
- }
-}
-
- static void
-preedit_start_cbproc(XIC thexic UNUSED,
- XPointer client_data UNUSED,
- XPointer call_data UNUSED)
-{
-#ifdef XIM_DEBUG
- xim_log("xim_decide_input_style()\n");
-#endif
-
- draw_feedback = NULL;
- xim_can_preediting = TRUE;
- xim_has_preediting = TRUE;
- gui_update_cursor(TRUE, FALSE);
- if (showmode() > 0)
- {
- setcursor();
- out_flush();
- }
-}
-
- static void
-xim_back_delete(int n)
-{
- char_u str[3];
-
- str[0] = CSI;
- str[1] = 'k';
- str[2] = 'b';
- while (n-- > 0)
- add_to_input_buf(str, 3);
-}
-
-static GSList *key_press_event_queue = NULL;
-static gboolean processing_queued_event = FALSE;
-
- static void
-preedit_draw_cbproc(XIC thexic UNUSED,
- XPointer client_data UNUSED,
- XPointer call_data)
-{
- XIMPreeditDrawCallbackStruct *draw_data;
- XIMText *text;
- char *src;
- GSList *event_queue;
-
-#ifdef XIM_DEBUG
- xim_log("preedit_draw_cbproc()\n");
-#endif
-
- draw_data = (XIMPreeditDrawCallbackStruct *) call_data;
- text = (XIMText *) draw_data->text;
-
- if ((text == NULL && draw_data->chg_length == preedit_buf_len)
- || preedit_buf_len == 0)
- {
- init_preedit_start_col();
- vim_free(draw_feedback);
- draw_feedback = NULL;
- }
- if (draw_data->chg_length > 0)
- {
- int bs_cnt;
-
- if (draw_data->chg_length > preedit_buf_len)
- bs_cnt = preedit_buf_len;
- else
- bs_cnt = draw_data->chg_length;
- xim_back_delete(bs_cnt);
- preedit_buf_len -= bs_cnt;
- }
- if (text != NULL)
- {
- int len;
-#ifdef FEAT_MBYTE
- char_u *buf = NULL;
- unsigned int nfeedback = 0;
-#endif
- char_u *ptr;
-
- src = text->string.multi_byte;
- if (src != NULL && !text->encoding_is_wchar)
- {
- len = strlen(src);
- ptr = (char_u *)src;
- /* Avoid the enter for decision */
- if (*ptr == '\n')
- return;
-
-#ifdef FEAT_MBYTE
- if (input_conv.vc_type != CONV_NONE
- && (buf = string_convert(&input_conv,
- (char_u *)src, &len)) != NULL)
- {
- /* Converted from 'termencoding' to 'encoding'. */
- add_to_input_buf_csi(buf, len);
- ptr = buf;
- }
- else
-#endif
- add_to_input_buf_csi((char_u *)src, len);
- /* Add count of character to preedit_buf_len */
- while (*ptr != NUL)
- {
-#ifdef FEAT_MBYTE
- if (draw_data->text->feedback != NULL)
- {
- if (draw_feedback == NULL)
- draw_feedback = (char *)alloc(draw_data->chg_first
- + text->length);
- else
- draw_feedback = vim_realloc(draw_feedback,
- draw_data->chg_first + text->length);
- if (draw_feedback != NULL)
- {
- draw_feedback[nfeedback + draw_data->chg_first]
- = draw_data->text->feedback[nfeedback];
- nfeedback++;
- }
- }
- if (has_mbyte)
- ptr += (*mb_ptr2len)(ptr);
- else
-#endif
- ptr++;
- preedit_buf_len++;
- }
-#ifdef FEAT_MBYTE
- vim_free(buf);
-#endif
- preedit_end_col = MAXCOL;
- }
- }
- if (text != NULL || draw_data->chg_length > 0)
- {
- event_queue = key_press_event_queue;
- processing_queued_event = TRUE;
- while (event_queue != NULL && processing_queued_event)
- {
- GdkEvent *ev = event_queue->data;
-
- gboolean *ret;
- gtk_signal_emit_by_name((GtkObject*)gui.mainwin, "key_press_event",
- ev, &ret);
- gdk_event_free(ev);
- event_queue = event_queue->next;
- }
- processing_queued_event = FALSE;
- if (key_press_event_queue)
- {
- g_slist_free(key_press_event_queue);
- key_press_event_queue = NULL;
- }
- }
- if (gtk_main_level() > 0)
- gtk_main_quit();
-}
-
-/*
- * Retrieve the highlighting attributes at column col in the preedit string.
- * Return -1 if not in preediting mode or if col is out of range.
- */
- int
-im_get_feedback_attr(int col)
-{
- if (draw_feedback != NULL && col < preedit_buf_len)
- {
- if (draw_feedback[col] & XIMReverse)
- return HL_INVERSE;
- else if (draw_feedback[col] & XIMUnderline)
- return HL_UNDERLINE;
- else
- return hl_attr(HLF_V);
- }
-
- return -1;
-}
-
- static void
-preedit_caret_cbproc(XIC thexic UNUSED,
- XPointer client_data UNUSED,
- XPointer call_data UNUSED)
-{
-#ifdef XIM_DEBUG
- xim_log("preedit_caret_cbproc()\n");
-#endif
-}
-
- static void
-preedit_done_cbproc(XIC thexic UNUSED,
- XPointer client_data UNUSED,
- XPointer call_data UNUSED)
-{
-#ifdef XIM_DEBUG
- xim_log("preedit_done_cbproc()\n");
-#endif
-
- vim_free(draw_feedback);
- draw_feedback = NULL;
- xim_can_preediting = FALSE;
- xim_has_preediting = FALSE;
- gui_update_cursor(TRUE, FALSE);
- if (showmode() > 0)
- {
- setcursor();
- out_flush();
- }
-}
-
- void
-xim_reset(void)
-{
- char *text;
-
-#ifdef XIM_DEBUG
- xim_log("xim_reset()\n");
-#endif
-
- if (xic != NULL)
- {
- text = XmbResetIC(((GdkICPrivate *)xic)->xic);
- if (text != NULL && !(xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS))
- add_to_input_buf_csi((char_u *)text, strlen(text));
- else
- preedit_buf_len = 0;
- if (text != NULL)
- XFree(text);
- }
-}
-
- int
-xim_queue_key_press_event(GdkEventKey *event, int down UNUSED)
-{
-#ifdef XIM_DEBUG
- xim_log("xim_queue_key_press_event()\n");
-#endif
-
- if (preedit_buf_len <= 0)
- return FALSE;
- if (processing_queued_event)
- processing_queued_event = FALSE;
-
- key_press_event_queue = g_slist_append(key_press_event_queue,
- gdk_event_copy((GdkEvent *)event));
- return TRUE;
-}
-
- static void
-preedit_callback_setup(GdkIC *ic UNUSED)
-{
- XIC xxic;
- XVaNestedList preedit_attr;
- XIMCallback preedit_start_cb;
- XIMCallback preedit_draw_cb;
- XIMCallback preedit_caret_cb;
- XIMCallback preedit_done_cb;
-
- xxic = ((GdkICPrivate*)xic)->xic;
- preedit_start_cb.callback = (XIMProc)preedit_start_cbproc;
- preedit_draw_cb.callback = (XIMProc)preedit_draw_cbproc;
- preedit_caret_cb.callback = (XIMProc)preedit_caret_cbproc;
- preedit_done_cb.callback = (XIMProc)preedit_done_cbproc;
- preedit_attr
- = XVaCreateNestedList(0,
- XNPreeditStartCallback, &preedit_start_cb,
- XNPreeditDrawCallback, &preedit_draw_cb,
- XNPreeditCaretCallback, &preedit_caret_cb,
- XNPreeditDoneCallback, &preedit_done_cb,
- NULL);
- XSetICValues(xxic, XNPreeditAttributes, preedit_attr, NULL);
- XFree(preedit_attr);
-}
-
- static void
-reset_state_setup(GdkIC *ic UNUSED)
-{
-#ifdef USE_X11R6_XIM
- /* don't change the input context when we call reset */
- XSetICValues(((GdkICPrivate *)ic)->xic, XNResetState, XIMPreserveState,
- NULL);
-#endif
-}
-
- void
-xim_init(void)
-{
-#ifdef XIM_DEBUG
- xim_log("xim_init()\n");
-#endif
-
- xic = NULL;
- xic_attr = NULL;
-
- if (!gdk_im_ready())
- {
- if (p_verbose > 0)
- {
- verbose_enter();
- EMSG(_("E292: Input Method Server is not running"));
- verbose_leave();
- }
- return;
- }
- if ((xic_attr = gdk_ic_attr_new()) != NULL)
- {
-#ifdef FEAT_XFONTSET
- gint width, height;
-#endif
- int mask;
- GdkColormap *colormap;
- GdkICAttr *attr = xic_attr;
- int attrmask = (int)GDK_IC_ALL_REQ;
- GtkWidget *widget = gui.drawarea;
-
- attr->style = (GdkIMStyle)xim_input_style;
- attr->client_window = gui.mainwin->window;
-
- if ((colormap = gtk_widget_get_colormap(widget)) !=
- gtk_widget_get_default_colormap())
- {
- attrmask |= (int)GDK_IC_PREEDIT_COLORMAP;
- attr->preedit_colormap = colormap;
- }
- attrmask |= (int)GDK_IC_PREEDIT_FOREGROUND;
- attrmask |= (int)GDK_IC_PREEDIT_BACKGROUND;
- attr->preedit_foreground = widget->style->fg[GTK_STATE_NORMAL];
- attr->preedit_background = widget->style->base[GTK_STATE_NORMAL];
-
-#ifdef FEAT_XFONTSET
- if ((xim_input_style & (int)GDK_IM_PREEDIT_MASK)
- == (int)GDK_IM_PREEDIT_POSITION)
- {
- if (gui.fontset == NOFONTSET
- || gui.fontset->type != GDK_FONT_FONTSET)
- {
- EMSG(_(e_overthespot));
- }
- else
- {
- gdk_window_get_size(widget->window, &width, &height);
-
- attrmask |= (int)GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = TEXT_X(0);
- attr->spot_location.y = TEXT_Y(0);
- attr->preedit_area.x = gui.border_offset;
- attr->preedit_area.y = gui.border_offset;
- attr->preedit_area.width = width - 2*gui.border_offset;
- attr->preedit_area.height = height - 2*gui.border_offset;
- attr->preedit_fontset = gui.fontset;
- }
- }
-
- if ((xim_input_style & (int)GDK_IM_STATUS_MASK)
- == (int)GDK_IM_STATUS_AREA)
- {
- if (gui.fontset == NOFONTSET
- || gui.fontset->type != GDK_FONT_FONTSET)
- {
- EMSG(_(e_overthespot));
- }
- else
- {
- gdk_window_get_size(gui.mainwin->window, &width, &height);
- attrmask |= (int)GDK_IC_STATUS_AREA_REQ;
- attr->status_area.x = 0;
- attr->status_area.y = height - gui.char_height - 1;
- attr->status_area.width = width;
- attr->status_area.height = gui.char_height;
- attr->status_fontset = gui.fontset;
- }
- }
- else if ((xim_input_style & (int)GDK_IM_STATUS_MASK)
- == (int)GDK_IM_STATUS_CALLBACKS)
- {
- /* FIXME */
- }
-#endif
-
- xic = gdk_ic_new(attr, (GdkICAttributesType)attrmask);
-
- if (xic == NULL)
- EMSG(_(e_xim));
- else
- {
- mask = (int)gdk_window_get_events(widget->window);
- mask |= (int)gdk_ic_get_events(xic);
- gdk_window_set_events(widget->window, (GdkEventMask)mask);
- if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
- preedit_callback_setup(xic);
- reset_state_setup(xic);
- }
- }
-}
-
- void
-im_shutdown(void)
-{
-#ifdef XIM_DEBUG
- xim_log("im_shutdown()\n");
-#endif
-
- if (xic != NULL)
- {
- gdk_im_end();
- gdk_ic_destroy(xic);
- xic = NULL;
- }
- xim_is_active = FALSE;
- xim_can_preediting = FALSE;
- preedit_start_col = MAXCOL;
- xim_has_preediting = FALSE;
-}
-
-#endif /* FEAT_GUI_GTK */
-
int
xim_get_status_area_height()
{
-#ifdef FEAT_GUI_GTK
- if (xim_input_style & (int)GDK_IM_STATUS_AREA)
- return gui.char_height;
-#else
if (status_area_enabled)
return gui.char_height;
-#endif
return 0;
}
@@ -6487,10 +5624,6 @@ xim_get_status_area_height()
int
im_get_status()
{
-# ifdef FEAT_GUI_GTK
- if (xim_input_style & (int)GDK_IM_PREEDIT_CALLBACKS)
- return xim_can_preediting;
-# endif
return xim_has_focus;
}
diff --git a/src/option.c b/src/option.c
index ae3c53912..10768844e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2582,7 +2582,7 @@ static struct vimoption
{(char_u *)"icons,tooltips", (char_u *)0L}
SCRIPTID_INIT},
#endif
-#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
{"toolbariconsize", "tbis", P_STRING|P_VI_DEF,
(char_u *)&p_tbis, PV_NONE,
{(char_u *)"small", (char_u *)0L} SCRIPTID_INIT},
@@ -5152,7 +5152,7 @@ didset_options()
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32)
(void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE);
#endif
-#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
(void)opt_strings_flags(p_tbis, p_tbis_values, &tbis_flags, FALSE);
#endif
#ifdef FEAT_CMDWIN
@@ -5825,7 +5825,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
}
-# if defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
+# if defined(FEAT_GUI_GTK)
if (errmsg == NULL && varp == &p_tenc && gui.in_use)
{
/* GTK+ 2 uses only a single encoding, and that is UTF-8. */
@@ -6602,7 +6602,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
#endif
-#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
/* 'toolbariconsize': GTK+ 2 only */
else if (varp == &p_tbis)
{
diff --git a/src/option.h b/src/option.h
index 489bdb2a9..08f1f4baa 100644
--- a/src/option.h
+++ b/src/option.h
@@ -544,7 +544,7 @@ EXTERN int p_icon; /* 'icon' */
EXTERN char_u *p_iconstring; /* 'iconstring' */
#endif
EXTERN int p_ic; /* 'ignorecase' */
-#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK))
+#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
EXTERN char_u *p_imak; /* 'imactivatekey' */
#endif
#ifdef USE_IM_CONTROL
@@ -790,7 +790,7 @@ static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL}
# define TOOLBAR_TOOLTIPS 0x04
# define TOOLBAR_HORIZ 0x08
#endif
-#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK) && defined(HAVE_GTK2)
+#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
EXTERN char_u *p_tbis; /* 'toolbariconsize' */
EXTERN unsigned tbis_flags;
# ifdef IN_OPTION_C
diff --git a/src/os_unix.c b/src/os_unix.c
index 365e965f8..cb323c80f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2991,7 +2991,6 @@ mch_free_mem()
}
# endif
# endif
- /* Don't close the display for GTK 1, it is done in exit(). */
# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
if (x11_display != NULL
# ifdef FEAT_XCLIPBOARD
diff --git a/src/proto/gui_gtk.pro b/src/proto/gui_gtk.pro
index 960d631b9..8b883582a 100644
--- a/src/proto/gui_gtk.pro
+++ b/src/proto/gui_gtk.pro
@@ -18,6 +18,5 @@ void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
void gui_make_popup __ARGS((char_u *path_name, int mouse_pos));
void gui_mch_find_dialog __ARGS((exarg_T *eap));
void gui_mch_replace_dialog __ARGS((exarg_T *eap));
-void gui_gtk_synch_fonts __ARGS((void));
void ex_helpfind __ARGS((exarg_T *eap));
/* vim: set ft=c : */
diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro
index d80ba82e6..2484082b7 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -26,21 +26,16 @@ void gui_mch_settitle __ARGS((char_u *title, char_u *icon));
void gui_mch_enable_menu __ARGS((int showit));
void gui_mch_show_toolbar __ARGS((int showit));
int gui_mch_adjust_charheight __ARGS((void));
-GuiFontset gui_mch_get_fontset __ARGS((char_u *name, int report_error, int fixed_width));
char_u *gui_mch_font_dialog __ARGS((char_u *oldval));
int gui_mch_init_font __ARGS((char_u *font_name, int fontset));
GuiFont gui_mch_get_font __ARGS((char_u *name, int report_error));
char_u *gui_mch_get_fontname __ARGS((GuiFont font, char_u *name));
-void gui_mch_set_font __ARGS((GuiFont font));
-void gui_mch_set_fontset __ARGS((GuiFontset fontset));
void gui_mch_free_font __ARGS((GuiFont font));
-void gui_mch_free_fontset __ARGS((GuiFontset fontset));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
void gui_mch_set_sp_color __ARGS((guicolor_T color));
int gui_gtk2_draw_string __ARGS((int row, int col, char_u *s, int len, int flags));
-void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags));
int gui_mch_haskey __ARGS((char_u *name));
int gui_get_x11_windis __ARGS((Window *win, Display **dis));
Display *gui_mch_get_display __ARGS((void));
diff --git a/src/version.c b/src/version.c
index c0026708c..744a6d50c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -916,17 +916,9 @@ list_version()
#else
# ifdef FEAT_GUI_GTK
# ifdef FEAT_GUI_GNOME
-# ifdef HAVE_GTK2
MSG_PUTS(_("with GTK2-GNOME GUI."));
-# else
- MSG_PUTS(_("with GTK-GNOME GUI."));
-# endif
# else
-# ifdef HAVE_GTK2
MSG_PUTS(_("with GTK2 GUI."));
-# else
- MSG_PUTS(_("with GTK GUI."));
-# endif
# endif
# else
# ifdef FEAT_GUI_MOTIF