Call menu using mouse for all panel types.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
aa601f831b
Коммит
15354fdbb4
35
src/info.c
35
src/info.c
@ -25,21 +25,25 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#include "../src/tty/tty.h"
|
#include "../src/tty/tty.h"
|
||||||
|
#include "../src/tty/key.h" /* is_idle() */
|
||||||
#include "../src/tty/mouse.h" /* Gpm_Event */
|
#include "../src/tty/mouse.h" /* Gpm_Event */
|
||||||
#include "../src/tty/color.h"
|
#include "../src/tty/color.h"
|
||||||
|
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "widget.h" /* default_proc*/
|
#include "widget.h" /* default_proc*/
|
||||||
#include "info.h"
|
#include "main-widgets.h" /* the_menubar*/
|
||||||
#include "dir.h" /* required by panel */
|
#include "dir.h" /* required by panel */
|
||||||
#include "panel.h" /* for the panel structure */
|
#include "panel.h" /* for the panel structure */
|
||||||
#include "main.h" /* other_panel, current_panel definitions */
|
#include "main.h" /* other_panel, current_panel definitions */
|
||||||
|
#include "menu.h" /* menubar_visible */
|
||||||
#include "util.h" /* size_trunc_len */
|
#include "util.h" /* size_trunc_len */
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "../src/tty/key.h" /* is_idle() */
|
|
||||||
#include "mountlist.h"
|
#include "mountlist.h"
|
||||||
#include "unixcompat.h"
|
#include "unixcompat.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
|
#include "info.h"
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
# define VERSION "undefined"
|
# define VERSION "undefined"
|
||||||
@ -51,7 +55,7 @@ struct WInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Have we called the init_my_statfs routine? */
|
/* Have we called the init_my_statfs routine? */
|
||||||
static int initialized;
|
static gboolean initialized = FALSE;
|
||||||
static struct my_statfs myfs_stats;
|
static struct my_statfs myfs_stats;
|
||||||
|
|
||||||
static void info_box (Dlg_head *h, struct WInfo *info)
|
static void info_box (Dlg_head *h, struct WInfo *info)
|
||||||
@ -265,18 +269,33 @@ info_callback (Widget *w, widget_msg_t msg, int parm)
|
|||||||
return default_proc (msg, parm);
|
return default_proc (msg, parm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WInfo *info_new ()
|
static int
|
||||||
|
info_event (Gpm_Event *event, void *data)
|
||||||
|
{
|
||||||
|
Widget *w = &((WInfo *) data)->widget;
|
||||||
|
|
||||||
|
/* rest of the upper frame, the menu is invisible - call menu */
|
||||||
|
if (event->type & GPM_DOWN && event->y == 1 && !menubar_visible) {
|
||||||
|
event->x += w->x;
|
||||||
|
return the_menubar->widget.mouse (event, the_menubar);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MOU_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
WInfo *
|
||||||
|
info_new (void)
|
||||||
{
|
{
|
||||||
struct WInfo *info = g_new (struct WInfo, 1);
|
struct WInfo *info = g_new (struct WInfo, 1);
|
||||||
|
|
||||||
init_widget (&info->widget, 0, 0, 0, 0, info_callback, NULL);
|
init_widget (&info->widget, 0, 0, 0, 0, info_callback, info_event);
|
||||||
|
|
||||||
/* We do not want the cursor */
|
/* We do not want the cursor */
|
||||||
widget_want_cursor (info->widget, 0);
|
widget_want_cursor (info->widget, 0);
|
||||||
|
|
||||||
if (!initialized){
|
if (!initialized) {
|
||||||
initialized = 1;
|
initialized = TRUE;
|
||||||
init_my_statfs ();
|
init_my_statfs ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#define MC_INFO_H
|
#define MC_INFO_H
|
||||||
|
|
||||||
struct WInfo;
|
struct WInfo;
|
||||||
struct WInfo *info_new (void);
|
typedef struct WInfo WInfo;
|
||||||
|
|
||||||
|
WInfo *info_new (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
43
src/screen.c
43
src/screen.c
@ -2520,20 +2520,11 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir)
|
|||||||
|
|
||||||
int my_index;
|
int my_index;
|
||||||
|
|
||||||
/* Mouse wheel events */
|
/* rest of the upper frame, the menu is invisible - call menu */
|
||||||
if ((event->buttons & GPM_B_UP) && (event->type & GPM_DOWN)) {
|
if (event->type & GPM_DOWN && event->y == 1 && !menubar_visible) {
|
||||||
if (panel->top_file > 0)
|
*redir = 1;
|
||||||
prev_page (panel);
|
event->x += panel->widget.x;
|
||||||
else /* We are in first page */
|
return (*(the_menubar->widget.mouse)) (event, the_menubar);
|
||||||
move_up (panel);
|
|
||||||
return MOU_NORMAL;
|
|
||||||
}
|
|
||||||
if ((event->buttons & GPM_B_DOWN) && (event->type & GPM_DOWN)) {
|
|
||||||
if (panel->top_file + ITEMS (panel) < panel->count)
|
|
||||||
next_page (panel);
|
|
||||||
else /* We are in last page */
|
|
||||||
move_down (panel);
|
|
||||||
return MOU_NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "<" button */
|
/* "<" button */
|
||||||
@ -2556,16 +2547,24 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir)
|
|||||||
return MOU_NORMAL;
|
return MOU_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rest of the upper frame, the menu is invisible - call menu */
|
/* Mouse wheel events */
|
||||||
if (event->type & GPM_DOWN && event->y == 1 && !menubar_visible) {
|
if ((event->buttons & GPM_B_UP) && (event->type & GPM_DOWN)) {
|
||||||
*redir = 1;
|
if (panel->top_file > 0)
|
||||||
event->x += panel->widget.x;
|
prev_page (panel);
|
||||||
return (*(the_menubar->widget.mouse)) (event, the_menubar);
|
else /* We are in first page */
|
||||||
|
move_up (panel);
|
||||||
|
return MOU_NORMAL;
|
||||||
|
}
|
||||||
|
if ((event->buttons & GPM_B_DOWN) && (event->type & GPM_DOWN)) {
|
||||||
|
if (panel->top_file + ITEMS (panel) < panel->count)
|
||||||
|
next_page (panel);
|
||||||
|
else /* We are in last page */
|
||||||
|
move_down (panel);
|
||||||
|
return MOU_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
event->y -= 2;
|
event->y -= 2;
|
||||||
if ((event->type & (GPM_DOWN | GPM_DRAG))) {
|
if ((event->type & (GPM_DOWN | GPM_DRAG))) {
|
||||||
|
|
||||||
if (!dlg_widget_active (panel))
|
if (!dlg_widget_active (panel))
|
||||||
change_panel ();
|
change_panel ();
|
||||||
|
|
||||||
@ -2587,6 +2586,7 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir)
|
|||||||
move_down (panel);
|
move_down (panel);
|
||||||
return MOU_REPEAT;
|
return MOU_REPEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_index = panel->top_file + event->y - 1;
|
my_index = panel->top_file + event->y - 1;
|
||||||
if (panel->split) {
|
if (panel->split) {
|
||||||
if (event->x > ((panel->widget.cols - 2) / 2))
|
if (event->x > ((panel->widget.cols - 2) / 2))
|
||||||
@ -2604,7 +2604,6 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir)
|
|||||||
|
|
||||||
/* This one is new */
|
/* This one is new */
|
||||||
mark_if_marking (panel, event);
|
mark_if_marking (panel, event);
|
||||||
|
|
||||||
} else if ((event->type & (GPM_UP | GPM_DOUBLE)) ==
|
} else if ((event->type & (GPM_UP | GPM_DOUBLE)) ==
|
||||||
(GPM_UP | GPM_DOUBLE)) {
|
(GPM_UP | GPM_DOUBLE)) {
|
||||||
if (event->y > 0 && event->y <= lines)
|
if (event->y > 0 && event->y <= lines)
|
||||||
@ -2619,7 +2618,7 @@ panel_event (Gpm_Event *event, void *data)
|
|||||||
{
|
{
|
||||||
WPanel *panel = data;
|
WPanel *panel = data;
|
||||||
int ret;
|
int ret;
|
||||||
int redir = 0;
|
int redir = MOU_NORMAL;
|
||||||
|
|
||||||
ret = do_panel_event (event, panel, &redir);
|
ret = do_panel_event (event, panel, &redir);
|
||||||
if (!redir)
|
if (!redir)
|
||||||
|
13
src/tree.c
13
src/tree.c
@ -51,13 +51,15 @@
|
|||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "panel.h"
|
#include "panel.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "file.h" /* For copy_dir_dir(), move_dir_dir(), erase_dir() */
|
#include "main-widgets.h" /* the_menubar */
|
||||||
|
#include "menu.h" /* menubar_visible */
|
||||||
|
#include "file.h" /* copy_dir_dir(), move_dir_dir(), erase_dir() */
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
#include "tree.h"
|
|
||||||
#include "treestore.h"
|
#include "treestore.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
|
#include "tree.h"
|
||||||
|
|
||||||
#define tlines(t) (t->is_panel ? t->widget.lines-2 - (show_mini_info ? 2 : 0) : t->widget.lines)
|
#define tlines(t) (t->is_panel ? t->widget.lines-2 - (show_mini_info ? 2 : 0) : t->widget.lines)
|
||||||
|
|
||||||
@ -496,6 +498,13 @@ event_callback (Gpm_Event *event, void *data)
|
|||||||
{
|
{
|
||||||
WTree *tree = data;
|
WTree *tree = data;
|
||||||
|
|
||||||
|
/* rest of the upper frame, the menu is invisible - call menu */
|
||||||
|
if (tree->is_panel && (event->type & GPM_DOWN)
|
||||||
|
&& event->y == 1 && !menubar_visible) {
|
||||||
|
event->x += tree->widget.x;
|
||||||
|
return the_menubar->widget.mouse (event, the_menubar);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(event->type & GPM_UP))
|
if (!(event->type & GPM_UP))
|
||||||
return MOU_NORMAL;
|
return MOU_NORMAL;
|
||||||
|
|
||||||
|
@ -40,10 +40,15 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "../src/global.h"
|
#include "../src/global.h"
|
||||||
|
|
||||||
|
#include "../src/tty/tty.h"
|
||||||
|
|
||||||
#include "../src/strutil.h"
|
#include "../src/strutil.h"
|
||||||
#include "../src/main.h"
|
#include "../src/main.h"
|
||||||
#include "../src/charsets.h"
|
#include "../src/charsets.h"
|
||||||
#include "../src/tty/tty.h"
|
#include "../src/main-widgets.h" /* the_menubar */
|
||||||
|
#include "../src/menu.h" /* menubar_visible */
|
||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mcviewer.h"
|
#include "mcviewer.h"
|
||||||
|
|
||||||
@ -80,12 +85,20 @@ int mcview_mouse_move_pages = 1;
|
|||||||
|
|
||||||
/* Both views */
|
/* Both views */
|
||||||
static int
|
static int
|
||||||
mcview_event (mcview_t * view, Gpm_Event * event, int *result)
|
mcview_event (mcview_t *view, Gpm_Event *event, int *result)
|
||||||
{
|
{
|
||||||
screen_dimen y, x;
|
screen_dimen y, x;
|
||||||
|
|
||||||
*result = MOU_NORMAL;
|
*result = MOU_NORMAL;
|
||||||
|
|
||||||
|
/* rest of the upper frame, the menu is invisible - call menu */
|
||||||
|
if (mcview_is_in_panel (view) && (event->type & GPM_DOWN)
|
||||||
|
&& event->y == 1 && !menubar_visible) {
|
||||||
|
event->x += view->widget.x;
|
||||||
|
*result = the_menubar->widget.mouse (event, the_menubar);
|
||||||
|
return 0; /* don't draw viewer over menu */
|
||||||
|
}
|
||||||
|
|
||||||
/* We are not interested in the release events */
|
/* We are not interested in the release events */
|
||||||
if (!(event->type & (GPM_DOWN | GPM_DRAG)))
|
if (!(event->type & (GPM_DOWN | GPM_DRAG)))
|
||||||
return 0;
|
return 0;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user