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
1113d9db
Commit
1113d9db
authored
Jun 10, 1992
by
Jim Blandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
492878e4
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
282 additions
and
93 deletions
+282
-93
src/dispnew.c
src/dispnew.c
+18
-13
src/frame.c
src/frame.c
+67
-15
src/keyboard.c
src/keyboard.c
+26
-9
src/search.c
src/search.c
+72
-18
src/termhooks.h
src/termhooks.h
+1
-1
src/window.c
src/window.c
+6
-3
src/xfns.c
src/xfns.c
+26
-3
src/xselect.c.old
src/xselect.c.old
+44
-14
src/xterm.c
src/xterm.c
+22
-17
No files found.
src/dispnew.c
View file @
1113d9db
...
...
@@ -96,8 +96,9 @@ Lisp_Object Vglyph_table;
Lisp_Object
Vstandard_display_table
;
/* Nonzero means reading single-character input with prompt
so put cursor on minibuffer after the prompt. */
so put cursor on minibuffer after the prompt.
positive means at end of text in echo area;
negative means at beginning of line. */
int
cursor_in_echo_area
;
/* The currently selected screen.
...
...
@@ -1056,16 +1057,19 @@ update_screen (s, force, inhibit_hairy_id)
/* Now just clean up termcap drivers and set cursor, etc. */
if
(
!
pause
)
{
if
(
s
==
selected_screen
&&
cursor_in_echo_area
<
0
)
cursor_to
(
SCREEN_HEIGHT
(
s
)
-
1
,
0
);
else
if
(
s
==
selected_screen
&&
cursor_in_echo_area
&&
!
desired_screen
->
used
[
SCREEN_HEIGHT
(
s
)
-
1
])
cursor_to
(
SCREEN_HEIGHT
(
s
),
0
);
else
if
(
cursor_in_echo_area
)
cursor_to
(
SCREEN_HEIGHT
(
s
)
-
1
,
min
(
SCREEN_WIDTH
(
s
)
-
1
,
desired_screen
->
used
[
SCREEN_HEIGHT
(
s
)
-
1
]));
if
(
cursor_in_echo_area
)
{
if
(
s
==
selected_screen
&&
cursor_in_echo_area
<
0
)
cursor_to
(
SCREEN_HEIGHT
(
s
)
-
1
,
0
);
else
if
(
s
==
selected_screen
&&
!
current_screen
->
enable
[
SCREEN_HEIGHT
(
s
)
-
1
])
cursor_to
(
SCREEN_HEIGHT
(
s
)
-
1
,
0
);
else
cursor_to
(
SCREEN_HEIGHT
(
s
)
-
1
,
min
(
SCREEN_WIDTH
(
s
)
-
1
,
current_screen
->
used
[
SCREEN_HEIGHT
(
s
)
-
1
]));
}
else
cursor_to
(
SCREEN_CURSOR_Y
(
s
),
max
(
min
(
SCREEN_CURSOR_X
(
s
),
SCREEN_WIDTH
(
s
)
-
1
),
0
));
...
...
@@ -1906,9 +1910,10 @@ Value is t if waited the full time with no input arriving.")
Lisp_Object
arg
,
millisec
,
nodisp
;
{
int
usec
=
0
;
int
sec
=
0
;
int
sec
;
CHECK_NUMBER
(
arg
,
0
);
sec
=
XINT
(
arg
);
if
(
!
NILP
(
millisec
))
{
...
...
src/frame.c
View file @
1113d9db
/* Generic screen functions.
Copyright (C) 1989 Free Software Foundation.
Copyright (C) 1989
, 1992
Free Software Foundation.
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
1
, or (at your option)
the Free Software Foundation; either version
2
, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
...
...
@@ -194,7 +194,9 @@ make_screen_without_minibuffer (mini_window)
if
(
NILP
(
mini_window
))
{
if
(
XTYPE
(
Vdefault_minibuffer_screen
)
!=
Lisp_Screen
)
error
(
"default-minibuffer-screen must be set when creating minibufferless screens."
);
error
(
"default-minibuffer-screen must be set when creating minibufferless screens"
);
if
(
!
SCREEN_LIVE_P
(
XSCREEN
(
Vdefault_minibuffer_screen
)))
error
(
"default-minibuffer-screen must be a live screen"
);
mini_window
=
XSCREEN
(
Vdefault_minibuffer_screen
)
->
minibuffer_window
;
}
else
...
...
@@ -492,16 +494,22 @@ A screen may not be deleted if its minibuffer is used by other screens.")
minibuffer for any other screen? */
if
(
SCREEN_HAS_MINIBUF
(
XSCREEN
(
screen
)))
{
Lisp_Object
screen2
;
for
(
screen2
=
Vscreen_list
;
CONSP
(
2
);
screen2
=
XCONS
(
screen2
)
->
cdr
)
if
(
!
EQ
(
screen2
,
screen
)
&&
EQ
(
screen
,
(
WINDOW_SCREEN
(
XWINDOW
(
SCREEN_MINIBUF_WINDOW
(
XSCREEN
(
screen2
)))))))
error
(
"Attempt to delete a surrogate minibuffer screen"
);
Lisp_Object
screens
;
for
(
screens
=
Vscreen_list
;
CONSP
(
screens
);
screens
=
XCONS
(
screens
)
->
cdr
)
{
Lisp_Object
this
=
XCONS
(
screens
)
->
car
;
if
(
!
EQ
(
this
,
screen
)
&&
EQ
(
screen
,
(
WINDOW_SCREEN
(
XWINDOW
(
SCREEN_MINIBUF_WINDOW
(
XSCREEN
(
this
)))))))
error
(
"Attempt to delete a surrogate minibuffer screen"
);
}
}
/* Don't let the screen remain selected. */
...
...
@@ -530,11 +538,15 @@ A screen may not be deleted if its minibuffer is used by other screens.")
another one. */
if
(
s
==
last_nonminibuf_screen
)
{
Lisp_Object
screens
;
last_nonminibuf_screen
=
0
;
for
(
screen
=
Vscreen_list
;
CONSP
(
screen
);
screen
=
XCONS
(
screen
)
->
cdr
)
for
(
screens
=
Vscreen_list
;
CONSP
(
screens
);
screen
=
XCONS
(
screens
)
->
cdr
)
{
s
=
XSCREEN
(
XCONS
(
screen
)
->
car
);
s
=
XSCREEN
(
XCONS
(
screen
s
)
->
car
);
if
(
!
SCREEN_MINIBUF_ONLY_P
(
s
))
{
last_nonminibuf_screen
=
s
;
...
...
@@ -543,6 +555,46 @@ A screen may not be deleted if its minibuffer is used by other screens.")
}
}
/* If we've deleted Vdefault_minibuffer_screen, try to find another
one. Prefer minibuffer-only screens, but also notice screens
with other windows. */
if
(
EQ
(
screen
,
Vdefault_minibuffer_screen
))
{
Lisp_Object
screens
;
/* The last screen we saw with a minibuffer, minibuffer-only or not. */
Lisp_Object
screen_with_minibuf
=
Qnil
;
for
(
screens
=
Vscreen_list
;
CONSP
(
screens
);
screens
=
XCONS
(
screens
)
->
cdr
)
{
Lisp_Object
this
=
XCONS
(
screens
)
->
car
;
if
(
XTYPE
(
this
)
!=
Lisp_Screen
)
abort
();
s
=
XSCREEN
(
this
);
if
(
SCREEN_HAS_MINIBUF
(
s
))
{
screen_with_minibuf
=
this
;
if
(
SCREEN_MINIBUF_ONLY_P
(
s
))
break
;
}
}
/* We know that there must be some screen with a minibuffer out
there. If this were not true, all of the screens present
would have to be minibufferless, which implies that at some
point their minibuffer screens must have been deleted, but
that is prohibited at the top; you can't delete surrogate
minibuffer screens. */
if
(
NILP
(
screen_with_minibuf
))
abort
();
Vdefault_minibuffer_screen
=
screen_with_minibuf
;
}
return
Qnil
;
}
...
...
src/keyboard.c
View file @
1113d9db
...
...
@@ -210,7 +210,8 @@ Lisp_Object Vmouse_motion_handler;
new screen. */
Lisp_Object
Vlast_event_screen
;
/* X Windows wants this for selection ownership. */
/* The timestamp of the last input event we received from the X server.
X Windows wants this for selection ownership. */
unsigned
long
last_event_timestamp
;
Lisp_Object
Qself_insert_command
;
...
...
@@ -1610,7 +1611,7 @@ kbd_buffer_get_event ()
if
(
kbd_fetch_ptr
==
kbd_buffer
+
KBD_BUFFER_SIZE
)
kbd_fetch_ptr
=
kbd_buffer
;
XSET
(
Vlast_event_screen
,
Lisp_Screen
,
kbd_fetch_ptr
->
screen
);
last_event_timestamp
=
XINT
(
kbd_fetch_ptr
->
timestamp
)
;
last_event_timestamp
=
kbd_fetch_ptr
->
timestamp
;
obj
=
make_lispy_event
(
kbd_fetch_ptr
);
kbd_fetch_ptr
->
kind
=
no_event
;
kbd_fetch_ptr
++
;
...
...
@@ -1791,7 +1792,8 @@ make_lispy_event (event)
Fcons
(
window
,
Fcons
(
posn
,
Fcons
(
Fcons
(
event
->
x
,
event
->
y
),
Fcons
(
event
->
timestamp
,
Fcons
(
make_number
(
event
->
timestamp
),
Qnil
)))));
}
...
...
@@ -1810,7 +1812,8 @@ make_lispy_event (event)
Fcons
(
SCREEN_SELECTED_WINDOW
(
event
->
screen
),
Fcons
(
button
,
Fcons
(
Fcons
(
event
->
x
,
event
->
y
),
Fcons
(
event
->
timestamp
,
Fcons
(
make_number
(
event
->
timestamp
),
Qnil
)))));
}
...
...
@@ -1872,8 +1875,8 @@ format_modifiers (modifiers, buf)
{
char
*
p
=
buf
;
if
(
modifiers
&
meta_modifier
)
{
*
p
++
=
'M'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
ctrl_modifier
)
{
*
p
++
=
'C'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
meta_modifier
)
{
*
p
++
=
'M'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
shift_modifier
)
{
*
p
++
=
'S'
;
*
p
++
=
'-'
;
}
if
(
modifiers
&
up_modifier
)
{
*
p
++
=
'U'
;
*
p
++
=
'-'
;
}
*
p
=
'\0'
;
...
...
@@ -2982,17 +2985,31 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
Vobarray
,
Qcommandp
,
Qt
,
Qnil
,
Qnil
);
/* Add the text read to this_command_keys. */
/* Set this_command_keys to the concatenation of saved_keys and
function, followed by a RET. */
{
struct
Lisp_String
*
func_str
=
XSTRING
(
function
)
;
struct
Lisp_String
*
str
;
int
i
;
Lisp_Object
tem
;
for
(
i
=
0
;
i
<
func_str
->
size
;
i
++
)
this_command_key_count
=
0
;
str
=
XSTRING
(
saved_keys
);
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
{
X
SET
(
tem
,
Lisp_Int
,
func_
str
->
data
[
i
]
)
;
X
FASTINT
(
tem
)
=
str
->
data
[
i
];
add_command_key
(
tem
);
}
str
=
XSTRING
(
function
);
for
(
i
=
0
;
i
<
str
->
size
;
i
++
)
{
XFASTINT
(
tem
)
=
str
->
data
[
i
];
add_command_key
(
tem
);
}
XFASTINT
(
tem
)
=
'\015'
;
add_command_key
(
tem
);
}
UNGCPRO
;
...
...
src/search.c
View file @
1113d9db
...
...
@@ -47,8 +47,16 @@ Lisp_Object last_regexp;
Since the registers are now dynamically allocated, we need to make
sure not to refer to the Nth register before checking that it has
been allocated. */
been allocated by checking search_regs.num_regs.
The regex code keeps track of whether it has allocated the search
buffer using bits in searchbuf. This means that whenever you
compile a new pattern, it completely forgets whether it has
allocated any registers, and will allocate new registers the next
time you call a searching or matching function. Therefore, we need
to call re_set_registers after compiling a new pattern or after
setting the match registers, so that the regex functions will be
able to free or re-allocate it properly. */
static
struct
re_registers
search_regs
;
/* Nonzero if search_regs are indices in a string; 0 if in a buffer. */
...
...
@@ -73,9 +81,10 @@ matcher_overflow ()
/* Compile a regexp and signal a Lisp error if anything goes wrong. */
compile_pattern
(
pattern
,
bufp
,
translate
)
compile_pattern
(
pattern
,
bufp
,
regp
,
translate
)
Lisp_Object
pattern
;
struct
re_pattern_buffer
*
bufp
;
struct
re_registers
*
regp
;
char
*
translate
;
{
CONST
char
*
val
;
...
...
@@ -84,6 +93,7 @@ compile_pattern (pattern, bufp, translate)
if
(
EQ
(
pattern
,
last_regexp
)
&&
translate
==
bufp
->
translate
)
return
;
last_regexp
=
Qnil
;
bufp
->
translate
=
translate
;
val
=
re_compile_pattern
((
char
*
)
XSTRING
(
pattern
)
->
data
,
...
...
@@ -95,7 +105,13 @@ compile_pattern (pattern, bufp, translate)
while
(
1
)
Fsignal
(
Qinvalid_regexp
,
Fcons
(
dummy
,
Qnil
));
}
last_regexp
=
pattern
;
/* Advise the searching functions about the space we have allocated
for register data. */
re_set_registers
(
bufp
,
regp
,
regp
->
num_regs
,
regp
->
start
,
regp
->
end
);
return
;
}
...
...
@@ -124,7 +140,7 @@ data if you want to preserve them.")
register
int
i
;
CHECK_STRING
(
string
,
0
);
compile_pattern
(
string
,
&
searchbuf
,
compile_pattern
(
string
,
&
searchbuf
,
&
search_regs
,
!
NILP
(
current_buffer
->
case_fold_search
)
?
DOWNCASE_TABLE
:
0
);
immediate_quit
=
1
;
...
...
@@ -196,7 +212,7 @@ matched by parenthesis constructs in the pattern.")
args_out_of_range
(
string
,
start
);
}
compile_pattern
(
regexp
,
&
searchbuf
,
compile_pattern
(
regexp
,
&
searchbuf
,
&
search_regs
,
!
NILP
(
current_buffer
->
case_fold_search
)
?
DOWNCASE_TABLE
:
0
);
immediate_quit
=
1
;
val
=
re_search
(
&
searchbuf
,
(
char
*
)
XSTRING
(
string
)
->
data
,
...
...
@@ -506,7 +522,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
return
pos
;
if
(
RE
)
compile_pattern
(
string
,
&
searchbuf
,
(
char
*
)
trt
);
compile_pattern
(
string
,
&
searchbuf
,
&
search_regs
,
(
char
*
)
trt
);
if
(
RE
/* Here we detect whether the */
/* generality of an RE search is */
...
...
@@ -768,6 +784,22 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
if
(
i
+
direction
==
0
)
{
cursor
-=
direction
;
/* Make sure we have registers in which to store
the match position. */
if
(
search_regs
.
num_regs
==
0
)
{
regoff_t
*
starts
,
*
ends
;
starts
=
(
regoff_t
*
)
xmalloc
(
2
*
sizeof
(
regoff_t
));
ends
=
(
regoff_t
*
)
xmalloc
(
2
*
sizeof
(
regoff_t
));
re_set_registers
(
&
searchbuf
,
&
search_regs
,
2
,
starts
,
ends
);
}
search_regs
.
start
[
0
]
=
pos
+
cursor
-
p2
+
((
direction
>
0
)
?
1
-
len
:
0
);
...
...
@@ -827,6 +859,22 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt)
if
(
i
+
direction
==
0
)
{
pos
-=
direction
;
/* Make sure we have registers in which to store
the match position. */
if
(
search_regs
.
num_regs
==
0
)
{
regoff_t
*
starts
,
*
ends
;
starts
=
(
regoff_t
*
)
xmalloc
(
2
*
sizeof
(
regoff_t
));
ends
=
(
regoff_t
*
)
xmalloc
(
2
*
sizeof
(
regoff_t
));
re_set_registers
(
&
searchbuf
,
&
search_regs
,
2
,
starts
,
ends
);
}
search_regs
.
start
[
0
]
=
pos
+
((
direction
>
0
)
?
1
-
len
:
0
);
search_regs
.
end
[
0
]
=
len
+
search_regs
.
start
[
0
];
...
...
@@ -1004,6 +1052,7 @@ Otherwise treat `\\' as special:\n\
`
\\
N' means substitute what matched the Nth `
\\
(...
\\
)'.
\n
\
If Nth parens didn't match, substitute nothing.
\n
\
`
\\\\
' means insert one `
\\
'.
\n
\
FIXEDCASE and LITERAL are optional arguments.
\n
\
Leaves point at end of replacement text."
)
(
string
,
fixedcase
,
literal
)
Lisp_Object
string
,
fixedcase
,
literal
;
...
...
@@ -1221,20 +1270,25 @@ LIST should have been created by calling `match-data' previously.")
if
(
length
>
search_regs
.
num_regs
)
{
if
(
search_regs
.
start
)
search_regs
.
start
=
(
regoff_t
*
)
realloc
(
search_regs
.
start
,
length
*
sizeof
(
regoff_t
));
else
search_regs
.
start
=
(
regoff_t
*
)
malloc
(
length
*
sizeof
(
regoff_t
));
if
(
search_regs
.
end
)
search_regs
.
end
=
(
regoff_t
*
)
realloc
(
search_regs
.
end
,
length
*
sizeof
(
regoff_t
));
if
(
search_regs
.
num_regs
==
0
)
{
search_regs
.
start
=
(
regoff_t
*
)
xmalloc
(
length
*
sizeof
(
regoff_t
));
search_regs
.
end
=
(
regoff_t
*
)
xmalloc
(
length
*
sizeof
(
regoff_t
));
}
else
search_regs
.
end
=
(
regoff_t
*
)
malloc
(
length
*
sizeof
(
regoff_t
));
{
search_regs
.
start
=
(
regoff_t
*
)
xrealloc
(
search_regs
.
start
,
length
*
sizeof
(
regoff_t
));
search_regs
.
end
=
(
regoff_t
*
)
xrealloc
(
search_regs
.
end
,
length
*
sizeof
(
regoff_t
));
}
search_regs
.
num_regs
=
length
;
re_set_registers
(
&
searchbuf
,
&
search_regs
,
length
,
search_regs
.
start
,
search_regs
.
end
);
}
}
...
...
src/termhooks.h
View file @
1113d9db
...
...
@@ -105,7 +105,7 @@ struct input_event {
.modifiers holds the state of the
modifier keys.
.x and .y give the mouse position,
in
pixel
s, within the window.
in
character
s, within the window.
.screen gives the screen the mouse
click occurred in.
.timestamp gives a timestamp (in
...
...
src/window.c
View file @
1113d9db
/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
Copyright (C) 1985, 1986, 1987 Free Software Foundation, Inc.
Copyright (C) 1985, 1986, 1987
, 1992
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
1
, or (at your option)
the Free Software Foundation; either version
2
, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
...
...
@@ -357,7 +357,10 @@ coordinates_in_window (w, x, y)
DEFUN
(
"coordinates-in-window-p"
,
Fcoordinates_in_window_p
,
Scoordinates_in_window_p
,
2
,
2
,
0
,
"Return non-nil if COORDINATES are in WINDOW.
\n
\
COORDINATES is a cons of the form (X . Y), X and Y being screen-relative.
\n
\
COORDINATES is a cons of the form (X . Y), X and Y being distances
\n
\
measured in characters from the upper-left corner of the screen.
\n
\
(0 . 0) denotes the character in the upper left corner of the
\n
\
screen.
\n
\
If COORDINATES are in the text portion of WINDOW,
\n
\
the coordinates relative to the window are returned.
\n
\
If they are in the mode line of WINDOW, 'mode-line is returned.
\n
\
...
...
src/xfns.c
View file @
1113d9db
/* Functions for the X window system.
Copyright (C) 1989 Free Software Foundation.
Copyright (C) 1989
, 1992
Free Software Foundation.
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
1
, or (at your option)
the Free Software Foundation; either version
2
, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
...
...
@@ -1045,6 +1045,17 @@ x_set_name (s, arg, oldval)
if
(
s
->
display
.
x
->
window_desc
)
{
#ifdef HAVE_X11
XTextProperty
prop
;
prop
.
value
=
XSTRING
(
arg
)
->
data
;
prop
.
encoding
=
XA_STRING
;
prop
.
format
=
8
;
prop
.
nitems
=
XSTRING
(
arg
)
->
size
;
BLOCK_INPUT
;
XSetWMName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
&
prop
);
XSetWMIconName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
&
prop
);
UNBLOCK_INPUT
;
#else
s
->
name
=
arg
;
BLOCK_INPUT
;
XStoreName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
...
...
@@ -1052,6 +1063,7 @@ x_set_name (s, arg, oldval)
XSetIconName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
(
char
*
)
XSTRING
(
arg
)
->
data
);
UNBLOCK_INPUT
;
#endif
}
}
...
...
@@ -2102,8 +2114,19 @@ be shared by the new screen.")
x_set_resize_hint
(
s
);
/* Tell the server the window's default name. */
#ifdef HAVE_X11
{
XTextProperty
prop
;
prop
.
value
=
XSTRING
(
s
->
name
)
->
data
;
prop
.
encoding
=
XA_STRING
;
prop
.
format
=
8
;
prop
.
nitems
=
XSTRING
(
s
->
name
)
->
size
;
XSetWMName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
&
prop
);
}
#else
XStoreName
(
XDISPLAY
s
->
display
.
x
->
window_desc
,
XSTRING
(
s
->
name
)
->
data
);
#endif
/* Now override the defaults with all the rest of the specified
parms. */
tem
=
x_get_arg
(
parms
,
intern
(
"unsplittable"
),
0
,
0
);
...
...
src/xselect.c.old
View file @
1113d9db
...
...
@@ -29,11 +29,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MAX_SELECTION(dpy) (((dpy)->max_request_size << 2) - 100)
#define SELECTION_LENGTH(len,format) ((len) * ((format) >> 2))
/* The last 23 bits of the timestamp of the last mouse button event. */
extern Time mouse_timestamp;
/* An expedient hack! Fix this! */
#define last_event_timestamp CurrentTime
/* The timestamp of the last input event we received from the X server. */
unsigned long last_event_timestamp;
/* t if a mouse button is depressed. */
extern Lisp_Object Vmouse_grabbed;
...
...
@@ -56,8 +53,10 @@ Lisp_Object Vx_selection_value;
/* The value of the current SECONDARY selection. */
Lisp_Object Vx_secondary_selection_value;
/* Types of selections we may make. */
Lisp_Object Qprimary, Qsecondary, Qclipboard;
/* Types of selections we may make. Note that Qcut_buffer0 isn't really
a selection, but it acts like one for the sake of Fx_own_selection and
Fx_selection_value. */
Lisp_Object Qprimary, Qsecondary, Qclipboard, Qcut_buffer0;
/* Emacs' selection property identifiers. */
Atom Xatom_emacs_selection;
...
...
@@ -146,13 +145,18 @@ own_selection (selection_type, time)
DEFUN ("x-own-selection", Fx_own_selection, Sx_own_selection,
1, 2, "",
"Make STRING the selection value. Default is the primary selection,\n\
but optional second argument TYPE may specify secondary or clipboard.")
but optional second argument TYPE may specify secondary or clipboard.\n\
\n\
TYPE may also be cut-buffer0, indicating that Emacs should set the X\n\
cut buffer 0 to STRING. This is for compatibility with older X\n\
applications which still use the cut buffers; new applications should\n\
use X selections.")
(string, type)
register Lisp_Object string, type;
{
Atom selection_type;
Lisp_Object val;
Time event_time =
mouse
_timestamp;
Time event_time =
last_event
_timestamp;
CHECK_STRING (string, 0);
if (NILP (type) || EQ (type, Qprimary))
...
...
@@ -163,7 +167,7 @@ but optional second argument TYPE may specify secondary or clipboard.")
x_begin_selection_own = event_time;
val = Vx_selection_value = string;
}
UNBLOCK_INPUT;
UNBLOCK_INPUT;
}
else if (EQ (type, Qsecondary))
{
...
...
@@ -180,10 +184,18 @@ but optional second argument TYPE may specify secondary or clipboard.")
BLOCK_INPUT;
if (own_selection (Xatom_clipboard, event_time))
{
x_begin_clipboard_own = event_time;
x_begin_clipboard_own = event_time;
val = Vx_clipboard_value = string;
}
UNBLOCK_INPUT;
UNBLOCK_INPUT;
}
else if (EQ (type, Qcut_buffer0))
{
BLOCK_INPUT;
XStoreBytes (x_current_display,
XSTRING (string)->data,
XSTRING (string)->size);
UNBLOCK_INPUT;
}
else
error ("Invalid X selection type");
...
...
@@ -230,7 +242,7 @@ int x_selection_alloc_error;
int x_converting_selection;
/* Reply to some client's request for our selection data. Data is
placed in a propery supplied by the requesting window.
placed in a proper
t
y supplied by the requesting window.
If the data exceeds the maximum amount the server can send,
then prepare to send it incrementally, and reply to the client with
...
...
@@ -518,7 +530,7 @@ get_selection_value (type)
Window requestor_window;
BLOCK_INPUT;
requestor_time =
mouse
_timestamp;
requestor_time =
last_event
_timestamp;
requestor_window = selected_screen->display.x->window_desc;
XConvertSelection (x_current_display, type, XA_STRING,
Xatom_emacs_selection, requestor_window, requestor_time);
...
...
@@ -566,6 +578,22 @@ selection, but optional argument TYPE may specify secondary or clipboard.")
return get_selection_value (Xatom_clipboard);
}
else if (EQ (type, Qcut_buffer0))
{
char *data;
int size;
Lisp_Object string;
BLOCK_INPUT;
data = XFetchBytes (x_current_display, &size);
if (data == 0)
string = Qnil;
else
string = make_string (data, size);
UNBLOCK_INPUT;
return string;
}
else
error ("Invalid X selection type");
}
...
...
@@ -704,6 +732,8 @@ syms_of_xselect ()
staticpro (&Qsecondary);
Qclipboard = intern ("clipboard");
staticpro (&Qclipboard);
Qcut_buffer0 = intern ("cut-buffer0");
staticpro (&Qcut_buffer0);