diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/nsfns.m | 8 | ||||
| -rw-r--r-- | src/nsterm.h | 8 | ||||
| -rw-r--r-- | src/nsterm.m | 90 |
4 files changed, 53 insertions, 67 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1fb2c7b00a1..a66026fa091 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2014-10-30 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.h (EmacsScroller): Replace Lisp_Object win with | ||
| 4 | struct window* (Bug#18889). | ||
| 5 | Remove getMouseMotionPart. | ||
| 6 | (ns_output): Make icon_top/left int. | ||
| 7 | |||
| 8 | * nsfns.m (x_icon): icon_top/left is int. | ||
| 9 | |||
| 10 | * nsterm.m (ns_mouse_position): Remove unused code. | ||
| 11 | (initFrame:window:, dealloc): Use window instead of win. | ||
| 12 | (getMouseMotionPart:window:x:y:): Remove, unused. | ||
| 13 | (sendScrollEventAtLoc:fromEvent:): Make Lisp_Object win from window. | ||
| 14 | |||
| 1 | 2014-10-30 Samuel Bronson <naesten@gmail.com> | 15 | 2014-10-30 Samuel Bronson <naesten@gmail.com> |
| 2 | 16 | ||
| 3 | * unexmacosx.c (copy_data_segment): Port to GCC 4.6+ (Bug#9927). | 17 | * unexmacosx.c (copy_data_segment): Port to GCC 4.6+ (Bug#9927). |
diff --git a/src/nsfns.m b/src/nsfns.m index 58746aed9fa..9d9f5416c86 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -913,8 +913,8 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 913 | Lisp_Object icon_x, icon_y; | 913 | Lisp_Object icon_x, icon_y; |
| 914 | struct ns_display_info *dpyinfo = check_ns_display_info (Qnil); | 914 | struct ns_display_info *dpyinfo = check_ns_display_info (Qnil); |
| 915 | 915 | ||
| 916 | f->output_data.ns->icon_top = Qnil; | 916 | f->output_data.ns->icon_top = -1; |
| 917 | f->output_data.ns->icon_left = Qnil; | 917 | f->output_data.ns->icon_left = -1; |
| 918 | 918 | ||
| 919 | /* Set the position of the icon. */ | 919 | /* Set the position of the icon. */ |
| 920 | icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); | 920 | icon_x = x_get_arg (dpyinfo, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); |
| @@ -923,8 +923,8 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 923 | { | 923 | { |
| 924 | CHECK_NUMBER (icon_x); | 924 | CHECK_NUMBER (icon_x); |
| 925 | CHECK_NUMBER (icon_y); | 925 | CHECK_NUMBER (icon_y); |
| 926 | f->output_data.ns->icon_top = icon_y; | 926 | f->output_data.ns->icon_top = XINT (icon_y); |
| 927 | f->output_data.ns->icon_left = icon_x; | 927 | f->output_data.ns->icon_left = XINT (icon_x); |
| 928 | } | 928 | } |
| 929 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | 929 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
| 930 | error ("Both left and top icon corners of icon must be specified"); | 930 | error ("Both left and top icon corners of icon must be specified"); |
diff --git a/src/nsterm.h b/src/nsterm.h index 8c3e4e5c314..a6081e8da57 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -393,7 +393,7 @@ typedef float EmacsCGFloat; | |||
| 393 | 393 | ||
| 394 | @interface EmacsScroller : NSScroller | 394 | @interface EmacsScroller : NSScroller |
| 395 | { | 395 | { |
| 396 | Lisp_Object win; | 396 | struct window *window; |
| 397 | struct frame *frame; | 397 | struct frame *frame; |
| 398 | NSResponder *prevResponder; | 398 | NSResponder *prevResponder; |
| 399 | 399 | ||
| @@ -418,8 +418,6 @@ typedef float EmacsCGFloat; | |||
| 418 | - setPosition: (int) position portion: (int) portion whole: (int) whole; | 418 | - setPosition: (int) position portion: (int) portion whole: (int) whole; |
| 419 | - (int) checkSamePosition: (int)position portion: (int)portion | 419 | - (int) checkSamePosition: (int)position portion: (int)portion |
| 420 | whole: (int)whole; | 420 | whole: (int)whole; |
| 421 | - (void) getMouseMotionPart: (int *)part window: (Lisp_Object *)window | ||
| 422 | x: (Lisp_Object *)x y: ( Lisp_Object *)y; | ||
| 423 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e; | 421 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e; |
| 424 | - repeatScroll: (NSTimer *)sender; | 422 | - repeatScroll: (NSTimer *)sender; |
| 425 | - condemn; | 423 | - condemn; |
| @@ -685,8 +683,8 @@ struct ns_output | |||
| 685 | value contains an ID of the fontset, else -1. */ | 683 | value contains an ID of the fontset, else -1. */ |
| 686 | int fontset; /* only used with font_backend */ | 684 | int fontset; /* only used with font_backend */ |
| 687 | 685 | ||
| 688 | Lisp_Object icon_top; | 686 | int icon_top; |
| 689 | Lisp_Object icon_left; | 687 | int icon_left; |
| 690 | 688 | ||
| 691 | /* The size of the extra width currently allotted for vertical | 689 | /* The size of the extra width currently allotted for vertical |
| 692 | scroll bars, in pixels. */ | 690 | scroll bars, in pixels. */ |
diff --git a/src/nsterm.m b/src/nsterm.m index 833b8e389a9..45c6214f0d0 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -1902,51 +1902,37 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 1902 | 1902 | ||
| 1903 | block_input (); | 1903 | block_input (); |
| 1904 | 1904 | ||
| 1905 | if (dpyinfo->last_mouse_scroll_bar != nil && insist == 0) | 1905 | /* Clear the mouse-moved flag for every frame on this display. */ |
| 1906 | { | 1906 | FOR_EACH_FRAME (tail, frame) |
| 1907 | /* TODO: we do not use this path at the moment because drag events will | 1907 | if (FRAME_NS_P (XFRAME (frame)) |
| 1908 | go directly to the EmacsScroller. Leaving code in for now. */ | 1908 | && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp)) |
| 1909 | [dpyinfo->last_mouse_scroll_bar | 1909 | XFRAME (frame)->mouse_moved = 0; |
| 1910 | getMouseMotionPart: (int *)part window: bar_window x: x y: y]; | 1910 | |
| 1911 | if (time) | 1911 | dpyinfo->last_mouse_scroll_bar = nil; |
| 1912 | *time = dpyinfo->last_mouse_movement_time; | 1912 | if (dpyinfo->last_mouse_frame |
| 1913 | dpyinfo->last_mouse_scroll_bar = nil; | 1913 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) |
| 1914 | } | 1914 | f = dpyinfo->last_mouse_frame; |
| 1915 | else | 1915 | else |
| 1916 | { | 1916 | f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME (); |
| 1917 | /* Clear the mouse-moved flag for every frame on this display. */ | ||
| 1918 | FOR_EACH_FRAME (tail, frame) | ||
| 1919 | if (FRAME_NS_P (XFRAME (frame)) | ||
| 1920 | && FRAME_NS_DISPLAY (XFRAME (frame)) == FRAME_NS_DISPLAY (*fp)) | ||
| 1921 | XFRAME (frame)->mouse_moved = 0; | ||
| 1922 | 1917 | ||
| 1923 | dpyinfo->last_mouse_scroll_bar = nil; | 1918 | if (f && FRAME_NS_P (f)) |
| 1924 | if (dpyinfo->last_mouse_frame | 1919 | { |
| 1925 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) | 1920 | view = FRAME_NS_VIEW (*fp); |
| 1926 | f = dpyinfo->last_mouse_frame; | ||
| 1927 | else | ||
| 1928 | f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame | ||
| 1929 | : SELECTED_FRAME (); | ||
| 1930 | |||
| 1931 | if (f && FRAME_NS_P (f)) | ||
| 1932 | { | ||
| 1933 | view = FRAME_NS_VIEW (*fp); | ||
| 1934 | 1921 | ||
| 1935 | position = [[view window] mouseLocationOutsideOfEventStream]; | 1922 | position = [[view window] mouseLocationOutsideOfEventStream]; |
| 1936 | position = [view convertPoint: position fromView: nil]; | 1923 | position = [view convertPoint: position fromView: nil]; |
| 1937 | remember_mouse_glyph (f, position.x, position.y, | 1924 | remember_mouse_glyph (f, position.x, position.y, |
| 1938 | &dpyinfo->last_mouse_glyph); | 1925 | &dpyinfo->last_mouse_glyph); |
| 1939 | /*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */ | 1926 | /*fprintf (stderr, "ns_mouse_position: %.0f, %.0f\n", position.x, position.y); */ |
| 1940 | 1927 | ||
| 1941 | if (bar_window) *bar_window = Qnil; | 1928 | if (bar_window) *bar_window = Qnil; |
| 1942 | if (part) *part = 0; /*scroll_bar_handle; */ | 1929 | if (part) *part = 0; /*scroll_bar_handle; */ |
| 1943 | 1930 | ||
| 1944 | if (x) XSETINT (*x, lrint (position.x)); | 1931 | if (x) XSETINT (*x, lrint (position.x)); |
| 1945 | if (y) XSETINT (*y, lrint (position.y)); | 1932 | if (y) XSETINT (*y, lrint (position.y)); |
| 1946 | if (time) | 1933 | if (time) |
| 1947 | *time = dpyinfo->last_mouse_movement_time; | 1934 | *time = dpyinfo->last_mouse_movement_time; |
| 1948 | *fp = f; | 1935 | *fp = f; |
| 1949 | } | ||
| 1950 | } | 1936 | } |
| 1951 | 1937 | ||
| 1952 | unblock_input (); | 1938 | unblock_input (); |
| @@ -7121,13 +7107,13 @@ if (cols > 0 && rows > 0) | |||
| 7121 | [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable]; | 7107 | [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable]; |
| 7122 | #endif | 7108 | #endif |
| 7123 | 7109 | ||
| 7124 | win = nwin; | 7110 | window = XWINDOW (nwin); |
| 7125 | condemned = NO; | 7111 | condemned = NO; |
| 7126 | pixel_height = NSHeight (r); | 7112 | pixel_height = NSHeight (r); |
| 7127 | if (pixel_height == 0) pixel_height = 1; | 7113 | if (pixel_height == 0) pixel_height = 1; |
| 7128 | min_portion = 20 / pixel_height; | 7114 | min_portion = 20 / pixel_height; |
| 7129 | 7115 | ||
| 7130 | frame = XFRAME (XWINDOW (win)->frame); | 7116 | frame = XFRAME (window->frame); |
| 7131 | if (FRAME_LIVE_P (frame)) | 7117 | if (FRAME_LIVE_P (frame)) |
| 7132 | { | 7118 | { |
| 7133 | int i; | 7119 | int i; |
| @@ -7165,8 +7151,9 @@ if (cols > 0 && rows > 0) | |||
| 7165 | - (void)dealloc | 7151 | - (void)dealloc |
| 7166 | { | 7152 | { |
| 7167 | NSTRACE (EmacsScroller_dealloc); | 7153 | NSTRACE (EmacsScroller_dealloc); |
| 7168 | if (!NILP (win)) | 7154 | if (window) |
| 7169 | wset_vertical_scroll_bar (XWINDOW (win), Qnil); | 7155 | wset_vertical_scroll_bar (window, Qnil); |
| 7156 | window = 0; | ||
| 7170 | [super dealloc]; | 7157 | [super dealloc]; |
| 7171 | } | 7158 | } |
| 7172 | 7159 | ||
| @@ -7265,30 +7252,17 @@ if (cols > 0 && rows > 0) | |||
| 7265 | return self; | 7252 | return self; |
| 7266 | } | 7253 | } |
| 7267 | 7254 | ||
| 7268 | /* FIXME: unused at moment (see ns_mouse_position) at the moment because | ||
| 7269 | drag events will go directly to the EmacsScroller. Leaving in for now. */ | ||
| 7270 | -(void)getMouseMotionPart: (int *)part window: (Lisp_Object *)window | ||
| 7271 | x: (Lisp_Object *)x y: ( Lisp_Object *)y | ||
| 7272 | { | ||
| 7273 | *part = last_hit_part; | ||
| 7274 | *window = win; | ||
| 7275 | XSETINT (*y, pixel_height); | ||
| 7276 | if ([self floatValue] > 0.999F) | ||
| 7277 | XSETINT (*x, pixel_height); | ||
| 7278 | else | ||
| 7279 | XSETINT (*x, pixel_height * [self floatValue]); | ||
| 7280 | } | ||
| 7281 | |||
| 7282 | |||
| 7283 | /* set up emacs_event */ | 7255 | /* set up emacs_event */ |
| 7284 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e | 7256 | - (void) sendScrollEventAtLoc: (float)loc fromEvent: (NSEvent *)e |
| 7285 | { | 7257 | { |
| 7258 | Lisp_Object win; | ||
| 7286 | if (!emacs_event) | 7259 | if (!emacs_event) |
| 7287 | return; | 7260 | return; |
| 7288 | 7261 | ||
| 7289 | emacs_event->part = last_hit_part; | 7262 | emacs_event->part = last_hit_part; |
| 7290 | emacs_event->code = 0; | 7263 | emacs_event->code = 0; |
| 7291 | emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier; | 7264 | emacs_event->modifiers = EV_MODIFIERS (e) | down_modifier; |
| 7265 | XSETWINDOW (win, window); | ||
| 7292 | emacs_event->frame_or_window = win; | 7266 | emacs_event->frame_or_window = win; |
| 7293 | emacs_event->timestamp = EV_TIMESTAMP (e); | 7267 | emacs_event->timestamp = EV_TIMESTAMP (e); |
| 7294 | emacs_event->kind = SCROLL_BAR_CLICK_EVENT; | 7268 | emacs_event->kind = SCROLL_BAR_CLICK_EVENT; |