aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-06-15 11:07:38 -0700
committerPaul Eggert2011-06-15 11:07:38 -0700
commitff672d2c8785de6faba84a400fb8153e9fa07cd2 (patch)
tree4c5dc68b7a92e54c86e47f3bd9a804c14be57091
parente69dafade3ccd5c2997a3f6fd6c7bea29e75ad8e (diff)
parentb96e6cde3e311cd79f8ad134291d41c8c64cc6ad (diff)
downloademacs-ff672d2c8785de6faba84a400fb8153e9fa07cd2.tar.gz
emacs-ff672d2c8785de6faba84a400fb8153e9fa07cd2.zip
Merge from trunk.
-rw-r--r--ChangeLog4
-rw-r--r--admin/CPP-DEFINES26
-rwxr-xr-xautogen/configure5
-rw-r--r--configure.in5
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/processes.texi2
-rw-r--r--lisp/ChangeLog33
-rw-r--r--lisp/progmodes/cfengine.el2
-rw-r--r--lisp/progmodes/ld-script.el2
-rw-r--r--lisp/progmodes/mixal-mode.el2
-rw-r--r--lisp/progmodes/ps-mode.el2
-rw-r--r--lisp/progmodes/python.el2
-rw-r--r--lisp/subr.el2
-rw-r--r--lisp/window.el46
-rw-r--r--src/ChangeLog30
-rw-r--r--src/emacsgtkfixed.c123
-rw-r--r--src/emacsgtkfixed.h58
-rw-r--r--src/gtkutil.c76
-rw-r--r--src/gtkutil.h2
-rw-r--r--src/xfns.c2
20 files changed, 352 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index 3e404183669..cd73001d541 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12011-06-14 Jan Djärv <jan.h.d@swipnet.se>
2
3 * configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3.
4
12011-06-08 Paul Eggert <eggert@cs.ucla.edu> 52011-06-08 Paul Eggert <eggert@cs.ucla.edu>
2 6
3 * lib/gnulib.mk, m4/gnulib-common.m4: Merge from gnulib. 7 * lib/gnulib.mk, m4/gnulib-common.m4: Merge from gnulib.
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 7f6a18f7d54..6e0f736a06f 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -53,8 +53,6 @@ CLASH_DETECTION
53COFF 53COFF
54FIRST_PTY_LETTER 54FIRST_PTY_LETTER
55HAVE_PTYS 55HAVE_PTYS
56HAVE_TERMIO
57HAVE_TERMIOS
58INTERRUPT_INPUT 56INTERRUPT_INPUT
59NARROWPROTO 57NARROWPROTO
60SEPCHAR 58SEPCHAR
@@ -175,7 +173,6 @@ HAVE_SYS_SYSTEMINFO_H
175HAVE_SYS_TIMEB_H 173HAVE_SYS_TIMEB_H
176HAVE_SYS_TIME_H 174HAVE_SYS_TIME_H
177HAVE_TCATTR 175HAVE_TCATTR
178HAVE_TERMIOS_H
179HAVE_TIMEVAL 176HAVE_TIMEVAL
180HAVE_TM_ZONE 177HAVE_TM_ZONE
181HAVE_TZSET 178HAVE_TZSET
@@ -258,14 +255,9 @@ USG5_4
258USG_SUBTTY_WORKS 255USG_SUBTTY_WORKS
259VALBITS 256VALBITS
260WRETCODE 257WRETCODE
261XINT
262XOS_NEEDS_TIME_H 258XOS_NEEDS_TIME_H
263XPNTR
264XSET
265XUINT
266_AIX 259_AIX
267_ARCH_PPC64 260_ARCH_PPC64
268_CALLBACK_
269_FILE_OFFSET_BITS 261_FILE_OFFSET_BITS
270_LP64 262_LP64
271_MALLOC_INTERNAL 263_MALLOC_INTERNAL
@@ -273,21 +265,6 @@ _NAIVE_DOS_REGS
273_VARARGS_ 265_VARARGS_
274_WINSOCKAPI_ 266_WINSOCKAPI_
275_WINSOCK_H 267_WINSOCK_H
276__ELF__
277__FreeBSD__
278__GNUC__
279__GNU_LIBRARY__
280__GNUC_MINOR__
281__NetBSD__
282__OpenBSD__
283__STDC__
284__arch64__
285__cplusplus
286__hpux
287__ia64__
288__linux__
289__mc68000__
290__mips__
291_longjmp 268_longjmp
292_setjmp 269_setjmp
293_start 270_start
@@ -323,9 +300,7 @@ getenv
323getpid 300getpid
324getuid 301getuid
325gmtime 302gmtime
326i386
327index 303index
328init_process
329isatty 304isatty
330kill 305kill
331link 306link
@@ -333,7 +308,6 @@ linux
333localtime 308localtime
334logb 309logb
335lseek 310lseek
336m68k
337malloc 311malloc
338mkdir 312mkdir
339mktemp 313mktemp
diff --git a/autogen/configure b/autogen/configure
index c76bb4acf18..e4a96f2b2d7 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -10483,6 +10483,7 @@ fi
10483 10483
10484 10484
10485HAVE_GTK=no 10485HAVE_GTK=no
10486GTK_OBJ=
10486if test "${with_gtk3}" = "yes"; then 10487if test "${with_gtk3}" = "yes"; then
10487 GLIB_REQUIRED=2.28 10488 GLIB_REQUIRED=2.28
10488 GTK_REQUIRED=3.0 10489 GTK_REQUIRED=3.0
@@ -10588,6 +10589,7 @@ $as_echo "no" >&6; }
10588 10589
10589$as_echo "#define HAVE_GTK3 1" >>confdefs.h 10590$as_echo "#define HAVE_GTK3 1" >>confdefs.h
10590 10591
10592 GTK_OBJ=emacsgtkfixed.o
10591fi 10593fi
10592 10594
10593if test "$pkg_check_gtk" != "yes"; then 10595if test "$pkg_check_gtk" != "yes"; then
@@ -10697,7 +10699,6 @@ $as_echo "no" >&6; }
10697fi 10699fi
10698fi 10700fi
10699 10701
10700GTK_OBJ=
10701if test x"$pkg_check_gtk" = xyes; then 10702if test x"$pkg_check_gtk" = xyes; then
10702 10703
10703 10704
@@ -10726,7 +10727,7 @@ done
10726 10727
10727$as_echo "#define USE_GTK 1" >>confdefs.h 10728$as_echo "#define USE_GTK 1" >>confdefs.h
10728 10729
10729 GTK_OBJ=gtkutil.o 10730 GTK_OBJ="gtkutil.o $GTK_OBJ"
10730 USE_X_TOOLKIT=none 10731 USE_X_TOOLKIT=none
10731 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then 10732 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
10732 : 10733 :
diff --git a/configure.in b/configure.in
index 3d507789f22..9e7ea8522b2 100644
--- a/configure.in
+++ b/configure.in
@@ -1819,6 +1819,7 @@ fi
1819 1819
1820 1820
1821HAVE_GTK=no 1821HAVE_GTK=no
1822GTK_OBJ=
1822if test "${with_gtk3}" = "yes"; then 1823if test "${with_gtk3}" = "yes"; then
1823 GLIB_REQUIRED=2.28 1824 GLIB_REQUIRED=2.28
1824 GTK_REQUIRED=3.0 1825 GTK_REQUIRED=3.0
@@ -1830,6 +1831,7 @@ if test "${with_gtk3}" = "yes"; then
1830 AC_MSG_ERROR($GTK_PKG_ERRORS) 1831 AC_MSG_ERROR($GTK_PKG_ERRORS)
1831 fi 1832 fi
1832 AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) 1833 AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
1834 GTK_OBJ=emacsgtkfixed.o
1833fi 1835fi
1834 1836
1835if test "$pkg_check_gtk" != "yes"; then 1837if test "$pkg_check_gtk" != "yes"; then
@@ -1847,7 +1849,6 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
1847fi 1849fi
1848fi 1850fi
1849 1851
1850GTK_OBJ=
1851if test x"$pkg_check_gtk" = xyes; then 1852if test x"$pkg_check_gtk" = xyes; then
1852 1853
1853 AC_SUBST(GTK_CFLAGS) 1854 AC_SUBST(GTK_CFLAGS)
@@ -1865,7 +1866,7 @@ if test x"$pkg_check_gtk" = xyes; then
1865 else 1866 else
1866 HAVE_GTK=yes 1867 HAVE_GTK=yes
1867 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.]) 1868 AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
1868 GTK_OBJ=gtkutil.o 1869 GTK_OBJ="gtkutil.o $GTK_OBJ"
1869 USE_X_TOOLKIT=none 1870 USE_X_TOOLKIT=none
1870 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then 1871 if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
1871 : 1872 :
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 54ad6abdb07..f647bb00f91 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * processes.texi (Process Information): Renamed `process-alive-p'
4 to `process-live-p' for consistency with other `-live-p' functions.
5
12011-06-03 Paul Eggert <eggert@cs.ucla.edu> 62011-06-03 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Document wide integers better. 8 Document wide integers better.
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 2284699c82b..5d5b11497f7 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -859,7 +859,7 @@ For a network connection, @code{process-status} returns one of the symbols
859closed the connection, or Emacs did @code{delete-process}. 859closed the connection, or Emacs did @code{delete-process}.
860@end defun 860@end defun
861 861
862@defun process-alive-p process 862@defun process-live-p process
863This function returns nin-@code{nil} if @var{process} is alive. A 863This function returns nin-@code{nil} if @var{process} is alive. A
864process is considered alive if its status is @code{run}, @code{open}, 864process is considered alive if its status is @code{run}, @code{open},
865@code{listen}, @code{connect} or @code{stop}. 865@code{listen}, @code{connect} or @code{stop}.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2cf968505af..622831cb31f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,36 @@
12011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * subr.el (process-live-p): Renamed from `process-alive-p' for
4 consistency with other `-live-p' functions.
5
62011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * window.el (same-window-buffer-names, same-window-regexps)
9 (special-display-frame-alist, special-display-popup-frame)
10 (special-display-function, special-display-buffer-names)
11 (special-display-regexps, pop-up-frame-alist)
12 (pop-up-frame-function, pop-up-frames, display-buffer-reuse-frames)
13 (pop-up-windows, split-window-preferred-function)
14 (split-height-threshold, split-width-threshold, even-window-heights)
15 (display-buffer-mark-dedicated): Don't encourage the use of
16 display-buffer-alist from Elisp code.
17
182011-06-15 Dan Nicolaescu <dann@ics.uci.edu>
19
20 * progmodes/python.el (python-mode): Derive from prog-mode.
21 * progmodes/ps-mode.el (ps-mode):
22 * progmodes/mixal-mode.el (mixal-mode):
23 * progmodes/cfengine.el (cfengine-mode):
24 * progmodes/ld-script.el (ld-script-mode): Likewise.
25
262011-06-15 Martin Rudalics <rudalics@gmx.at>
27
28 * window.el (display-buffer-alist): Trim default value to avoid
29 popping up a new frame (Bug#8857) or reusing an arbitrary window
30 on another frame.
31 (display-buffer): Do not fall back on popping up a new frame in
32 batch mode (Bug#8857).
33
12011-06-14 Chong Yidong <cyd@stupidchicken.com> 342011-06-14 Chong Yidong <cyd@stupidchicken.com>
2 35
3 * cus-theme.el (describe-theme-1): Use custom-theme-p. 36 * cus-theme.el (describe-theme-1): Use custom-theme-p.
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index a475bbd5932..22ece17cb28 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -198,7 +198,7 @@ Intended as the value of `indent-line-function'."
198 t)) 198 t))
199 199
200;;;###autoload 200;;;###autoload
201(define-derived-mode cfengine-mode fundamental-mode "Cfengine" 201(define-derived-mode cfengine-mode prog-mode "Cfengine"
202 "Major mode for editing cfengine input. 202 "Major mode for editing cfengine input.
203There are no special keybindings by default. 203There are no special keybindings by default.
204 204
diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el
index 8bdac61d4ab..c682bfa0280 100644
--- a/lisp/progmodes/ld-script.el
+++ b/lisp/progmodes/ld-script.el
@@ -168,7 +168,7 @@
168 "Default font-lock-keywords for `ld-script-mode'.") 168 "Default font-lock-keywords for `ld-script-mode'.")
169 169
170;;;###autoload 170;;;###autoload
171(define-derived-mode ld-script-mode nil "LD-Script" 171(define-derived-mode ld-script-mode prog-mode "LD-Script"
172 "A major mode to edit GNU ld script files" 172 "A major mode to edit GNU ld script files"
173 (set (make-local-variable 'comment-start) "/* ") 173 (set (make-local-variable 'comment-start) "/* ")
174 (set (make-local-variable 'comment-end) " */") 174 (set (make-local-variable 'comment-end) " */")
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index 0d8cdd9f9b1..103c7be7d3c 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -1103,7 +1103,7 @@ Assumes that file has been compiled with debugging support."
1103 (error "mixvm.el needs to be loaded to run `mixvm'"))) 1103 (error "mixvm.el needs to be loaded to run `mixvm'")))
1104 1104
1105;;;###autoload 1105;;;###autoload
1106(define-derived-mode mixal-mode fundamental-mode "mixal" 1106(define-derived-mode mixal-mode prog-mode "mixal"
1107 "Major mode for the mixal asm language." 1107 "Major mode for the mixal asm language."
1108 (set (make-local-variable 'comment-start) "*") 1108 (set (make-local-variable 'comment-start) "*")
1109 (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*") 1109 (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*")
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index cade56a194c..d60e7513651 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -485,7 +485,7 @@ If nil, use `temporary-file-directory'."
485;; PostScript mode. 485;; PostScript mode.
486 486
487;;;###autoload 487;;;###autoload
488(define-derived-mode ps-mode fundamental-mode "PostScript" 488(define-derived-mode ps-mode prog-mode "PostScript"
489 "Major mode for editing PostScript with GNU Emacs. 489 "Major mode for editing PostScript with GNU Emacs.
490 490
491Entry to this mode calls `ps-mode-hook'. 491Entry to this mode calls `ps-mode-hook'.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b99cad1d081..3d243f14f07 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2420,7 +2420,7 @@ without confirmation."
2420(defvar python-mode-running) ;Dynamically scoped var. 2420(defvar python-mode-running) ;Dynamically scoped var.
2421 2421
2422;;;###autoload 2422;;;###autoload
2423(define-derived-mode python-mode fundamental-mode "Python" 2423(define-derived-mode python-mode prog-mode "Python"
2424 "Major mode for editing Python files. 2424 "Major mode for editing Python files.
2425Turns on Font Lock mode unconditionally since it is currently required 2425Turns on Font Lock mode unconditionally since it is currently required
2426for correct parsing of the source. 2426for correct parsing of the source.
diff --git a/lisp/subr.el b/lisp/subr.el
index d0ef38c1140..b328b7e17b7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1805,7 +1805,7 @@ Signal an error if the program returns with a non-zero exit status."
1805 (forward-line 1)) 1805 (forward-line 1))
1806 (nreverse lines))))) 1806 (nreverse lines)))))
1807 1807
1808(defun process-alive-p (process) 1808(defun process-live-p (process)
1809 "Returns non-nil if PROCESS is alive. 1809 "Returns non-nil if PROCESS is alive.
1810A process is considered alive if its status is `run', `open', 1810A process is considered alive if its status is `run', `open',
1811`listen', `connect' or `stop'." 1811`listen', `connect' or `stop'."
diff --git a/lisp/window.el b/lisp/window.el
index cad4e15507d..5493893d4c1 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3505,9 +3505,7 @@ buffer display specifiers.")
3505 reuse-window (reuse-window nil same visible) 3505 reuse-window (reuse-window nil same visible)
3506 pop-up-window 3506 pop-up-window
3507 (pop-up-window (largest . nil) (lru . nil)) 3507 (pop-up-window (largest . nil) (lru . nil))
3508 pop-up-frame 3508 reuse-window (reuse-window other other nil)
3509 (pop-up-frame)
3510 reuse-window (reuse-window nil other visible)
3511 (reuse-window-even-sizes . t))) 3509 (reuse-window-even-sizes . t)))
3512 "List associating buffer identifiers with display specifiers. 3510 "List associating buffer identifiers with display specifiers.
3513The car of each element of this list is built from a set of cons 3511The car of each element of this list is built from a set of cons
@@ -5303,12 +5301,12 @@ this list as arguments."
5303 ;; Try reusing a window not showing BUFFER on any visible or 5301 ;; Try reusing a window not showing BUFFER on any visible or
5304 ;; iconified frame. 5302 ;; iconified frame.
5305 (display-buffer-reuse-window buffer '(nil other 0)) 5303 (display-buffer-reuse-window buffer '(nil other 0))
5306 ;; Try making a new frame. 5304 ;; Try making a new frame (but not in batch mode).
5307 (display-buffer-pop-up-frame buffer) 5305 (and (not noninteractive) (display-buffer-pop-up-frame buffer))
5308 ;; Try using weakly dedicated windows. 5306 ;; Try using a weakly dedicated window.
5309 (display-buffer-reuse-window 5307 (display-buffer-reuse-window
5310 buffer '(nil nil t) '((reuse-window-dedicated . weak))) 5308 buffer '(nil nil t) '((reuse-window-dedicated . weak)))
5311 ;; Try using strongly dedicated windows. 5309 ;; Try using a strongly dedicated window.
5312 (display-buffer-reuse-window 5310 (display-buffer-reuse-window
5313 buffer '(nil nil t) '((reuse-window-dedicated . t))))))) 5311 buffer '(nil nil t) '((reuse-window-dedicated . t)))))))
5314 5312
@@ -5583,7 +5581,7 @@ See also `same-window-regexps'."
5583 :group 'windows) 5581 :group 'windows)
5584(make-obsolete-variable 5582(make-obsolete-variable
5585 'same-window-buffer-names 5583 'same-window-buffer-names
5586 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5584 "use 2nd arg of `display-buffer' instead." "24.1")
5587 5585
5588(defcustom same-window-regexps nil 5586(defcustom same-window-regexps nil
5589 "List of regexps saying which buffers should appear in the \"same\" window. 5587 "List of regexps saying which buffers should appear in the \"same\" window.
@@ -5601,7 +5599,7 @@ See also `same-window-buffer-names'."
5601 :group 'windows) 5599 :group 'windows)
5602(make-obsolete-variable 5600(make-obsolete-variable
5603 'same-window-regexps 5601 'same-window-regexps
5604 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5602 "use 2nd arg of `display-buffer' instead." "24.1")
5605 5603
5606(defun same-window-p (buffer-name) 5604(defun same-window-p (buffer-name)
5607 "Return non-nil if a buffer named BUFFER-NAME would be shown in the \"same\" window. 5605 "Return non-nil if a buffer named BUFFER-NAME would be shown in the \"same\" window.
@@ -5647,7 +5645,7 @@ These supersede the values given in `default-frame-alist'."
5647 :group 'frames) 5645 :group 'frames)
5648(make-obsolete-variable 5646(make-obsolete-variable
5649 'special-display-frame-alist 5647 'special-display-frame-alist
5650 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5648 "use 2nd arg of `display-buffer' instead." "24.1")
5651 5649
5652(defun special-display-popup-frame (buffer &optional args) 5650(defun special-display-popup-frame (buffer &optional args)
5653 "Display BUFFER in a special frame and return the window chosen. 5651 "Display BUFFER in a special frame and return the window chosen.
@@ -5695,7 +5693,7 @@ and (cdr ARGS) as second."
5695 (frame-selected-window frame)))))) 5693 (frame-selected-window frame))))))
5696(make-obsolete 5694(make-obsolete
5697 'special-display-popup-frame 5695 'special-display-popup-frame
5698 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5696 "use 2nd arg of `display-buffer' instead." "24.1")
5699 5697
5700(defcustom special-display-function 'special-display-popup-frame 5698(defcustom special-display-function 'special-display-popup-frame
5701 "Function to call for displaying special buffers. 5699 "Function to call for displaying special buffers.
@@ -5714,7 +5712,7 @@ A buffer is special when its name is either listed in
5714 :group 'frames) 5712 :group 'frames)
5715(make-obsolete-variable 5713(make-obsolete-variable
5716 'special-display-function 5714 'special-display-function
5717 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5715 "use 2nd arg of `display-buffer' instead." "24.1")
5718 5716
5719(defcustom special-display-buffer-names nil 5717(defcustom special-display-buffer-names nil
5720 "List of names of buffers that should be displayed specially. 5718 "List of names of buffers that should be displayed specially.
@@ -5781,7 +5779,7 @@ See also `special-display-regexps'."
5781 :group 'frames) 5779 :group 'frames)
5782(make-obsolete-variable 5780(make-obsolete-variable
5783 'special-display-buffer-names 5781 'special-display-buffer-names
5784 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5782 "use 2nd arg of `display-buffer' instead." "24.1")
5785 5783
5786;;;###autoload 5784;;;###autoload
5787(put 'special-display-buffer-names 'risky-local-variable t) 5785(put 'special-display-buffer-names 'risky-local-variable t)
@@ -5852,7 +5850,7 @@ See also `special-display-buffer-names'."
5852 :group 'frames) 5850 :group 'frames)
5853(make-obsolete-variable 5851(make-obsolete-variable
5854 'special-display-regexps 5852 'special-display-regexps
5855 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5853 "use 2nd arg of `display-buffer' instead." "24.1")
5856 5854
5857(defun special-display-p (buffer-name) 5855(defun special-display-p (buffer-name)
5858 "Return non-nil if a buffer named BUFFER-NAME gets a special frame. 5856 "Return non-nil if a buffer named BUFFER-NAME gets a special frame.
@@ -5904,7 +5902,7 @@ affected by this variable."
5904 :group 'frames) 5902 :group 'frames)
5905(make-obsolete-variable 5903(make-obsolete-variable
5906 'pop-up-frame-alist 5904 'pop-up-frame-alist
5907 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5905 "use 2nd arg of `display-buffer' instead." "24.1")
5908 5906
5909(defcustom pop-up-frame-function 5907(defcustom pop-up-frame-function
5910 (lambda () (make-frame pop-up-frame-alist)) 5908 (lambda () (make-frame pop-up-frame-alist))
@@ -5916,7 +5914,7 @@ frame. The default value calls `make-frame' with the argument
5916 :group 'frames) 5914 :group 'frames)
5917(make-obsolete-variable 5915(make-obsolete-variable
5918 'pop-up-frame-function 5916 'pop-up-frame-function
5919 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5917 "use 2nd arg of `display-buffer' instead." "24.1")
5920 5918
5921(defcustom pop-up-frames 'unset ; nil 5919(defcustom pop-up-frames 'unset ; nil
5922 "Whether `display-buffer' should make a separate frame. 5920 "Whether `display-buffer' should make a separate frame.
@@ -5936,7 +5934,7 @@ Any other non-nil value means always make a separate frame."
5936 :group 'frames) 5934 :group 'frames)
5937(make-obsolete-variable 5935(make-obsolete-variable
5938 'pop-up-frames 5936 'pop-up-frames
5939 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5937 "use 2nd arg of `display-buffer' instead." "24.1")
5940 5938
5941(defcustom display-buffer-reuse-frames 'unset ; nil 5939(defcustom display-buffer-reuse-frames 'unset ; nil
5942 "Set and non-nil means `display-buffer' should reuse frames. 5940 "Set and non-nil means `display-buffer' should reuse frames.
@@ -5948,7 +5946,7 @@ that frame."
5948 :group 'frames) 5946 :group 'frames)
5949(make-obsolete-variable 5947(make-obsolete-variable
5950 'display-buffer-reuse-frames 5948 'display-buffer-reuse-frames
5951 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5949 "use 2nd arg of `display-buffer' instead." "24.1")
5952 5950
5953(defcustom pop-up-windows 'unset ; t 5951(defcustom pop-up-windows 'unset ; t
5954 "Set and non-nil means `display-buffer' should make a new window." 5952 "Set and non-nil means `display-buffer' should make a new window."
@@ -5957,7 +5955,7 @@ that frame."
5957 :group 'windows) 5955 :group 'windows)
5958(make-obsolete-variable 5956(make-obsolete-variable
5959 'pop-up-windows 5957 'pop-up-windows
5960 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5958 "use 2nd arg of `display-buffer' instead." "24.1")
5961 5959
5962(defcustom split-window-preferred-function 'split-window-sensibly 5960(defcustom split-window-preferred-function 'split-window-sensibly
5963 "Function called by `display-buffer' to split a window. 5961 "Function called by `display-buffer' to split a window.
@@ -5986,7 +5984,7 @@ not want to split the selected window."
5986 :group 'windows) 5984 :group 'windows)
5987(make-obsolete-variable 5985(make-obsolete-variable
5988 'split-window-preferred-function 5986 'split-window-preferred-function
5989 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 5987 "use 2nd arg of `display-buffer' instead." "24.1")
5990 5988
5991(defcustom split-height-threshold 80 5989(defcustom split-height-threshold 80
5992 "Minimum height for splitting a window to display a buffer. 5990 "Minimum height for splitting a window to display a buffer.
@@ -6000,7 +5998,7 @@ split it vertically disregarding the value of this variable."
6000 :group 'windows) 5998 :group 'windows)
6001(make-obsolete-variable 5999(make-obsolete-variable
6002 'split-height-threshold 6000 'split-height-threshold
6003 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 6001 "use 2nd arg of `display-buffer' instead." "24.1")
6004 6002
6005(defcustom split-width-threshold 160 6003(defcustom split-width-threshold 160
6006 "Minimum width for splitting a window to display a buffer. 6004 "Minimum width for splitting a window to display a buffer.
@@ -6012,7 +6010,7 @@ is nil, `display-buffer' cannot split windows horizontally."
6012 :group 'windows) 6010 :group 'windows)
6013(make-obsolete-variable 6011(make-obsolete-variable
6014 'split-width-threshold 6012 'split-width-threshold
6015 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 6013 "use 2nd arg of `display-buffer' instead." "24.1")
6016 6014
6017(defcustom even-window-heights t 6015(defcustom even-window-heights t
6018 "If non-nil `display-buffer' will try to even window heights. 6016 "If non-nil `display-buffer' will try to even window heights.
@@ -6024,7 +6022,7 @@ window that appears above or below the selected window."
6024 :group 'windows) 6022 :group 'windows)
6025(make-obsolete-variable 6023(make-obsolete-variable
6026 'even-window-heights 6024 'even-window-heights
6027 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 6025 "use 2nd arg of `display-buffer' instead." "24.1")
6028 6026
6029(defvar display-buffer-mark-dedicated 'unset ; nil 6027(defvar display-buffer-mark-dedicated 'unset ; nil
6030 "Set and non-nil means `display-buffer' marks the windows it creates as dedicated. 6028 "Set and non-nil means `display-buffer' marks the windows it creates as dedicated.
@@ -6032,7 +6030,7 @@ The actual non-nil value of this variable will be copied to the
6032`window-dedicated-p' flag.") 6030`window-dedicated-p' flag.")
6033(make-obsolete-variable 6031(make-obsolete-variable
6034 'display-buffer-mark-dedicated 6032 'display-buffer-mark-dedicated
6035 "use `display-buffer-alist' or 2nd arg of `display-buffer' instead." "24.1") 6033 "use 2nd arg of `display-buffer' instead." "24.1")
6036 6034
6037(defun window-splittable-p (window &optional horizontal) 6035(defun window-splittable-p (window &optional horizontal)
6038 "Return non-nil if `split-window-sensibly' may split WINDOW. 6036 "Return non-nil if `split-window-sensibly' may split WINDOW.
diff --git a/src/ChangeLog b/src/ChangeLog
index e477162b32b..87f64244c48 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,12 +1,12 @@
12011-06-15 Paul Eggert <eggert@cs.ucla.edu> 12011-06-15 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Integer overflow and signedness fixes.
4
3 * fileio.c: Don't assume EMACS_INT fits in off_t. 5 * fileio.c: Don't assume EMACS_INT fits in off_t.
4 (emacs_lseek): New static function. 6 (emacs_lseek): New static function.
5 (Finsert_file_contents, Fwrite_region): Use it. 7 (Finsert_file_contents, Fwrite_region): Use it.
6 Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate. 8 Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
7 9
82011-06-14 Paul Eggert <eggert@cs.ucla.edu>
9
10 * fns.c (Fload_average): Don't assume 100 * load average fits in int. 10 * fns.c (Fload_average): Don't assume 100 * load average fits in int.
11 11
12 * fns.c: Don't overflow int when computing a list length. 12 * fns.c: Don't overflow int when computing a list length.
@@ -66,8 +66,6 @@
66 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls. 66 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
67 * mem-limits.h (SIZE): Remove; no longer used. 67 * mem-limits.h (SIZE): Remove; no longer used.
68 68
692011-06-13 Paul Eggert <eggert@cs.ucla.edu>
70
71 * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works. 69 * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
72 70
73 Remove unnecessary casts. 71 Remove unnecessary casts.
@@ -247,6 +245,30 @@
247 245
248 * alloc.c (Fmake_string): Check for out-of-range init. 246 * alloc.c (Fmake_string): Check for out-of-range init.
249 247
2482011-06-14 Jan Djärv <jan.h.d@swipnet.se>
249
250 * xfns.c (x_set_scroll_bar_default_width): Remove argument to
251 xg_get_default_scrollbar_width.
252
253 * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
254 (int_gtk_range_get_value): Move to the scroll bar part of the file.
255 (style_changed_cb): Call update_theme_scrollbar_width and call
256 x_set_scroll_bar_default_width and xg_frame_set_char_size for
257 all frames (Bug#8505).
258 (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
259 Call gtk_window_set_resizable if HAVE_GTK3.
260 (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
261 and height if HAVE_GTK3 (Bug#8505).
262 (scroll_bar_width_for_theme): New variable.
263 (update_theme_scrollbar_width): New function.
264 (xg_get_default_scrollbar_width): Move code to
265 update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
266 (xg_initialize): Call update_theme_scrollbar_width.
267
268 * gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
269
270 * emacsgtkfixed.c, emacsgtkfixed.h: New files.
271
2502011-06-12 Martin Rudalics <rudalics@gmx.at> 2722011-06-12 Martin Rudalics <rudalics@gmx.at>
251 273
252 * frame.c (make_frame): Call other_buffer_safely instead of 274 * frame.c (make_frame): Call other_buffer_safely instead of
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
new file mode 100644
index 00000000000..fe3514bce93
--- /dev/null
+++ b/src/emacsgtkfixed.c
@@ -0,0 +1,123 @@
1/* A Gtk Widget that inherits GtkFixed, but can be shrinked.
2
3Copyright (C) 2011 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "emacsgtkfixed.h"
21
22
23struct _EmacsFixedPrivate
24{
25 int minwidth, minheight;
26};
27
28
29static void emacs_fixed_get_preferred_width (GtkWidget *widget,
30 gint *minimum,
31 gint *natural);
32static void emacs_fixed_get_preferred_height (GtkWidget *widget,
33 gint *minimum,
34 gint *natural);
35G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
36
37static void
38emacs_fixed_class_init (EmacsFixedClass *klass)
39{
40 GtkWidgetClass *widget_class;
41 GtkFixedClass *fixed_class;
42
43 widget_class = (GtkWidgetClass*) klass;
44 fixed_class = (GtkFixedClass*) klass;
45
46 widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
47 widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
48 g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
49}
50
51static GType
52emacs_fixed_child_type (GtkFixed *container)
53{
54 return GTK_TYPE_WIDGET;
55}
56
57static void
58emacs_fixed_init (EmacsFixed *fixed)
59{
60 fixed->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixed, EMACS_TYPE_FIXED,
61 EmacsFixedPrivate);
62 fixed->priv->minwidth = fixed->priv->minheight = 0;
63}
64
65/**
66 * emacs_fixed_new:
67 *
68 * Creates a new #EmacsFixed.
69 *
70 * Returns: a new #EmacsFixed.
71 */
72GtkWidget*
73emacs_fixed_new (void)
74{
75 return g_object_new (EMACS_TYPE_FIXED, NULL);
76}
77
78static GtkWidgetClass *
79get_parent_class (EmacsFixed *fixed)
80{
81 EmacsFixedClass *klass = EMACS_FIXED_GET_CLASS (fixed);
82 GtkFixedClass *parent_class = g_type_class_peek_parent (klass);
83 return (GtkWidgetClass*) parent_class;
84}
85
86static void
87emacs_fixed_get_preferred_width (GtkWidget *widget,
88 gint *minimum,
89 gint *natural)
90{
91 EmacsFixed *fixed = EMACS_FIXED (widget);
92 EmacsFixedPrivate *priv = fixed->priv;
93 GtkWidgetClass *widget_class = get_parent_class (fixed);
94 widget_class->get_preferred_width (widget, minimum, natural);
95 if (minimum) *minimum = priv->minwidth;
96}
97
98static void
99emacs_fixed_get_preferred_height (GtkWidget *widget,
100 gint *minimum,
101 gint *natural)
102{
103 EmacsFixed *fixed = EMACS_FIXED (widget);
104 EmacsFixedPrivate *priv = fixed->priv;
105 GtkWidgetClass *widget_class = get_parent_class (fixed);
106 widget_class->get_preferred_height (widget, minimum, natural);
107 if (minimum) *minimum = priv->minheight;
108}
109
110void
111emacs_fixed_set_min_size (EmacsFixed *widget, int width, int height)
112{
113 EmacsFixedPrivate *priv = widget->priv;
114 GtkWidgetClass *widget_class = get_parent_class (widget);
115 int mw, nw, mh, nh;
116
117 widget_class->get_preferred_height (GTK_WIDGET (widget), &mh, &nh);
118 widget_class->get_preferred_width (GTK_WIDGET (widget), &mw, &nw);
119
120 /* Gtk complains if min size is less than natural size. */
121 if (width <= nw) priv->minwidth = width;
122 if (height <= nh) priv->minheight = height;
123}
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
new file mode 100644
index 00000000000..405374373ec
--- /dev/null
+++ b/src/emacsgtkfixed.h
@@ -0,0 +1,58 @@
1/* A Gtk Widget that inherits GtkFixed, but can be shrinked.
2
3Copyright (C) 2011 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef EMACSGTKFIXED_H
21#define EMACSGTKFIXED_H
22
23#include <gtk/gtk.h>
24
25G_BEGIN_DECLS
26
27#define EMACS_TYPE_FIXED (emacs_fixed_get_type ())
28#define EMACS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMACS_TYPE_FIXED, EmacsFixed))
29#define EMACS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMACS_TYPE_FIXED, EmacsFixedClass))
30#define EMACS_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMACS_TYPE_FIXED))
31#define EMACS_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMACS_TYPE_FIXED))
32#define EMACS_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMACS_TYPE_FIXED, EmacsFixedClass))
33
34typedef struct _EmacsFixed EmacsFixed;
35typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
36typedef struct _EmacsFixedClass EmacsFixedClass;
37
38struct _EmacsFixed
39{
40 GtkFixed container;
41
42 /*< private >*/
43 EmacsFixedPrivate *priv;
44};
45
46
47struct _EmacsFixedClass
48{
49 GtkFixedClass parent_class;
50};
51
52extern GtkWidget *emacs_fixed_new (void);
53extern void emacs_fixed_set_min_size (EmacsFixed *widget, int width, int height);
54extern GType emacs_fixed_get_type (void);
55
56G_END_DECLS
57
58#endif /* EMACSGTKFIXED_H */
diff --git a/src/gtkutil.c b/src/gtkutil.c
index dedb39a7a40..45f112ae9e5 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -42,6 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42 42
43#ifdef HAVE_GTK3 43#ifdef HAVE_GTK3
44#include <gtk/gtkx.h> 44#include <gtk/gtkx.h>
45#include "emacsgtkfixed.h"
45#endif 46#endif
46 47
47#define FRAME_TOTAL_PIXEL_HEIGHT(f) \ 48#define FRAME_TOTAL_PIXEL_HEIGHT(f) \
@@ -88,12 +89,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
88 89
89#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) 90#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
90 91
91/* Get the current value of the range, truncated to an integer. */ 92static void update_theme_scrollbar_width (void);
92static int
93int_gtk_range_get_value (GtkRange *range)
94{
95 return gtk_range_get_value (range);
96}
97 93
98 94
99/*********************************************************************** 95/***********************************************************************
@@ -1015,6 +1011,7 @@ style_changed_cb (GObject *go,
1015 struct input_event event; 1011 struct input_event event;
1016 GdkDisplay *gdpy = (GdkDisplay *) user_data; 1012 GdkDisplay *gdpy = (GdkDisplay *) user_data;
1017 const char *display_name = gdk_display_get_name (gdpy); 1013 const char *display_name = gdk_display_get_name (gdpy);
1014 Display *dpy = GDK_DISPLAY_XDISPLAY (gdpy);
1018 1015
1019 EVENT_INIT (event); 1016 EVENT_INIT (event);
1020 event.kind = CONFIG_CHANGED_EVENT; 1017 event.kind = CONFIG_CHANGED_EVENT;
@@ -1022,6 +1019,24 @@ style_changed_cb (GObject *go,
1022 /* Theme doesn't change often, so intern is called seldom. */ 1019 /* Theme doesn't change often, so intern is called seldom. */
1023 event.arg = intern ("theme-name"); 1020 event.arg = intern ("theme-name");
1024 kbd_buffer_store_event (&event); 1021 kbd_buffer_store_event (&event);
1022
1023 update_theme_scrollbar_width ();
1024
1025 /* If scroll bar width changed, we need set the new size on all frames
1026 on this display. */
1027 if (dpy)
1028 {
1029 Lisp_Object rest, frame;
1030 FOR_EACH_FRAME (rest, frame)
1031 {
1032 FRAME_PTR f = XFRAME (frame);
1033 if (FRAME_X_DISPLAY (f) == dpy)
1034 {
1035 x_set_scroll_bar_default_width (f);
1036 xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f));
1037 }
1038 }
1039 }
1025} 1040}
1026 1041
1027/* Called when a delete-event occurs on WIDGET. */ 1042/* Called when a delete-event occurs on WIDGET. */
@@ -1069,7 +1084,12 @@ xg_create_frame_widgets (FRAME_PTR f)
1069 1084
1070 wvbox = gtk_vbox_new (FALSE, 0); 1085 wvbox = gtk_vbox_new (FALSE, 0);
1071 whbox = gtk_hbox_new (FALSE, 0); 1086 whbox = gtk_hbox_new (FALSE, 0);
1072 wfixed = gtk_fixed_new (); /* Must have this to place scroll bars */ 1087
1088#ifdef HAVE_GTK3
1089 wfixed = emacs_fixed_new ();
1090#else
1091 wfixed = gtk_fixed_new ();
1092#endif
1073 1093
1074 if (! wtop || ! wvbox || ! whbox || ! wfixed) 1094 if (! wtop || ! wvbox || ! whbox || ! wfixed)
1075 { 1095 {
@@ -1162,6 +1182,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1162 gtk_widget_modify_style (wfixed, style); 1182 gtk_widget_modify_style (wfixed, style);
1163#else 1183#else
1164 gtk_widget_set_can_focus (wfixed, TRUE); 1184 gtk_widget_set_can_focus (wfixed, TRUE);
1185 gtk_window_set_resizable (GTK_WINDOW (wtop), TRUE);
1165#endif 1186#endif
1166 1187
1167#ifdef USE_GTK_TOOLTIP 1188#ifdef USE_GTK_TOOLTIP
@@ -1265,6 +1286,18 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
1265 size_hints.min_width = base_width + min_cols * size_hints.width_inc; 1286 size_hints.min_width = base_width + min_cols * size_hints.width_inc;
1266 size_hints.min_height = base_height + min_rows * size_hints.height_inc; 1287 size_hints.min_height = base_height + min_rows * size_hints.height_inc;
1267 1288
1289#ifdef HAVE_GTK3
1290 /* Gtk3 ignores min width/height and overwrites them with its own idea
1291 of min width/height. Put out min values to the widget so Gtk
1292 gets the same value we want it to be. Without this, a user can't
1293 shrink an Emacs frame.
1294 */
1295 if (FRAME_GTK_WIDGET (f))
1296 emacs_fixed_set_min_size (EMACS_FIXED (FRAME_GTK_WIDGET (f)),
1297 size_hints.min_width,
1298 size_hints.min_height);
1299#endif
1300
1268 /* These currently have a one to one mapping with the X values, but I 1301 /* These currently have a one to one mapping with the X values, but I
1269 don't think we should rely on that. */ 1302 don't think we should rely on that. */
1270 hint_flags |= GDK_HINT_WIN_GRAVITY; 1303 hint_flags |= GDK_HINT_WIN_GRAVITY;
@@ -3250,6 +3283,10 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3250 3283
3251int xg_ignore_gtk_scrollbar; 3284int xg_ignore_gtk_scrollbar;
3252 3285
3286/* The width of the scroll bar for the current theme. */
3287
3288static int scroll_bar_width_for_theme;
3289
3253/* Xlib's `Window' fits in 32 bits. But we want to store pointers, and they 3290/* Xlib's `Window' fits in 32 bits. But we want to store pointers, and they
3254 may be larger than 32 bits. Keep a mapping from integer index to widget 3291 may be larger than 32 bits. Keep a mapping from integer index to widget
3255 pointers to get around the 32 bit limitation. */ 3292 pointers to get around the 32 bit limitation. */
@@ -3326,8 +3363,8 @@ xg_get_widget_from_map (int idx)
3326 return 0; 3363 return 0;
3327} 3364}
3328 3365
3329int 3366static void
3330xg_get_default_scrollbar_width (FRAME_PTR f) 3367update_theme_scrollbar_width (void)
3331{ 3368{
3332#ifdef HAVE_GTK3 3369#ifdef HAVE_GTK3
3333 GtkAdjustment *vadj; 3370 GtkAdjustment *vadj;
@@ -3336,13 +3373,22 @@ xg_get_default_scrollbar_width (FRAME_PTR f)
3336#endif 3373#endif
3337 GtkWidget *wscroll; 3374 GtkWidget *wscroll;
3338 int w = 0, b = 0; 3375 int w = 0, b = 0;
3376
3339 vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1); 3377 vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1);
3340 wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); 3378 wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
3379 g_object_ref_sink (G_OBJECT (wscroll));
3341 gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL); 3380 gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL);
3342 gtk_widget_destroy (wscroll); 3381 gtk_widget_destroy (wscroll);
3382 g_object_unref (G_OBJECT (wscroll));
3343 w += 2*b; 3383 w += 2*b;
3344 if (w < 16) w = 16; 3384 if (w < 16) w = 16;
3345 return w; 3385 scroll_bar_width_for_theme = w;
3386}
3387
3388int
3389xg_get_default_scrollbar_width (void)
3390{
3391 return scroll_bar_width_for_theme;
3346} 3392}
3347 3393
3348/* Return the scrollbar id for X Window WID on display DPY. 3394/* Return the scrollbar id for X Window WID on display DPY.
@@ -3528,6 +3574,15 @@ xg_update_scrollbar_pos (FRAME_PTR f,
3528 } 3574 }
3529} 3575}
3530 3576
3577/* Get the current value of the range, truncated to an integer. */
3578
3579static int
3580int_gtk_range_get_value (GtkRange *range)
3581{
3582 return gtk_range_get_value (range);
3583}
3584
3585
3531/* Set the thumb size and position of scroll bar BAR. We are currently 3586/* Set the thumb size and position of scroll bar BAR. We are currently
3532 displaying PORTION out of a whole WHOLE, and our position POSITION. */ 3587 displaying PORTION out of a whole WHOLE, and our position POSITION. */
3533 3588
@@ -4680,6 +4735,7 @@ xg_initialize (void)
4680 (GTK_TYPE_MENU_SHELL)); 4735 (GTK_TYPE_MENU_SHELL));
4681 gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK, 4736 gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK,
4682 "cancel", 0); 4737 "cancel", 0);
4738 update_theme_scrollbar_width ();
4683} 4739}
4684 4740
4685#endif /* USE_GTK */ 4741#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index cf58d03b0ce..769e56da917 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -135,7 +135,7 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
135 int position, 135 int position,
136 int whole); 136 int whole);
137extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); 137extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
138extern int xg_get_default_scrollbar_width (FRAME_PTR f); 138extern int xg_get_default_scrollbar_width (void);
139 139
140extern void update_frame_tool_bar (FRAME_PTR f); 140extern void update_frame_tool_bar (FRAME_PTR f);
141extern void free_frame_tool_bar (FRAME_PTR f); 141extern void free_frame_tool_bar (FRAME_PTR f);
diff --git a/src/xfns.c b/src/xfns.c
index f847e41855e..abc273c2bdf 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1700,7 +1700,7 @@ x_set_scroll_bar_default_width (struct frame *f)
1700 int wid = FRAME_COLUMN_WIDTH (f); 1700 int wid = FRAME_COLUMN_WIDTH (f);
1701#ifdef USE_TOOLKIT_SCROLL_BARS 1701#ifdef USE_TOOLKIT_SCROLL_BARS
1702#ifdef USE_GTK 1702#ifdef USE_GTK
1703 int minw = xg_get_default_scrollbar_width (f); 1703 int minw = xg_get_default_scrollbar_width ();
1704#else 1704#else
1705 int minw = 16; 1705 int minw = 16;
1706#endif 1706#endif