Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
ff672d2c
Commit
ff672d2c
authored
Jun 15, 2011
by
Paul Eggert
Browse files
Options
Browse Files
Download
Plain Diff
Merge from trunk.
parents
e69dafad
b96e6cde
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
352 additions
and
77 deletions
+352
-77
ChangeLog
ChangeLog
+4
-0
admin/CPP-DEFINES
admin/CPP-DEFINES
+0
-26
autogen/configure
autogen/configure
+3
-2
configure.in
configure.in
+3
-2
doc/lispref/ChangeLog
doc/lispref/ChangeLog
+5
-0
doc/lispref/processes.texi
doc/lispref/processes.texi
+1
-1
lisp/ChangeLog
lisp/ChangeLog
+33
-0
lisp/progmodes/cfengine.el
lisp/progmodes/cfengine.el
+1
-1
lisp/progmodes/ld-script.el
lisp/progmodes/ld-script.el
+1
-1
lisp/progmodes/mixal-mode.el
lisp/progmodes/mixal-mode.el
+1
-1
lisp/progmodes/ps-mode.el
lisp/progmodes/ps-mode.el
+1
-1
lisp/progmodes/python.el
lisp/progmodes/python.el
+1
-1
lisp/subr.el
lisp/subr.el
+1
-1
lisp/window.el
lisp/window.el
+22
-24
src/ChangeLog
src/ChangeLog
+26
-4
src/emacsgtkfixed.c
src/emacsgtkfixed.c
+123
-0
src/emacsgtkfixed.h
src/emacsgtkfixed.h
+58
-0
src/gtkutil.c
src/gtkutil.c
+66
-10
src/gtkutil.h
src/gtkutil.h
+1
-1
src/xfns.c
src/xfns.c
+1
-1
No files found.
ChangeLog
View file @
ff672d2c
2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
* configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3.
2011-06-08 Paul Eggert <eggert@cs.ucla.edu>
* lib/gnulib.mk, m4/gnulib-common.m4: Merge from gnulib.
...
...
admin/CPP-DEFINES
View file @
ff672d2c
...
...
@@ -53,8 +53,6 @@ CLASH_DETECTION
COFF
FIRST_PTY_LETTER
HAVE_PTYS
HAVE_TERMIO
HAVE_TERMIOS
INTERRUPT_INPUT
NARROWPROTO
SEPCHAR
...
...
@@ -175,7 +173,6 @@ HAVE_SYS_SYSTEMINFO_H
HAVE_SYS_TIMEB_H
HAVE_SYS_TIME_H
HAVE_TCATTR
HAVE_TERMIOS_H
HAVE_TIMEVAL
HAVE_TM_ZONE
HAVE_TZSET
...
...
@@ -258,14 +255,9 @@ USG5_4
USG_SUBTTY_WORKS
VALBITS
WRETCODE
XINT
XOS_NEEDS_TIME_H
XPNTR
XSET
XUINT
_AIX
_ARCH_PPC64
_CALLBACK_
_FILE_OFFSET_BITS
_LP64
_MALLOC_INTERNAL
...
...
@@ -273,21 +265,6 @@ _NAIVE_DOS_REGS
_VARARGS_
_WINSOCKAPI_
_WINSOCK_H
__ELF__
__FreeBSD__
__GNUC__
__GNU_LIBRARY__
__GNUC_MINOR__
__NetBSD__
__OpenBSD__
__STDC__
__arch64__
__cplusplus
__hpux
__ia64__
__linux__
__mc68000__
__mips__
_longjmp
_setjmp
_start
...
...
@@ -323,9 +300,7 @@ getenv
getpid
getuid
gmtime
i386
index
init_process
isatty
kill
link
...
...
@@ -333,7 +308,6 @@ linux
localtime
logb
lseek
m68k
malloc
mkdir
mktemp
...
...
autogen/configure
View file @
ff672d2c
...
...
@@ -10483,6 +10483,7 @@ fi
HAVE_GTK=no
GTK_OBJ=
if test "${with_gtk3}" = "yes"; then
GLIB_REQUIRED=2.28
GTK_REQUIRED=3.0
...
...
@@ -10588,6 +10589,7 @@ $as_echo "no" >&6; }
$as_echo "#define HAVE_GTK3 1" >>confdefs.h
GTK_OBJ=emacsgtkfixed.o
fi
if test "$pkg_check_gtk" != "yes"; then
...
...
@@ -10697,7 +10699,6 @@ $as_echo "no" >&6; }
fi
fi
GTK_OBJ=
if test x"$pkg_check_gtk" = xyes; then
...
...
@@ -10726,7 +10727,7 @@ done
$as_echo "#define USE_GTK 1" >>confdefs.h
GTK_OBJ=gtkutil.o
GTK_OBJ=
"
gtkutil.o
$GTK_OBJ"
USE_X_TOOLKIT=none
if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
:
...
...
configure.in
View file @
ff672d2c
...
...
@@ -1819,6 +1819,7 @@ fi
HAVE_GTK=no
GTK_OBJ=
if test "${with_gtk3}" = "yes"; then
GLIB_REQUIRED=2.28
GTK_REQUIRED=3.0
...
...
@@ -1830,6 +1831,7 @@ if test "${with_gtk3}" = "yes"; then
AC_MSG_ERROR($GTK_PKG_ERRORS)
fi
AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
GTK_OBJ=emacsgtkfixed.o
fi
if test "$pkg_check_gtk" != "yes"; then
...
...
@@ -1847,7 +1849,6 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
fi
fi
GTK_OBJ=
if test x"$pkg_check_gtk" = xyes; then
AC_SUBST(GTK_CFLAGS)
...
...
@@ -1865,7 +1866,7 @@ if test x"$pkg_check_gtk" = xyes; then
else
HAVE_GTK=yes
AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
GTK_OBJ=gtkutil.o
GTK_OBJ=
"
gtkutil.o
$GTK_OBJ"
USE_X_TOOLKIT=none
if $PKG_CONFIG --atleast-version=2.10 gtk+-2.0; then
:
...
...
doc/lispref/ChangeLog
View file @
ff672d2c
2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* processes.texi (Process Information): Renamed `process-alive-p'
to `process-live-p' for consistency with other `-live-p' functions.
2011-06-03 Paul Eggert <eggert@cs.ucla.edu>
Document wide integers better.
...
...
doc/lispref/processes.texi
View file @
ff672d2c
...
...
@@ -859,7 +859,7 @@ For a network connection, @code{process-status} returns one of the symbols
closed the connection, or Emacs did @code{delete-process}.
@end defun
@defun process-
a
live-p process
@defun process-live-p process
This function returns nin-@code{nil} if @var{process} is alive. A
process is considered alive if its status is @code{run}, @code{open},
@code{listen}, @code{connect} or @code{stop}.
...
...
lisp/ChangeLog
View file @
ff672d2c
2011-06-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
* subr.el (process-live-p): Renamed from `process-alive-p' for
consistency with other `-live-p' functions.
2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
* window.el (same-window-buffer-names, same-window-regexps)
(special-display-frame-alist, special-display-popup-frame)
(special-display-function, special-display-buffer-names)
(special-display-regexps, pop-up-frame-alist)
(pop-up-frame-function, pop-up-frames, display-buffer-reuse-frames)
(pop-up-windows, split-window-preferred-function)
(split-height-threshold, split-width-threshold, even-window-heights)
(display-buffer-mark-dedicated): Don't encourage the use of
display-buffer-alist from Elisp code.
2011-06-15 Dan Nicolaescu <dann@ics.uci.edu>
* progmodes/python.el (python-mode): Derive from prog-mode.
* progmodes/ps-mode.el (ps-mode):
* progmodes/mixal-mode.el (mixal-mode):
* progmodes/cfengine.el (cfengine-mode):
* progmodes/ld-script.el (ld-script-mode): Likewise.
2011-06-15 Martin Rudalics <rudalics@gmx.at>
* window.el (display-buffer-alist): Trim default value to avoid
popping up a new frame (Bug#8857) or reusing an arbitrary window
on another frame.
(display-buffer): Do not fall back on popping up a new frame in
batch mode (Bug#8857).
2011-06-14 Chong Yidong <cyd@stupidchicken.com>
* cus-theme.el (describe-theme-1): Use custom-theme-p.
...
...
lisp/progmodes/cfengine.el
View file @
ff672d2c
...
...
@@ -198,7 +198,7 @@ Intended as the value of `indent-line-function'."
t
))
;;;###autoload
(
define-derived-mode
cfengine-mode
fundamental
-mode
"Cfengine"
(
define-derived-mode
cfengine-mode
prog
-mode
"Cfengine"
"Major mode for editing cfengine input.
There are no special keybindings by default.
...
...
lisp/progmodes/ld-script.el
View file @
ff672d2c
...
...
@@ -168,7 +168,7 @@
"
Default
font-lock-keywords
for
`
ld-script-mode
'.
")
;;;###autoload
(define-derived-mode ld-script-mode
nil
"
LD-Script
"
(define-derived-mode ld-script-mode
prog-mode
"
LD-Script
"
"
A
major
mode
to
edit
GNU
ld
script
files
"
(set (make-local-variable 'comment-start) "
/*
")
(set (make-local-variable 'comment-end) "
*/
"
)
...
...
lisp/progmodes/mixal-mode.el
View file @
ff672d2c
...
...
@@ -1103,7 +1103,7 @@ Assumes that file has been compiled with debugging support."
(
error
"mixvm.el needs to be loaded to run `mixvm'"
)))
;;;###autoload
(
define-derived-mode
mixal-mode
fundamental
-mode
"mixal"
(
define-derived-mode
mixal-mode
prog
-mode
"mixal"
"Major mode for the mixal asm language."
(
set
(
make-local-variable
'comment-start
)
"*"
)
(
set
(
make-local-variable
'comment-start-skip
)
"^\\*[ \t]*"
)
...
...
lisp/progmodes/ps-mode.el
View file @
ff672d2c
...
...
@@ -485,7 +485,7 @@ If nil, use `temporary-file-directory'."
;; PostScript mode.
;;;###autoload
(
define-derived-mode
ps-mode
fundamental
-mode
"PostScript"
(
define-derived-mode
ps-mode
prog
-mode
"PostScript"
"Major mode for editing PostScript with GNU Emacs.
Entry to this mode calls `ps-mode-hook'.
...
...
lisp/progmodes/python.el
View file @
ff672d2c
...
...
@@ -2420,7 +2420,7 @@ without confirmation."
(
defvar
python-mode-running
)
;Dynamically scoped var.
;;;###autoload
(
define-derived-mode
python-mode
fundamental
-mode
"Python"
(
define-derived-mode
python-mode
prog
-mode
"Python"
"Major mode for editing Python files.
Turns on Font Lock mode unconditionally since it is currently required
for correct parsing of the source.
...
...
lisp/subr.el
View file @
ff672d2c
...
...
@@ -1805,7 +1805,7 @@ Signal an error if the program returns with a non-zero exit status."
(
forward-line
1
))
(
nreverse
lines
)))))
(
defun
process-
a
live-p
(
process
)
(
defun
process-live-p
(
process
)
"Returns non-nil if PROCESS is alive.
A process is considered alive if its status is `run', `open',
`listen', `connect' or `stop'."
...
...
lisp/window.el
View file @
ff672d2c
...
...
@@ -3505,9 +3505,7 @@ buffer display specifiers.")
reuse-window (reuse-window nil same visible)
pop-up-window
(pop-up-window (largest . nil) (lru . nil))
pop-up-frame
(pop-up-frame)
reuse-window (reuse-window nil other visible)
reuse-window (reuse-window other other nil)
(reuse-window-even-sizes . t)))
"
List
associating
buffer
identifiers
with
display
specifiers.
The
car
of
each
element
of
this
list
is
built
from
a
set
of
cons
...
...
@@ -5303,12 +5301,12 @@ this list as arguments."
;; Try reusing a window not showing BUFFER on any visible or
;; iconified frame.
(display-buffer-reuse-window buffer '(nil other 0))
;; Try making a new frame.
(display-buffer-pop-up-frame buffer)
;; Try using weakly dedicated window
s
.
;; Try making a new frame
(but not in batch mode)
.
(and (not noninteractive)
(display-buffer-pop-up-frame buffer)
)
;; Try using
a
weakly dedicated window.
(display-buffer-reuse-window
buffer '(nil nil t) '((reuse-window-dedicated . weak)))
;; Try using strongly dedicated window
s
.
;; Try using
a
strongly dedicated window.
(display-buffer-reuse-window
buffer '(nil nil t) '((reuse-window-dedicated . t)))))))
...
...
@@ -5583,7 +5581,7 @@ See also `same-window-regexps'."
:group 'windows)
(make-obsolete-variable
'same-window-buffer-names
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom same-window-regexps nil
"
List
of
regexps
saying
which
buffers
should
appear
in
the
\"same\"
window.
...
...
@@ -5601,7 +5599,7 @@ See also `same-window-buffer-names'."
:group 'windows)
(make-obsolete-variable
'same-window-regexps
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defun same-window-p (buffer-name)
"
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'."
:group 'frames)
(make-obsolete-variable
'special-display-frame-alist
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defun special-display-popup-frame (buffer &optional args)
"
Display
BUFFER
in
a
special
frame
and
return
the
window
chosen.
...
...
@@ -5695,7 +5693,7 @@ and (cdr ARGS) as second."
(frame-selected-window frame))))))
(make-obsolete
'special-display-popup-frame
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom special-display-function 'special-display-popup-frame
"
Function
to
call
for
displaying
special
buffers.
...
...
@@ -5714,7 +5712,7 @@ A buffer is special when its name is either listed in
:group 'frames)
(make-obsolete-variable
'special-display-function
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom special-display-buffer-names nil
"
List
of
names
of
buffers
that
should
be
displayed
specially.
...
...
@@ -5781,7 +5779,7 @@ See also `special-display-regexps'."
:group 'frames)
(make-obsolete-variable
'special-display-buffer-names
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
;;;###autoload
(put 'special-display-buffer-names 'risky-local-variable t)
...
...
@@ -5852,7 +5850,7 @@ See also `special-display-buffer-names'."
:group 'frames)
(make-obsolete-variable
'special-display-regexps
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defun special-display-p (buffer-name)
"
Return
non-nil
if
a
buffer
named
BUFFER-NAME
gets
a
special
frame.
...
...
@@ -5904,7 +5902,7 @@ affected by this variable."
:group 'frames)
(make-obsolete-variable
'pop-up-frame-alist
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom pop-up-frame-function
(lambda () (make-frame pop-up-frame-alist))
...
...
@@ -5916,7 +5914,7 @@ frame. The default value calls `make-frame' with the argument
:group 'frames)
(make-obsolete-variable
'pop-up-frame-function
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom pop-up-frames 'unset ; nil
"
Whether
`
display-buffer
'
should
make
a
separate
frame.
...
...
@@ -5936,7 +5934,7 @@ Any other non-nil value means always make a separate frame."
:group 'frames)
(make-obsolete-variable
'pop-up-frames
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom display-buffer-reuse-frames 'unset ; nil
"
Set
and
non-nil
means
`
display-buffer
'
should
reuse
frames.
...
...
@@ -5948,7 +5946,7 @@ that frame."
:group 'frames)
(make-obsolete-variable
'display-buffer-reuse-frames
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom pop-up-windows 'unset ; t
"
Set
and
non-nil
means
`
display-buffer
'
should
make
a
new
window.
"
...
...
@@ -5957,7 +5955,7 @@ that frame."
:group 'windows)
(make-obsolete-variable
'pop-up-windows
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom split-window-preferred-function 'split-window-sensibly
"
Function
called
by
`
display-buffer
'
to
split
a
window.
...
...
@@ -5986,7 +5984,7 @@ not want to split the selected window."
:group 'windows)
(make-obsolete-variable
'split-window-preferred-function
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom split-height-threshold 80
"
Minimum
height
for
splitting
a
window
to
display
a
buffer.
...
...
@@ -6000,7 +5998,7 @@ split it vertically disregarding the value of this variable."
:group 'windows)
(make-obsolete-variable
'split-height-threshold
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom split-width-threshold 160
"
Minimum
width
for
splitting
a
window
to
display
a
buffer.
...
...
@@ -6012,7 +6010,7 @@ is nil, `display-buffer' cannot split windows horizontally."
:group 'windows)
(make-obsolete-variable
'split-width-threshold
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defcustom even-window-heights t
"
If
non-nil
`
display-buffer
'
will
try
to
even
window
heights.
...
...
@@ -6024,7 +6022,7 @@ window that appears above or below the selected window."
:group 'windows)
(make-obsolete-variable
'even-window-heights
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defvar display-buffer-mark-dedicated 'unset ; nil
"
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
`
window-dedicated-p
'
flag.
")
(make-obsolete-variable
'display-buffer-mark-dedicated
"
use
`
display-buffer-alist
'
or
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
"
use
2nd
arg
of
`
display-buffer
'
instead.
" "
24.1
")
(defun window-splittable-p (window &optional horizontal)
"
Return
non-nil
if
`
split-window-sensibly
'
may
split
WINDOW.
...
...
src/ChangeLog
View file @
ff672d2c
2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
Integer overflow and signedness fixes.
* fileio.c: Don't assume EMACS_INT fits in off_t.
(emacs_lseek): New static function.
(Finsert_file_contents, Fwrite_region): Use it.
Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
2011-06-14 Paul Eggert <eggert@cs.ucla.edu>
* fns.c (Fload_average): Don't assume 100 * load average fits in int.
* fns.c: Don't overflow int when computing a list length.
...
...
@@ -66,8 +66,6 @@
* vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
* mem-limits.h (SIZE): Remove; no longer used.
2011-06-13 Paul Eggert <eggert@cs.ucla.edu>
* xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
Remove unnecessary casts.
...
...
@@ -247,6 +245,30 @@
* alloc.c (Fmake_string): Check for out-of-range init.
2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (x_set_scroll_bar_default_width): Remove argument to
xg_get_default_scrollbar_width.
* gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
(int_gtk_range_get_value): Move to the scroll bar part of the file.
(style_changed_cb): Call update_theme_scrollbar_width and call
x_set_scroll_bar_default_width and xg_frame_set_char_size for
all frames (Bug#8505).
(xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
Call gtk_window_set_resizable if HAVE_GTK3.
(x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
and height if HAVE_GTK3 (Bug#8505).
(scroll_bar_width_for_theme): New variable.
(update_theme_scrollbar_width): New function.
(xg_get_default_scrollbar_width): Move code to
update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
(xg_initialize): Call update_theme_scrollbar_width.
* gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
* emacsgtkfixed.c, emacsgtkfixed.h: New files.
2011-06-12 Martin Rudalics <rudalics@gmx.at>
* frame.c (make_frame): Call other_buffer_safely instead of
...
...
src/emacsgtkfixed.c
0 → 100644
View file @
ff672d2c
/* A Gtk Widget that inherits GtkFixed, but can be shrinked.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "emacsgtkfixed.h"
struct
_EmacsFixedPrivate
{
int
minwidth
,
minheight
;
};
static
void
emacs_fixed_get_preferred_width
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
);
static
void
emacs_fixed_get_preferred_height
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
);
G_DEFINE_TYPE
(
EmacsFixed
,
emacs_fixed
,
GTK_TYPE_FIXED
)
static
void
emacs_fixed_class_init
(
EmacsFixedClass
*
klass
)
{
GtkWidgetClass
*
widget_class
;
GtkFixedClass
*
fixed_class
;
widget_class
=
(
GtkWidgetClass
*
)
klass
;
fixed_class
=
(
GtkFixedClass
*
)
klass
;
widget_class
->
get_preferred_width
=
emacs_fixed_get_preferred_width
;
widget_class
->
get_preferred_height
=
emacs_fixed_get_preferred_height
;
g_type_class_add_private
(
klass
,
sizeof
(
EmacsFixedPrivate
));
}
static
GType
emacs_fixed_child_type
(
GtkFixed
*
container
)
{
return
GTK_TYPE_WIDGET
;
}
static
void
emacs_fixed_init
(
EmacsFixed
*
fixed
)
{
fixed
->
priv
=
G_TYPE_INSTANCE_GET_PRIVATE
(
fixed
,
EMACS_TYPE_FIXED
,
EmacsFixedPrivate
);
fixed
->
priv
->
minwidth
=
fixed
->
priv
->
minheight
=
0
;
}
/**
* emacs_fixed_new:
*
* Creates a new #EmacsFixed.
*
* Returns: a new #EmacsFixed.
*/
GtkWidget
*
emacs_fixed_new
(
void
)
{
return
g_object_new
(
EMACS_TYPE_FIXED
,
NULL
);
}
static
GtkWidgetClass
*
get_parent_class
(
EmacsFixed
*
fixed
)
{
EmacsFixedClass
*
klass
=
EMACS_FIXED_GET_CLASS
(
fixed
);
GtkFixedClass
*
parent_class
=
g_type_class_peek_parent
(
klass
);
return
(
GtkWidgetClass
*
)
parent_class
;
}
static
void
emacs_fixed_get_preferred_width
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
{
EmacsFixed
*
fixed
=
EMACS_FIXED
(
widget
);
EmacsFixedPrivate
*
priv
=
fixed
->
priv
;
GtkWidgetClass
*
widget_class
=
get_parent_class
(
fixed
);
widget_class
->
get_preferred_width
(
widget
,
minimum
,
natural
);
if
(
minimum
)
*
minimum
=
priv
->
minwidth
;
}
static
void
emacs_fixed_get_preferred_height
(
GtkWidget
*
widget
,
gint
*
minimum
,
gint
*
natural
)
{
EmacsFixed
*
fixed
=
EMACS_FIXED
(
widget
);
EmacsFixedPrivate
*
priv
=
fixed
->
priv
;
GtkWidgetClass
*
widget_class
=
get_parent_class
(
fixed
);
widget_class
->
get_preferred_height
(
widget
,
minimum
,
natural
);
if
(
minimum
)
*
minimum
=
priv
->
minheight
;
}
void
emacs_fixed_set_min_size
(
EmacsFixed
*
widget
,
int
width
,
int
height
)
{
EmacsFixedPrivate
*
priv
=
widget
->
priv
;
GtkWidgetClass
*
widget_class
=
get_parent_class
(
widget
);
int
mw
,
nw
,
mh
,
nh
;
widget_class
->
get_preferred_height
(
GTK_WIDGET
(
widget
),
&
mh
,
&
nh
);
widget_class
->
get_preferred_width
(
GTK_WIDGET
(
widget
),
&
mw
,
&
nw
);
/* Gtk complains if min size is less than natural size. */
if
(
width
<=
nw
)
priv
->
minwidth
=
width
;
if
(
height
<=
nh
)
priv
->
minheight
=
height
;
}
src/emacsgtkfixed.h
0 → 100644
View file @
ff672d2c
/* A Gtk Widget that inherits GtkFixed, but can be shrinked.
Copyright (C) 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACSGTKFIXED_H
#define EMACSGTKFIXED_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define EMACS_TYPE_FIXED (emacs_fixed_get_type ())
#define EMACS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMACS_TYPE_FIXED, EmacsFixed))
#define EMACS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMACS_TYPE_FIXED, EmacsFixedClass))
#define EMACS_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMACS_TYPE_FIXED))