1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge branch 'wheel'

This commit is contained in:
James Booth 2012-11-25 17:43:04 +00:00
commit 529a31904c
3 changed files with 49 additions and 2 deletions

View File

@ -12,6 +12,12 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
# Checks for programs.
AC_PROG_CC
# get canonical host
AC_CANONICAL_HOST
if test "$host_os" == "cygwin"; then
AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])
fi
# Options
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2], [link with libxml2 instead of expat])])

View File

@ -417,7 +417,7 @@ static int
_printable(const int ch)
{
return (ch != ERR && ch != '\n' &&
ch != KEY_PPAGE && ch != KEY_NPAGE &&
ch != KEY_PPAGE && ch != KEY_NPAGE && ch != KEY_MOUSE &&
ch != KEY_F(1) && ch != KEY_F(2) && ch != KEY_F(3) &&
ch != KEY_F(4) && ch != KEY_F(5) && ch != KEY_F(6) &&
ch != KEY_F(7) && ch != KEY_F(8) && ch != KEY_F(9) &&

View File

@ -108,6 +108,13 @@ gui_init(void)
raw();
keypad(stdscr, TRUE);
#ifdef PLATFORM_CYGWIN
mousemask(BUTTON5_PRESSED | BUTTON4_PRESSED, NULL);
#else
mousemask(BUTTON2_PRESSED | BUTTON4_PRESSED, NULL);
#endif
mouseinterval(5);
win_load_colours();
refresh();
@ -1816,8 +1823,42 @@ _win_handle_page(const int * const ch)
int page_space = rows - 4;
int *page_start = &(current->y_pos);
MEVENT mouse_event;
if (*ch == KEY_MOUSE) {
if (getmouse(&mouse_event) == OK) {
#ifdef PLATFORM_CYGWIN
if (mouse_event.bstate & BUTTON5_PRESSED) { // mouse wheel down
#else
if (mouse_event.bstate & BUTTON2_PRESSED) { // mouse wheel down
#endif
*page_start += 4;
// only got half a screen, show full screen
if ((y - (*page_start)) < page_space)
*page_start = y - page_space;
// went past end, show full screen
else if (*page_start >= y)
*page_start = y - page_space;
current->paged = 1;
dirty = TRUE;
} else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up
*page_start -= 4;
// went past beginning, show first page
if (*page_start < 0)
*page_start = 0;
current->paged = 1;
dirty = TRUE;
}
}
// page up
if (*ch == KEY_PPAGE) {
} else if (*ch == KEY_PPAGE) {
*page_start -= page_space;
// went past beginning, show first page