Lines Matching refs:Selmouse
96 /* The `selmouse' structure extends the `mouse' structure adding all fields
98 struct selmouse {
126 static struct selmouse Selmouse;
168 (void)memset(&Selmouse, 0, sizeof(struct selmouse));
169 Selmouse.sm_mouse = m;
172 Selmouse.sm_slowdown_x = block_get_propval_int(conf, "slowdown_x", 0);
173 Selmouse.sm_slowdown_y = block_get_propval_int(conf, "slowdown_y", 3);
175 Selmouse.sm_but_select = 2;
176 Selmouse.sm_but_paste = 0;
178 Selmouse.sm_but_select = 0;
179 Selmouse.sm_but_paste = 2;
183 (void)ioctl(Selmouse.sm_mouse->m_statfd, WSDISPLAYIO_GETACTIVESCREEN,
185 Selmouse.sm_ttyfd = -1;
190 if (ioctl(Selmouse.sm_ttyfd, WSDISPLAYIO_GETWSCHAR, &ch) < 0) {
191 (void)close(Selmouse.sm_ttyfd);
196 assert(Selmouse.sm_max_y != 0); /* Initialized by open_tty above. */
197 assert(Selmouse.sm_max_x != 0); /* Initialized by open_tty above. */
198 Selmouse.sm_y = Selmouse.sm_max_y / 2;
199 Selmouse.sm_x = Selmouse.sm_max_x / 2;
200 Selmouse.sm_count_y = 0;
201 Selmouse.sm_count_x = 0;
202 Selmouse.sm_visible = 0;
203 Selmouse.sm_selecting = 0;
217 if (Selmouse.sm_ttyfd >= 0)
218 (void)close(Selmouse.sm_ttyfd);
230 const struct wsmouse_calibcoords *abs = &Selmouse.sm_mouse->m_calib;
233 if (Selmouse.sm_selecting)
239 if (Selmouse.sm_count_x >= Selmouse.sm_slowdown_x) {
240 Selmouse.sm_count_x = 0;
242 Selmouse.sm_x++;
243 else if (Selmouse.sm_x != 0)
244 Selmouse.sm_x--;
245 if (Selmouse.sm_x > Selmouse.sm_max_x)
246 Selmouse.sm_x = Selmouse.sm_max_x;
248 Selmouse.sm_count_x++;
252 if (Selmouse.sm_count_y >= Selmouse.sm_slowdown_y) {
253 Selmouse.sm_count_y = 0;
255 Selmouse.sm_y++;
256 else if (Selmouse.sm_y != 0)
257 Selmouse.sm_y--;
258 if (Selmouse.sm_y > Selmouse.sm_max_y)
259 Selmouse.sm_y = Selmouse.sm_max_y;
261 Selmouse.sm_count_y++;
269 if (!Selmouse.sm_mouse->m_doabs)
271 /* max x is inclusive in both selmouse and tpcalib */
272 Selmouse.sm_x
273 = ((evt.value - abs->minx) * (Selmouse.sm_max_x + 1))
278 if (!Selmouse.sm_mouse->m_doabs)
280 /* max y is inclusive in both selmouse and tpcalib */
281 Selmouse.sm_y
282 = ((evt.value - abs->miny) * (Selmouse.sm_max_y + 1))
294 if (Selmouse.sm_selecting)
301 if (evt.value == Selmouse.sm_but_select) {
309 if (evt.value == Selmouse.sm_but_select) {
314 } else if (evt.value == Selmouse.sm_but_paste) {
337 if (Selmouse.sm_selecting)
341 if (!Selmouse.sm_mouse->m_disabled)
345 if (Selmouse.sm_selecting)
361 if (!Selmouse.sm_selecting)
372 if (Selmouse.sm_visible) {
373 char_invert(Selmouse.sm_y, Selmouse.sm_x);
374 Selmouse.sm_visible = 0;
385 if (!Selmouse.sm_visible) {
386 char_invert(Selmouse.sm_y, Selmouse.sm_x);
387 Selmouse.sm_visible = 1;
402 if (Selmouse.sm_ttyfd >= 0)
403 (void)close(Selmouse.sm_ttyfd);
406 Selmouse.sm_ttyfd = open(buf, O_RDONLY | O_NONBLOCK);
407 if (Selmouse.sm_ttyfd < 0)
411 if (ioctl(Selmouse.sm_ttyfd, TIOCGWINSZ, &ws) < 0) {
415 Selmouse.sm_max_y = 24;
416 Selmouse.sm_max_x = 79;
418 Selmouse.sm_max_y = ws.ws_row - 1;
419 Selmouse.sm_max_x = ws.ws_col - 1;
424 if (Selmouse.sm_x > Selmouse.sm_max_x)
425 Selmouse.sm_x = Selmouse.sm_max_x;
426 if (Selmouse.sm_y > Selmouse.sm_max_y)
427 Selmouse.sm_y = Selmouse.sm_max_y;
443 if (ioctl(Selmouse.sm_ttyfd, WSDISPLAYIO_GETWSCHAR, &ch) == -1) {
452 if (ioctl(Selmouse.sm_ttyfd, WSDISPLAYIO_PUTWSCHAR, &ch) == -1)
482 if (ioctl(Selmouse.sm_ttyfd, WSDISPLAYIO_GETWSCHAR,
502 ch.col = Selmouse.sm_max_x;
505 if (ioctl(Selmouse.sm_ttyfd, WSDISPLAYIO_GETWSCHAR, &ch) == -1)
597 Selarea.sa_y1 = Selmouse.sm_y;
598 Selarea.sa_x1 = Selmouse.sm_x;
600 Selmouse.sm_selecting = 1;
626 Selmouse.sm_selecting = 0;
637 i = Selmouse.sm_max_x + 1;
638 Selarea.sa_y2 = Selmouse.sm_y;
639 Selarea.sa_x2 = Selmouse.sm_x;
657 size_t xres = Selmouse.sm_max_x + 1;
703 if (ioctl(Selmouse.sm_ttyfd, TIOCSTI,