summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2008-01-22 23:53:46 +0000
committerMiles Bader <miles@gnu.org>2008-01-22 23:53:46 +0000
commit1bad168e59601c1c843a38b2962e77b29f497f11 (patch)
tree26f29332811458573579bb0b807ff85a8d32b807 /src
parent22f9eb9e4f09de5570ba5ede033b0a8f0973a0e9 (diff)
parent645b6388d5bae5304098c1e773694beffc3478e9 (diff)
downloademacs-1bad168e59601c1c843a38b2962e77b29f497f11.tar.gz
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1006
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog25
-rw-r--r--src/fns.c7
-rw-r--r--src/mac.c7
-rw-r--r--src/macterm.c36
-rw-r--r--src/macterm.h3
-rw-r--r--src/w32term.c86
-rw-r--r--src/xterm.c8
7 files changed, 138 insertions, 34 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0a798a670a0..b28fecb971a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,28 @@
+2008-01-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * macterm.c (x_scroll_bar_create): Initialize bar->redraw_needed_p.
+ (XTset_vertical_scroll_bar): Redraw scroll bar if bar->redraw_needed_p
+ is set even without positional changes.
+ (x_scroll_bar_clear): Set bar->redraw_needed_p.
+
+ * macterm.h (struct scroll_bar): New member `redraw_needed_p'.
+
+2008-01-17 Jason Rumney <jasonr@gnu.org>
+
+ * xterm.c (handle_one_xevent): Revert to counting chars not bytes.
+
+ * w32term.c (w32_read_socket) <WM_CHAR>: Decode characters outside
+ the unicode range available in MULE by locale-coding-system.
+ Improve dbcs lead byte detection. Set event timestamp and modifiers
+ earlier.
+
+2008-01-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * mac.c (mac_emacs_pid) [MAC_OSX]: New variable.
+ [MAC_OSX] (init_mac_osx_environment): Initialize it.
+ [MAC_OSX] (mac_try_close_socket) [SELECT_USE_CFSOCKET]: Return 0
+ when used on child processes.
+
2008-01-21 Michael Albinus <michael.albinus@gmx.de>
* dbusbind.el (Fdbus_method_return_internal): Renamed from
diff --git a/src/fns.c b/src/fns.c
index aee268f3067..01c7e583661 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5829,9 +5829,10 @@ invoked by mouse clicks and mouse menu items. */);
DEFVAR_BOOL ("use-file-dialog", &use_file_dialog,
doc: /* *Non-nil means mouse commands use a file dialog to ask for files.
-This applies to commands from menus and tool bar buttons. The value of
-`use-dialog-box' takes precedence over this variable, so a file dialog is only
-used if both `use-dialog-box' and this variable are non-nil. */);
+This applies to commands from menus and tool bar buttons even when
+they are initiated from the keyboard. The value of `use-dialog-box'
+takes precedence over this variable, so a file dialog is only used if
+both `use-dialog-box' and this variable are non-nil. */);
use_file_dialog = 1;
defsubr (&Sidentity);
diff --git a/src/mac.c b/src/mac.c
index 1369db63039..5a8c8823ec4 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -5008,6 +5008,9 @@ extern int noninteractive;
sys_select. */
static CFMutableDictionaryRef cfsockets_for_select;
+/* Process ID of Emacs. */
+static pid_t mac_emacs_pid;
+
static void
socket_callback (s, type, address, data, info)
CFSocketRef s;
@@ -5103,7 +5106,7 @@ mac_try_close_socket (fd)
int fd;
{
#if SELECT_USE_CFSOCKET
- if (cfsockets_for_select)
+ if (getpid () == mac_emacs_pid && cfsockets_for_select)
{
void *key = (void *) fd;
CFSocketRef socket =
@@ -5339,6 +5342,8 @@ init_mac_osx_environment ()
char *p, *q;
struct stat st;
+ mac_emacs_pid = getpid ();
+
/* Initialize locale related variables. */
mac_system_script_code =
(ScriptCode) GetScriptManagerVariable (smSysScript);
diff --git a/src/macterm.c b/src/macterm.c
index 3fbdcc2f822..58de15cace0 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -5069,6 +5069,7 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height)
#ifdef MAC_OSX
bar->fringe_extended_p = Qnil;
#endif
+ bar->redraw_needed_p = Qnil;
#ifdef USE_TOOLKIT_SCROLL_BARS
bar->track_top = Qnil;
bar->track_height = Qnil;
@@ -5285,14 +5286,24 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
BLOCK_INPUT;
/* If already correctly positioned, do nothing. */
- if (!(XINT (bar->left) == sb_left
- && XINT (bar->top) == top
- && XINT (bar->width) == sb_width
- && XINT (bar->height) == height
+ if (XINT (bar->left) == sb_left
+ && XINT (bar->top) == top
+ && XINT (bar->width) == sb_width
+ && XINT (bar->height) == height
#ifdef MAC_OSX
- && !NILP (bar->fringe_extended_p) == fringe_extended_p
+ && !NILP (bar->fringe_extended_p) == fringe_extended_p
#endif
- ))
+ )
+ {
+ if (!NILP (bar->redraw_needed_p))
+ {
+#if USE_CG_DRAWING
+ mac_prepare_for_quickdraw (f);
+#endif
+ Draw1Control (SCROLL_BAR_CONTROL_HANDLE (bar));
+ }
+ }
+ else
{
/* Since toolkit scroll bars are smaller than the space reserved
for them on the frame, we have to clear "under" them. */
@@ -5334,6 +5345,8 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
#endif
+ bar->redraw_needed_p = Qnil;
+
#ifdef USE_TOOLKIT_SCROLL_BARS
if (NILP (bar->track_top))
{
@@ -5691,8 +5704,15 @@ void
x_scroll_bar_clear (f)
FRAME_PTR f;
{
- XTcondemn_scroll_bars (f);
- XTjudge_scroll_bars (f);
+ Lisp_Object bar;
+
+ /* We can have scroll bars even if this is 0,
+ if we just turned off scroll bar mode.
+ But in that case we should not clear them. */
+ if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+ for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar);
+ bar = XSCROLL_BAR (bar)->next)
+ XSCROLL_BAR (bar)->redraw_needed_p = Qt;
}
diff --git a/src/macterm.h b/src/macterm.h
index 03016f30e0f..11d7e05a38f 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -457,6 +457,9 @@ struct scroll_bar {
Lisp_Object fringe_extended_p;
#endif
+ /* t if redraw needed in the next XTset_vertical_scroll_bar call. */
+ Lisp_Object redraw_needed_p;
+
#ifdef USE_TOOLKIT_SCROLL_BARS
/* The position and size of the scroll bar handle track area in
pixels, relative to the frame. */
diff --git a/src/w32term.c b/src/w32term.c
index 49c3ddf483d..48c548fd02a 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4332,6 +4332,10 @@ w32_read_socket (sd, expected, hold_quit)
temp_index = 0;
temp_buffer[temp_index++] = msg.msg.wParam;
+ inev.modifiers = msg.dwModifiers;
+ XSETFRAME (inev.frame_or_window, f);
+ inev.timestamp = msg.msg.time;
+
if (msg.msg.wParam < 128 && !dbcs_lead)
{
inev.kind = ASCII_KEYSTROKE_EVENT;
@@ -4340,20 +4344,14 @@ w32_read_socket (sd, expected, hold_quit)
else if (msg.msg.wParam < 256)
{
wchar_t code;
-
+ char dbcs[2];
inev.kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT;
+ dbcs[0] = 0;
+ dbcs[1] = (char) msg.msg.wParam;
- if (IsDBCSLeadByteEx(CP_ACP, (BYTE) msg.msg.wParam))
- {
- dbcs_lead = (char) msg.msg.wParam;
- inev.kind = NO_EVENT;
- break;
- }
- else if (dbcs_lead)
+ if (dbcs_lead)
{
- char dbcs[2];
dbcs[0] = dbcs_lead;
- dbcs[1] = (char) msg.msg.wParam;
dbcs_lead = 0;
if (!MultiByteToWideChar(CP_ACP, 0, dbcs, 2, &code, 1))
{
@@ -4364,14 +4362,19 @@ w32_read_socket (sd, expected, hold_quit)
break;
}
}
+ else if (IsDBCSLeadByteEx(CP_ACP, (BYTE) msg.msg.wParam))
+ {
+ dbcs_lead = (char) msg.msg.wParam;
+ inev.kind = NO_EVENT;
+ break;
+ }
else
{
- char single_byte = (char) msg.msg.wParam;
- if (!MultiByteToWideChar(CP_ACP, 0, &single_byte, 1,
+ if (!MultiByteToWideChar(CP_ACP, 0, &dbcs[1], 1,
&code, 1))
{
/* What to do with garbage? */
- DebPrint (("Invalid character: %d\n", single_byte));
+ DebPrint (("Invalid character: %d\n", dbcs[1]));
inev.kind = NO_EVENT;
break;
}
@@ -4397,17 +4400,67 @@ w32_read_socket (sd, expected, hold_quit)
charset_id = charset_mule_unicode_0100_24ff;
code -= 0x100;
}
- else if (code < 0xE000)
+ else if (code < 0x3400)
{
charset_id = charset_mule_unicode_2500_33ff;
code -= 0x2500;
}
- else
+ else if (code >= 0xE000)
{
charset_id = charset_mule_unicode_e000_ffff;
code -= 0xE000;
}
+ else
+ {
+ /* Not in the unicode range that we can handle in
+ Emacs-22, so decode the original character
+ using the locale */
+ int nbytes, nchars, require, i, len;
+ unsigned char *dest;
+ struct coding_system coding;
+
+ if (dbcs[0] == 0)
+ {
+ nbytes = 1;
+ dbcs[0] = dbcs[1];
+ }
+ else
+ nbytes = 2;
+
+ setup_coding_system (Vlocale_coding_system, &coding);
+ coding.src_multibyte = 0;
+ coding.dst_multibyte = 1;
+ coding.composing = COMPOSITION_DISABLED;
+ require = decoding_buffer_size (&coding, nbytes);
+ dest = (unsigned char *) alloca (require);
+ coding.mode |= CODING_MODE_LAST_BLOCK;
+
+ decode_coding (&coding, dbcs, dest, nbytes, require);
+ nbytes = coding.produced;
+ nchars = coding.produced_char;
+
+ for (i = 0; i < nbytes; i += len)
+ {
+ if (nchars == nbytes)
+ {
+ inev.code = dest[i];
+ len = 1;
+ }
+ else
+ inev.code = STRING_CHAR_AND_LENGTH (dest + i,
+ nbytes - 1,
+ len);
+ inev.kind = (SINGLE_BYTE_CHAR_P (inev.code)
+ ? ASCII_KEYSTROKE_EVENT
+ : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+ kbd_buffer_store_event_hold (&inev, hold_quit);
+ count++;
+ }
+ inev.kind = NO_EVENT; /* Already handled */
+ break;
+ }
+ /* Unicode characters from above. */
c1 = (code / 96) + 32;
c2 = (code % 96) + 32;
inev.code = MAKE_CHAR (charset_id, c1, c2);
@@ -4421,9 +4474,6 @@ w32_read_socket (sd, expected, hold_quit)
inev.kind = NO_EVENT;
break;
}
- inev.modifiers = msg.dwModifiers;
- XSETFRAME (inev.frame_or_window, f);
- inev.timestamp = msg.msg.time;
}
break;
diff --git a/src/xterm.c b/src/xterm.c
index 574c398949b..77a1b3745f1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6558,9 +6558,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
}
}
- /* Previous code updated count by nchars rather than nbytes,
- but that seems bogus to me. ++kfs */
- count += nbytes;
+ count += nchars;
inev.ie.kind = NO_EVENT; /* Already stored above. */
@@ -7057,7 +7055,9 @@ x_dispatch_event (event, display)
We return as soon as there are no more events to be read.
We return the number of characters stored into the buffer,
- thus pretending to be `read'.
+ thus pretending to be `read' (except the characters we store
+ in the keyboard buffer can be multibyte, so are not necessarily
+ C chars).
EXPECTED is nonzero if the caller knows input is available. */