Mercurial > hg > xemacs-beta
comparison lisp/mouse.el @ 286:57709be46d1b r21-0b41
Import from CVS: tag r21-0b41
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:03 +0200 |
parents | 558f606b08ae |
children | e11d67e05968 |
comparison
equal
deleted
inserted
replaced
285:9a3756523c1b | 286:57709be46d1b |
---|---|
947 ;; always sufficient but it seems to give something | 947 ;; always sufficient but it seems to give something |
948 ;; approaching a 99% success rate. Making it higher yet | 948 ;; approaching a 99% success rate. Making it higher yet |
949 ;; would help guarantee success with the price that the | 949 ;; would help guarantee success with the price that the |
950 ;; delay would start to become noticable. | 950 ;; delay would start to become noticable. |
951 ;; | 951 ;; |
952 (sit-for 0.15 t) | 952 (and (eq (console-type) 'x) |
953 (sit-for 0.15 t)) | |
953 (zmacs-activate-region))) | 954 (zmacs-activate-region))) |
954 ((or (eq 'x (console-type)) | 955 ((console-on-window-system-p) |
955 (eq 'mswindows (console-type))) | |
956 (if (= start end) | 956 (if (= start end) |
957 (disown-selection type) | 957 (disown-selection type) |
958 (if (consp default-mouse-track-extent) | 958 (if (consp default-mouse-track-extent) |
959 ;; own the rectangular region | 959 ;; own the rectangular region |
960 ;; this is a hack | 960 ;; this is a hack |
1047 ;; | 1047 ;; |
1048 ;; remove the existing selection to unclutter the display | 1048 ;; remove the existing selection to unclutter the display |
1049 (if (not adjust) | 1049 (if (not adjust) |
1050 (cond (zmacs-regions | 1050 (cond (zmacs-regions |
1051 (zmacs-deactivate-region)) | 1051 (zmacs-deactivate-region)) |
1052 ((eq 'x (console-type)) | 1052 ((console-on-window-system-p) |
1053 (x-disown-selection))))) | 1053 (disown-selection))))) |
1054 (setq default-mouse-track-down-event nil)))) | 1054 (setq default-mouse-track-down-event nil)))) |
1055 | 1055 |
1056 (defun default-mouse-track-down-hook (event click-count) | 1056 (defun default-mouse-track-down-hook (event click-count) |
1057 (setq default-mouse-track-down-event (copy-event event)) | 1057 (setq default-mouse-track-down-event (copy-event event)) |
1058 nil) | 1058 nil) |
1415 other mouse buttons." | 1415 other mouse buttons." |
1416 (interactive "e") | 1416 (interactive "e") |
1417 (if (not (specifier-instance vertical-divider-draggable-p | 1417 (if (not (specifier-instance vertical-divider-draggable-p |
1418 (event-window event))) | 1418 (event-window event))) |
1419 (error "Not over a window!")) | 1419 (error "Not over a window!")) |
1420 (letf* ((window (event-window event)) | 1420 (with-specifier-instance |
1421 (frame (event-channel event)) | 1421 vertical-divider-shadow-thickness |
1422 (last-timestamp (event-timestamp event)) | 1422 (- (specifier-instance vertical-divider-shadow-thickness |
1423 (doit t) | 1423 (event-window event))) |
1424 ((specifier-instance vertical-divider-shadow-thickness window) | 1424 (event-window event) |
1425 (- (specifier-instance vertical-divider-shadow-thickness window)))) | 1425 (let* ((window (event-window event)) |
1426 (while doit | 1426 (frame (event-channel event)) |
1427 (let ((old-right (caddr (window-pixel-edges window))) | 1427 (last-timestamp (event-timestamp event)) |
1428 (old-left (car (window-pixel-edges window))) | 1428 (doit t)) |
1429 (backup-conf (current-window-configuration frame)) | 1429 (while doit |
1430 (old-edges-all-windows (mapcar 'window-pixel-edges (window-list)))) | 1430 (let ((old-right (caddr (window-pixel-edges window))) |
1431 | 1431 (old-left (car (window-pixel-edges window))) |
1432 ;; This is borrowed from modeline.el: | 1432 (backup-conf (current-window-configuration frame)) |
1433 ;; requeue event and quit if this is a misc-user, eval or | 1433 (old-edges-all-windows (mapcar 'window-pixel-edges (window-list)))) |
1434 ;; keypress event. | 1434 |
1435 ;; quit if this is a button press or release event, or if the event | 1435 ;; This is borrowed from modeline.el: |
1436 ;; occurred in some other frame. | 1436 ;; requeue event and quit if this is a misc-user, eval or |
1437 ;; drag if this is a mouse motion event and the time | 1437 ;; keypress event. |
1438 ;; between this event and the last event is greater than | 1438 ;; quit if this is a button press or release event, or if the event |
1439 ;; drag-modeline-event-lag. | 1439 ;; occurred in some other frame. |
1440 ;; do nothing if this is any other kind of event. | 1440 ;; drag if this is a mouse motion event and the time |
1441 (setq event (next-event event)) | 1441 ;; between this event and the last event is greater than |
1442 (cond ((or (misc-user-event-p event) | 1442 ;; drag-modeline-event-lag. |
1443 (key-press-event-p event)) | 1443 ;; do nothing if this is any other kind of event. |
1444 (setq unread-command-events (nconc unread-command-events | 1444 (setq event (next-event event)) |
1445 (list event)) | 1445 (cond ((or (misc-user-event-p event) |
1446 doit nil)) | 1446 (key-press-event-p event)) |
1447 ((button-release-event-p event) | 1447 (setq unread-command-events (nconc unread-command-events |
1448 (setq doit nil)) | 1448 (list event)) |
1449 ((button-event-p event) | 1449 doit nil)) |
1450 (setq doit nil)) | 1450 ((button-release-event-p event) |
1451 ((not (motion-event-p event)) | 1451 (setq doit nil)) |
1452 (dispatch-event event)) | 1452 ((button-event-p event) |
1453 ((not (eq frame (event-frame event))) | 1453 (setq doit nil)) |
1454 (setq doit nil)) | 1454 ((not (motion-event-p event)) |
1455 ((< (abs (- (event-timestamp event) last-timestamp)) | 1455 (dispatch-event event)) |
1456 drag-modeline-event-lag)) | 1456 ((not (eq frame (event-frame event))) |
1457 (t | 1457 (setq doit nil)) |
1458 (setq last-timestamp (event-timestamp event)) | 1458 ((< (abs (- (event-timestamp event) last-timestamp)) |
1459 ;; Enlarge the window, calculating change in characters | 1459 drag-modeline-event-lag)) |
1460 ;; of default font. Do not let the window to become | 1460 (t |
1461 ;; less than alolwed minimum (not because that's critical | 1461 (setq last-timestamp (event-timestamp event)) |
1462 ;; for the code performance, just the visual effect is | 1462 ;; Enlarge the window, calculating change in characters |
1463 ;; better: when cursor goes to the left of the next left | 1463 ;; of default font. Do not let the window to become |
1464 ;; divider, the vindow being resized shrinks to minimal | 1464 ;; less than alolwed minimum (not because that's critical |
1465 ;; size. | 1465 ;; for the code performance, just the visual effect is |
1466 (enlarge-window (max (- window-min-width (window-width window)) | 1466 ;; better: when cursor goes to the left of the next left |
1467 (/ (- (event-x-pixel event) old-right) | 1467 ;; divider, the vindow being resized shrinks to minimal |
1468 (face-width 'default window))) | 1468 ;; size. |
1469 t window) | 1469 (enlarge-window (max (- window-min-width (window-width window)) |
1470 ;; Backout the change if some windows got deleted, or | 1470 (/ (- (event-x-pixel event) old-right) |
1471 ;; if the change caused more than two windows to resize | 1471 (face-width 'default window))) |
1472 ;; (shifting the whole stack right is ugly), or if the | 1472 t window) |
1473 ;; left window side has slipped (right side cannot be | 1473 ;; Backout the change if some windows got deleted, or |
1474 ;; moved any funrther to the right, so enlarge-window | 1474 ;; if the change caused more than two windows to resize |
1475 ;; plays bad games with the left edge. | 1475 ;; (shifting the whole stack right is ugly), or if the |
1476 (if (or (/= (count-windows) (length old-edges-all-windows)) | 1476 ;; left window side has slipped (right side cannot be |
1477 (/= old-left (car (window-pixel-edges window))) | 1477 ;; moved any funrther to the right, so enlarge-window |
1478 ;; This check is very hairy. We allow any number | 1478 ;; plays bad games with the left edge. |
1479 ;; of left edges to change, but only to the same | 1479 (if (or (/= (count-windows) (length old-edges-all-windows)) |
1480 ;; new value. Similar procedure is for the right edges. | 1480 (/= old-left (car (window-pixel-edges window))) |
1481 (let ((all-that-bad nil) | 1481 ;; This check is very hairy. We allow any number |
1482 (new-left-ok nil) | 1482 ;; of left edges to change, but only to the same |
1483 (new-right-ok nil)) | 1483 ;; new value. Similar procedure is for the right edges. |
1484 (mapcar* (lambda (window old-edges) | 1484 (let ((all-that-bad nil) |
1485 (let ((new (car (window-pixel-edges window)))) | 1485 (new-left-ok nil) |
1486 (if (/= new (car old-edges)) | 1486 (new-right-ok nil)) |
1487 (if (and new-left-ok | 1487 (mapcar* (lambda (window old-edges) |
1488 (/= new-left-ok new)) | 1488 (let ((new (car (window-pixel-edges window)))) |
1489 (setq all-that-bad t) | 1489 (if (/= new (car old-edges)) |
1490 (setq new-left-ok new))))) | 1490 (if (and new-left-ok |
1491 (window-list) old-edges-all-windows) | 1491 (/= new-left-ok new)) |
1492 (mapcar* (lambda (window old-edges) | 1492 (setq all-that-bad t) |
1493 (let ((new (caddr (window-pixel-edges window)))) | 1493 (setq new-left-ok new))))) |
1494 (if (/= new (caddr old-edges)) | 1494 (window-list) old-edges-all-windows) |
1495 (if (and new-right-ok | 1495 (mapcar* (lambda (window old-edges) |
1496 (/= new-right-ok new)) | 1496 (let ((new (caddr (window-pixel-edges window)))) |
1497 (setq all-that-bad t) | 1497 (if (/= new (caddr old-edges)) |
1498 (setq new-right-ok new))))) | 1498 (if (and new-right-ok |
1499 (window-list) old-edges-all-windows) | 1499 (/= new-right-ok new)) |
1500 all-that-bad)) | 1500 (setq all-that-bad t) |
1501 (set-window-configuration backup-conf)))) | 1501 (setq new-right-ok new))))) |
1502 )))) | 1502 (window-list) old-edges-all-windows) |
1503 all-that-bad)) | |
1504 (set-window-configuration backup-conf)))) | |
1505 ))))) | |
1503 | 1506 |
1504 (setq vertical-divider-map (make-keymap)) | 1507 (setq vertical-divider-map (make-keymap)) |
1505 (define-key vertical-divider-map 'button1 'drag-window-divider) | 1508 (define-key vertical-divider-map 'button1 'drag-window-divider) |
1506 | 1509 |
1507 ;;; mouse.el ends here | 1510 ;;; mouse.el ends here |