BUTTON1_RELEASED,NULL)); assert(has_mouse()); assert(166==mouseinterval(1)); refresh(); for(...

问题描述 投票:0回答:1
ncurses
  initscr();
  cbreak();
  noecho();
  assert(OK==keypad(stdscr,TRUE));   
  mousemask(BUTTON1_PRESSED|BUTTON1_RELEASED,NULL));
  assert(has_mouse());
  assert(166==mouseinterval(1));
  refresh();
  for(;;){
    int ch=wgetch(stdscr);
    // Detect mouse event and print coordinates
  }  
  endwin();

has to be configured (compile-time) to work with systemctl start gpmgpm

. If you compiled it yourself, that may not be configured. If you are commenting on a prebuilt package, your question should include relevant information (system and package version).

A comment points to
mouseevent ncurses
1个回答
1
投票

gpm. The gpm feature is not enabled by default (hint: the

file shows the feature as ), and lacking other clues, is unlikely to be part of the package, unless the development package for gpm happened to be installed on the build-server.A further comment mentions midnight commander. Whether or not it actually uses ncurses midnight commander has not used ncurses' mouse support for quite a while. Some of that is discussed in INSTALLcomments on ncurses versus slang (S-Lang)--with-gpmYou could make this work (ncurses+gpm) either by compiling the package yourself (using

, taking care to have the development headers and libraries installed), or possibly a bug report to Arch might get that changed. 在终端仿真器(alacritty)中,点击左键后,鼠标坐标会正常报告。但是,如果我 然后在tty(vt)中运行,无论鼠标在哪里点击都没有任何反应。怎样才能让它在tty(vt)中也能运行?

--with-gpminitscr(); cbreak(); noecho(); assert(OK===keypad(stdscr,TRUE)); mousemask(BUTTON1_PRESSED)

© www.soinside.com 2019 - 2024. All rights reserved.