projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Of course, that cleanup I did earlier in which I rationalised all
[u/mdw/putty]
/
window.c
diff --git
a/window.c
b/window.c
index
410c37e
..
b1fb5fe
100644
(file)
--- a/
window.c
+++ b/
window.c
@@
-78,6
+78,7
@@
#define WHEEL_DELTA 120
#endif
#define WHEEL_DELTA 120
#endif
+static Mouse_Button translate_button(Mouse_Button button);
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output);
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
unsigned char *output);
@@
-911,7
+912,7
@@
void connection_fatal(void *frontend, char *fmt, ...)
vsprintf(stuff, fmt, ap);
va_end(ap);
MessageBox(hwnd, stuff, "PuTTY Fatal Error", MB_ICONERROR | MB_OK);
vsprintf(stuff, fmt, ap);
va_end(ap);
MessageBox(hwnd, stuff, "PuTTY Fatal Error", MB_ICONERROR | MB_OK);
- if (cfg.close_on_exit ==
COE_ALWAYS
)
+ if (cfg.close_on_exit ==
FORCE_ON
)
PostQuitMessage(1);
else {
session_closed = TRUE;
PostQuitMessage(1);
else {
session_closed = TRUE;
@@
-956,8
+957,8
@@
static void enact_pending_netevent(void)
if (ret == 0 && !session_closed) {
/* Abnormal exits will already have set session_closed and taken
* appropriate action. */
if (ret == 0 && !session_closed) {
/* Abnormal exits will already have set session_closed and taken
* appropriate action. */
- if (cfg.close_on_exit ==
COE_ALWAYS
||
- cfg.close_on_exit ==
COE_NORMAL
) PostQuitMessage(0);
+ if (cfg.close_on_exit ==
FORCE_ON
||
+ cfg.close_on_exit ==
AUTO
) PostQuitMessage(0);
else {
session_closed = TRUE;
set_icon(NULL, "PuTTY (inactive)");
else {
session_closed = TRUE;
set_icon(NULL, "PuTTY (inactive)");
@@
-1560,7
+1561,8
@@
static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
if (send_raw_mouse && !(cfg.mouse_override && shift)) {
lastbtn = MBT_NOTHING;
if (send_raw_mouse && !(cfg.mouse_override && shift)) {
lastbtn = MBT_NOTHING;
- term_mouse(term, b, MA_CLICK, x, y, shift, ctrl, alt);
+ term_mouse(term, b, translate_button(b), MA_CLICK,
+ x, y, shift, ctrl, alt);
return;
}
return;
}
@@
-1573,7
+1575,8
@@
static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
lastact = MA_CLICK;
}
if (lastact != MA_NOTHING)
lastact = MA_CLICK;
}
if (lastact != MA_NOTHING)
- term_mouse(term, b, lastact, x, y, shift, ctrl, alt);
+ term_mouse(term, b, translate_button(b), lastact,
+ x, y, shift, ctrl, alt);
lasttime = thistime;
}
lasttime = thistime;
}
@@
-1581,7
+1584,7
@@
static void click(Mouse_Button b, int x, int y, int shift, int ctrl, int alt)
* Translate a raw mouse button designation (LEFT, MIDDLE, RIGHT)
* into a cooked one (SELECT, EXTEND, PASTE).
*/
* Translate a raw mouse button designation (LEFT, MIDDLE, RIGHT)
* into a cooked one (SELECT, EXTEND, PASTE).
*/
-
Mouse_Button translate_button(void *frontend,
Mouse_Button button)
+
static Mouse_Button translate_button(
Mouse_Button button)
{
if (button == MBT_LEFT)
return MBT_SELECT;
{
if (button == MBT_LEFT)
return MBT_SELECT;
@@
-2052,7
+2055,7
@@
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
is_alt_pressed());
SetCapture(hwnd);
} else {
is_alt_pressed());
SetCapture(hwnd);
} else {
- term_mouse(term, button, MA_RELEASE,
+ term_mouse(term, button,
translate_button(button),
MA_RELEASE,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
@@
-2077,7
+2080,8
@@
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
b = MBT_MIDDLE;
else
b = MBT_RIGHT;
b = MBT_MIDDLE;
else
b = MBT_RIGHT;
- term_mouse(term, b, MA_DRAG, TO_CHR_X(X_POS(lParam)),
+ term_mouse(term, b, translate_button(b), MA_DRAG,
+ TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
}
TO_CHR_Y(Y_POS(lParam)), wParam & MK_SHIFT,
wParam & MK_CONTROL, is_alt_pressed());
}
@@
-2612,12
+2616,13
@@
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
if (send_raw_mouse &&
!(cfg.mouse_override && shift_pressed)) {
/* send a mouse-down followed by a mouse up */
if (send_raw_mouse &&
!(cfg.mouse_override && shift_pressed)) {
/* send a mouse-down followed by a mouse up */
- term_mouse(term, b,
+ term_mouse(term, b,
translate_button(b),
MA_CLICK,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), shift_pressed,
control_pressed, is_alt_pressed());
MA_CLICK,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), shift_pressed,
control_pressed, is_alt_pressed());
- term_mouse(term, b, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
+ term_mouse(term, b, translate_button(b),
+ MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)), shift_pressed,
control_pressed, is_alt_pressed());
} else {
TO_CHR_Y(Y_POS(lParam)), shift_pressed,
control_pressed, is_alt_pressed());
} else {
@@
-2793,8
+2798,10
@@
void do_text(Context ctx, int x, int y, char *text, int len,
if ((attr & CSET_MASK) == ATTR_OEMCP)
nfont |= FONT_OEM;
if ((attr & CSET_MASK) == ATTR_OEMCP)
nfont |= FONT_OEM;
- nfg = 2 * ((attr & ATTR_FGMASK) >> ATTR_FGSHIFT);
- nbg = 2 * ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT);
+ nfg = ((attr & ATTR_FGMASK) >> ATTR_FGSHIFT);
+ nfg = 2 * (nfg & 0xF) + (nfg & 0x10 ? 1 : 0);
+ nbg = ((attr & ATTR_BGMASK) >> ATTR_BGSHIFT);
+ nbg = 2 * (nbg & 0xF) + (nbg & 0x10 ? 1 : 0);
if (bold_mode == BOLD_FONT && (attr & ATTR_BOLD))
nfont |= FONT_BOLD;
if (und_mode == UND_FONT && (attr & ATTR_UNDER))
if (bold_mode == BOLD_FONT && (attr & ATTR_BOLD))
nfont |= FONT_BOLD;
if (und_mode == UND_FONT && (attr & ATTR_UNDER))
@@
-2816,9
+2823,9
@@
void do_text(Context ctx, int x, int y, char *text, int len,
nbg = t;
}
if (bold_mode == BOLD_COLOURS && (attr & ATTR_BOLD))
nbg = t;
}
if (bold_mode == BOLD_COLOURS && (attr & ATTR_BOLD))
- nfg
++
;
+ nfg
|= 1
;
if (bold_mode == BOLD_COLOURS && (attr & ATTR_BLINK))
if (bold_mode == BOLD_COLOURS && (attr & ATTR_BLINK))
- nbg
++
;
+ nbg
|= 1
;
fg = colours[nfg];
bg = colours[nbg];
SelectObject(hdc, fonts[nfont]);
fg = colours[nfg];
bg = colours[nbg];
SelectObject(hdc, fonts[nfont]);