| To: vim_dev@googlegroups.com |
| Subject: Patch 7.3.299 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.3.299 |
| Problem: Source code not in Vim style. |
| Solution: Adjust the style. (Elias Diem) |
| Files: src/gui_photon.c |
| |
| |
| |
| |
| |
| *** 535,547 **** |
| &src_taken, |
| buf, |
| 6, |
| ! &dst_made ); |
| |
| ! add_to_input_buf( buf, dst_made ); |
| } |
| else |
| { |
| ! add_to_input_buf( string, len ); |
| } |
| |
| return Pt_CONSUME; |
| --- 535,547 ---- |
| &src_taken, |
| buf, |
| 6, |
| ! &dst_made); |
| |
| ! add_to_input_buf(buf, dst_made); |
| } |
| else |
| { |
| ! add_to_input_buf(string, len); |
| } |
| |
| return Pt_CONSUME; |
| |
| *** 549,579 **** |
| len = 0; |
| #endif |
| ch = key->key_cap; |
| ! if( ch < 0xff ) |
| { |
| /* FIXME: is this the right thing to do? */ |
| ! if( modifiers & MOD_MASK_CTRL ) |
| { |
| modifiers &= ~MOD_MASK_CTRL; |
| |
| ! if( ( ch >= 'a' && ch <= 'z' ) || |
| ch == '[' || |
| ch == ']' || |
| ! ch == '\\' ) |
| ! ch = Ctrl_chr( ch ); |
| ! else if( ch == '2' ) |
| ch = NUL; |
| ! else if( ch == '6' ) |
| ch = 0x1e; |
| ! else if( ch == '-' ) |
| ch = 0x1f; |
| else |
| modifiers |= MOD_MASK_CTRL; |
| } |
| |
| ! if( modifiers & MOD_MASK_ALT ) |
| { |
| ! ch = Meta( ch ); |
| modifiers &= ~MOD_MASK_ALT; |
| } |
| } |
| --- 549,579 ---- |
| len = 0; |
| #endif |
| ch = key->key_cap; |
| ! if (ch < 0xff) |
| { |
| /* FIXME: is this the right thing to do? */ |
| ! if (modifiers & MOD_MASK_CTRL) |
| { |
| modifiers &= ~MOD_MASK_CTRL; |
| |
| ! if ((ch >= 'a' && ch <= 'z') || |
| ch == '[' || |
| ch == ']' || |
| ! ch == '\\') |
| ! ch = Ctrl_chr(ch); |
| ! else if (ch == '2') |
| ch = NUL; |
| ! else if (ch == '6') |
| ch = 0x1e; |
| ! else if (ch == '-') |
| ch = 0x1f; |
| else |
| modifiers |= MOD_MASK_CTRL; |
| } |
| |
| ! if (modifiers & MOD_MASK_ALT) |
| { |
| ! ch = Meta(ch); |
| modifiers &= ~MOD_MASK_ALT; |
| } |
| } |
| |
| *** 586,604 **** |
| modifiers &= ~MOD_MASK_SHIFT; |
| } |
| |
| ! ch = simplify_key( ch, &modifiers ); |
| ! if( modifiers ) |
| { |
| string[ len++ ] = CSI; |
| string[ len++ ] = KS_MODIFIER; |
| string[ len++ ] = modifiers; |
| } |
| |
| ! if( IS_SPECIAL( ch ) ) |
| { |
| string[ len++ ] = CSI; |
| ! string[ len++ ] = K_SECOND( ch ); |
| ! string[ len++ ] = K_THIRD( ch ); |
| } |
| else |
| { |
| --- 586,604 ---- |
| modifiers &= ~MOD_MASK_SHIFT; |
| } |
| |
| ! ch = simplify_key(ch, &modifiers); |
| ! if (modifiers) |
| { |
| string[ len++ ] = CSI; |
| string[ len++ ] = KS_MODIFIER; |
| string[ len++ ] = modifiers; |
| } |
| |
| ! if (IS_SPECIAL(ch)) |
| { |
| string[ len++ ] = CSI; |
| ! string[ len++ ] = K_SECOND(ch); |
| ! string[ len++ ] = K_THIRD(ch); |
| } |
| else |
| { |
| |
| *** 619,627 **** |
| string[ len++ ] = KE_CSI; |
| } |
| |
| ! if( len > 0 ) |
| { |
| ! add_to_input_buf( string, len ); |
| return Pt_CONSUME; |
| } |
| } |
| --- 619,627 ---- |
| string[ len++ ] = KE_CSI; |
| } |
| |
| ! if (len > 0) |
| { |
| ! add_to_input_buf(string, len); |
| return Pt_CONSUME; |
| } |
| } |
| |
| *** 630,646 **** |
| } |
| |
| static int |
| ! gui_ph_handle_mouse( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) |
| { |
| PhPointerEvent_t *pointer; |
| PhRect_t *pos; |
| int button = 0, repeated_click, modifiers = 0x0; |
| short mouse_x, mouse_y; |
| |
| ! pointer = PhGetData( info->event ); |
| ! pos = PhGetRects( info->event ); |
| |
| ! gui_mch_mousehide( MOUSE_SHOW ); |
| |
| /* |
| * Coordinates need to be relative to the base window, |
| --- 630,646 ---- |
| } |
| |
| static int |
| ! gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) |
| { |
| PhPointerEvent_t *pointer; |
| PhRect_t *pos; |
| int button = 0, repeated_click, modifiers = 0x0; |
| short mouse_x, mouse_y; |
| |
| ! pointer = PhGetData(info->event); |
| ! pos = PhGetRects(info->event); |
| |
| ! gui_mch_mousehide(MOUSE_SHOW); |
| |
| /* |
| * Coordinates need to be relative to the base window, |
| |
| *** 649,675 **** |
| mouse_x = pos->ul.x + gui.border_width; |
| mouse_y = pos->ul.y + gui.border_width; |
| |
| ! if( info->event->type == Ph_EV_PTR_MOTION_NOBUTTON ) |
| { |
| ! gui_mouse_moved( mouse_x, mouse_y ); |
| return Pt_CONTINUE; |
| } |
| |
| ! if( pointer->key_mods & Pk_KM_Shift ) |
| modifiers |= MOUSE_SHIFT; |
| ! if( pointer->key_mods & Pk_KM_Ctrl ) |
| modifiers |= MOUSE_CTRL; |
| ! if( pointer->key_mods & Pk_KM_Alt ) |
| modifiers |= MOUSE_ALT; |
| |
| /* |
| * FIXME More than one button may be involved, but for |
| * now just deal with one |
| */ |
| ! if( pointer->buttons & Ph_BUTTON_SELECT ) |
| button = MOUSE_LEFT; |
| |
| ! if( pointer->buttons & Ph_BUTTON_MENU ) |
| { |
| button = MOUSE_RIGHT; |
| /* Need the absolute coordinates for the popup menu */ |
| --- 649,675 ---- |
| mouse_x = pos->ul.x + gui.border_width; |
| mouse_y = pos->ul.y + gui.border_width; |
| |
| ! if (info->event->type == Ph_EV_PTR_MOTION_NOBUTTON) |
| { |
| ! gui_mouse_moved(mouse_x, mouse_y); |
| return Pt_CONTINUE; |
| } |
| |
| ! if (pointer->key_mods & Pk_KM_Shift) |
| modifiers |= MOUSE_SHIFT; |
| ! if (pointer->key_mods & Pk_KM_Ctrl) |
| modifiers |= MOUSE_CTRL; |
| ! if (pointer->key_mods & Pk_KM_Alt) |
| modifiers |= MOUSE_ALT; |
| |
| /* |
| * FIXME More than one button may be involved, but for |
| * now just deal with one |
| */ |
| ! if (pointer->buttons & Ph_BUTTON_SELECT) |
| button = MOUSE_LEFT; |
| |
| ! if (pointer->buttons & Ph_BUTTON_MENU) |
| { |
| button = MOUSE_RIGHT; |
| /* Need the absolute coordinates for the popup menu */ |
| |
| *** 677,705 **** |
| abs_mouse.y = pointer->pos.y; |
| } |
| |
| ! if( pointer->buttons & Ph_BUTTON_ADJUST ) |
| button = MOUSE_MIDDLE; |
| |
| /* Catch a real release (not phantom or other releases */ |
| ! if( info->event->type == Ph_EV_BUT_RELEASE ) |
| button = MOUSE_RELEASE; |
| |
| ! if( info->event->type & Ph_EV_PTR_MOTION_BUTTON ) |
| button = MOUSE_DRAG; |
| |
| #if 0 |
| /* Vim doesn't use button repeats */ |
| ! if( info->event->type & Ph_EV_BUT_REPEAT ) |
| button = MOUSE_DRAG; |
| #endif |
| |
| /* Don't do anything if it is one of the phantom mouse release events */ |
| ! if( ( button != MOUSE_RELEASE ) || |
| ! ( info->event->subtype == Ph_EV_RELEASE_REAL ) ) |
| { |
| repeated_click = (pointer->click_count >= 2) ? TRUE : FALSE; |
| |
| ! gui_send_mouse_event( button , mouse_x, mouse_y, repeated_click, modifiers ); |
| } |
| |
| return Pt_CONTINUE; |
| --- 677,705 ---- |
| abs_mouse.y = pointer->pos.y; |
| } |
| |
| ! if (pointer->buttons & Ph_BUTTON_ADJUST) |
| button = MOUSE_MIDDLE; |
| |
| /* Catch a real release (not phantom or other releases */ |
| ! if (info->event->type == Ph_EV_BUT_RELEASE) |
| button = MOUSE_RELEASE; |
| |
| ! if (info->event->type & Ph_EV_PTR_MOTION_BUTTON) |
| button = MOUSE_DRAG; |
| |
| #if 0 |
| /* Vim doesn't use button repeats */ |
| ! if (info->event->type & Ph_EV_BUT_REPEAT) |
| button = MOUSE_DRAG; |
| #endif |
| |
| /* Don't do anything if it is one of the phantom mouse release events */ |
| ! if ((button != MOUSE_RELEASE) || |
| ! (info->event->subtype == Ph_EV_RELEASE_REAL)) |
| { |
| repeated_click = (pointer->click_count >= 2) ? TRUE : FALSE; |
| |
| ! gui_send_mouse_event(button , mouse_x, mouse_y, repeated_click, modifiers); |
| } |
| |
| return Pt_CONTINUE; |
| |
| *** 707,741 **** |
| |
| /* Handle a focus change of the PtRaw widget */ |
| static int |
| ! gui_ph_handle_focus( PtWidget_t *widget, void *data, PtCallbackInfo_t *info ) |
| { |
| ! if( info->reason == Pt_CB_LOST_FOCUS ) |
| { |
| ! PtRemoveEventHandler( gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, |
| ! gui_ph_handle_mouse, NULL ); |
| |
| ! gui_mch_mousehide( MOUSE_SHOW ); |
| } |
| else |
| { |
| ! PtAddEventHandler( gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, |
| ! gui_ph_handle_mouse, NULL ); |
| } |
| return Pt_CONTINUE; |
| } |
| |
| static void |
| ! gui_ph_handle_raw_draw( PtWidget_t *widget, PhTile_t *damage ) |
| { |
| PhRect_t *r; |
| PhPoint_t offset; |
| PhPoint_t translation; |
| |
| ! if( is_ignore_draw == TRUE ) |
| return; |
| |
| ! PtSuperClassDraw( PtBasic, widget, damage ); |
| ! PgGetTranslation( &translation ); |
| PgClearTranslation(); |
| |
| #if 0 |
| --- 707,741 ---- |
| |
| /* Handle a focus change of the PtRaw widget */ |
| static int |
| ! gui_ph_handle_focus(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) |
| { |
| ! if (info->reason == Pt_CB_LOST_FOCUS) |
| { |
| ! PtRemoveEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, |
| ! gui_ph_handle_mouse, NULL); |
| |
| ! gui_mch_mousehide(MOUSE_SHOW); |
| } |
| else |
| { |
| ! PtAddEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, |
| ! gui_ph_handle_mouse, NULL); |
| } |
| return Pt_CONTINUE; |
| } |
| |
| static void |
| ! gui_ph_handle_raw_draw(PtWidget_t *widget, PhTile_t *damage) |
| { |
| PhRect_t *r; |
| PhPoint_t offset; |
| PhPoint_t translation; |
| |
| ! if (is_ignore_draw == TRUE) |
| return; |
| |
| ! PtSuperClassDraw(PtBasic, widget, damage); |
| ! PgGetTranslation(&translation); |
| PgClearTranslation(); |
| |
| #if 0 |
| |
| *** 750,770 **** |
| out_flush(); |
| #endif |
| |
| ! PtWidgetOffset( widget, &offset ); |
| ! PhTranslatePoint( &offset, PtWidgetPos( gui.vimTextArea, NULL ) ); |
| |
| #if 1 |
| /* Redraw individual damage regions */ |
| ! if( damage->next != NULL ) |
| damage = damage->next; |
| |
| ! while( damage != NULL ) |
| { |
| r = &damage->rect; |
| gui_redraw( |
| r->ul.x - offset.x, r->ul.y - offset.y, |
| r->lr.x - r->ul.x + 1, |
| ! r->lr.y - r->ul.y + 1 ); |
| damage = damage->next; |
| } |
| #else |
| --- 750,770 ---- |
| out_flush(); |
| #endif |
| |
| ! PtWidgetOffset(widget, &offset); |
| ! PhTranslatePoint(&offset, PtWidgetPos(gui.vimTextArea, NULL)); |
| |
| #if 1 |
| /* Redraw individual damage regions */ |
| ! if (damage->next != NULL) |
| damage = damage->next; |
| |
| ! while(damage != NULL) |
| { |
| r = &damage->rect; |
| gui_redraw( |
| r->ul.x - offset.x, r->ul.y - offset.y, |
| r->lr.x - r->ul.x + 1, |
| ! r->lr.y - r->ul.y + 1); |
| damage = damage->next; |
| } |
| #else |
| |
| *** 773,796 **** |
| gui_redraw( |
| r->ul.x - offset.x, r->ul.y - offset.y, |
| r->lr.x - r->ul.x + 1, |
| ! r->lr.y - r->ul.y + 1 ); |
| #endif |
| |
| ! PgSetTranslation( &translation, 0 ); |
| } |
| |
| static int |
| gui_ph_handle_pulldown_menu( |
| PtWidget_t *widget, |
| void *data, |
| ! PtCallbackInfo_t *info ) |
| { |
| ! if( data != NULL ) |
| { |
| vimmenu_T *menu = (vimmenu_T *) data; |
| |
| ! PtPositionMenu( menu->submenu_id, NULL ); |
| ! PtRealizeWidget( menu->submenu_id ); |
| } |
| |
| return Pt_CONTINUE; |
| --- 773,796 ---- |
| gui_redraw( |
| r->ul.x - offset.x, r->ul.y - offset.y, |
| r->lr.x - r->ul.x + 1, |
| ! r->lr.y - r->ul.y + 1); |
| #endif |
| |
| ! PgSetTranslation(&translation, 0); |
| } |
| |
| static int |
| gui_ph_handle_pulldown_menu( |
| PtWidget_t *widget, |
| void *data, |
| ! PtCallbackInfo_t *info) |
| { |
| ! if (data != NULL) |
| { |
| vimmenu_T *menu = (vimmenu_T *) data; |
| |
| ! PtPositionMenu(menu->submenu_id, NULL); |
| ! PtRealizeWidget(menu->submenu_id); |
| } |
| |
| return Pt_CONTINUE; |
| |
| |
| |
| *** 711,712 **** |
| --- 711,714 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 299, |
| /**/ |
| |
| -- |
| The only way the average employee can speak to an executive is by taking a |
| second job as a golf caddie. |
| (Scott Adams - The Dilbert principle) |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |