diff options
| author | Dmitry Antipov | 2014-05-28 17:53:22 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-05-28 17:53:22 +0400 |
| commit | 2b5113740643a2243e56d0878e179aef634adf38 (patch) | |
| tree | 22db63baeac1dc08bb339873d96b725c5d870965 /src/xterm.c | |
| parent | 8e6abb850674e59f5aba56bb28edade1a2ac0b47 (diff) | |
| download | emacs-2b5113740643a2243e56d0878e179aef634adf38.tar.gz emacs-2b5113740643a2243e56d0878e179aef634adf38.zip | |
Refactor mouse positioning stuff to avoid code duplication.
* frame.h (frame_char_to_pixel_position): New function.
(x_set_mouse_position): Rename to...
(frame_set_mouse_position): ...new function.
(frame_set_mouse_pixel_position): Add prototype.
* nsterm.m, w32term.c, xterm.c (x_set_mouse_pixel_position):
Rename to frame_set_mouse_pixel_position.
* frame.c (Fset_mouse_pixel_position, Fset_mouse_position):
Adjust users.
* xterm.h, w32term.h ( x_set_mouse_position)
(x_set_mouse_pixel_position): Remove prototypes.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/src/xterm.c b/src/xterm.c index ed5d0382eae..83d3cb1ab73 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8735,34 +8735,11 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b | |||
| 8735 | 8735 | ||
| 8736 | unblock_input (); | 8736 | unblock_input (); |
| 8737 | } | 8737 | } |
| 8738 | |||
| 8739 | /* Mouse warping. */ | ||
| 8740 | |||
| 8741 | void | ||
| 8742 | x_set_mouse_position (struct frame *f, int x, int y) | ||
| 8743 | { | ||
| 8744 | int pix_x, pix_y; | ||
| 8745 | |||
| 8746 | pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2; | ||
| 8747 | pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2; | ||
| 8748 | |||
| 8749 | if (pix_x < 0) pix_x = 0; | ||
| 8750 | if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f); | ||
| 8751 | |||
| 8752 | if (pix_y < 0) pix_y = 0; | ||
| 8753 | if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); | ||
| 8754 | |||
| 8755 | block_input (); | ||
| 8756 | |||
| 8757 | XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), | ||
| 8758 | 0, 0, 0, 0, pix_x, pix_y); | ||
| 8759 | unblock_input (); | ||
| 8760 | } | ||
| 8761 | 8738 | ||
| 8762 | /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ | 8739 | /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ |
| 8763 | 8740 | ||
| 8764 | void | 8741 | void |
| 8765 | x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | 8742 | frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) |
| 8766 | { | 8743 | { |
| 8767 | block_input (); | 8744 | block_input (); |
| 8768 | 8745 | ||