To: vim-dev@vim.org Subject: Patch 6.0.053 (extra) Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.053 (extra) Problem: Various problems with QNX. Solution: Minor fix for configure. Switch on terminal clipboard support in main.c. Fix "pterm" mouse support. os_qnx.c didn't build without photon. (Julian Kinraid) Files: src/auto/configure, src/configure.in, src/gui_photon.c, src/main.c, src/misc2.c, src/option.h, src/os_qnx.c, src/os_qnx.h, src/syntax.c *** ../vim60.52/src/auto/configure Thu Nov 1 12:04:29 2001 --- src/auto/configure Wed Oct 31 21:57:52 2001 *************** *** 3241,3247 **** case "$enable_gui" in no|No|NO) echo "$ac_t""no GUI support" 1>&6 ! SKIP_QNX=YES ;; yes|Yes|YES|"") echo "$ac_t""yes - automatic GUI support" 1>&6 ;; auto|Auto|AUTO|"") echo "$ac_t""auto - automatic GUI support" 1>&6 ;; photon|Photon|PHOTON) echo "$ac_t""Photon GUI support" 1>&6 ;; --- 3241,3247 ---- case "$enable_gui" in no|No|NO) echo "$ac_t""no GUI support" 1>&6 ! SKIP_PHOTON=YES ;; yes|Yes|YES|"") echo "$ac_t""yes - automatic GUI support" 1>&6 ;; auto|Auto|AUTO|"") echo "$ac_t""auto - automatic GUI support" 1>&6 ;; photon|Photon|PHOTON) echo "$ac_t""Photon GUI support" 1>&6 ;; *** ../vim60.52/src/configure.in Thu Nov 1 12:04:29 2001 --- src/configure.in Wed Oct 31 21:57:50 2001 *************** *** 738,744 **** case "$enable_gui" in no|No|NO) AC_MSG_RESULT(no GUI support) ! SKIP_QNX=YES ;; yes|Yes|YES|"") AC_MSG_RESULT(yes - automatic GUI support) ;; auto|Auto|AUTO|"") AC_MSG_RESULT(auto - automatic GUI support) ;; photon|Photon|PHOTON) AC_MSG_RESULT(Photon GUI support) ;; --- 738,744 ---- case "$enable_gui" in no|No|NO) AC_MSG_RESULT(no GUI support) ! SKIP_PHOTON=YES ;; yes|Yes|YES|"") AC_MSG_RESULT(yes - automatic GUI support) ;; auto|Auto|AUTO|"") AC_MSG_RESULT(auto - automatic GUI support) ;; photon|Photon|PHOTON) AC_MSG_RESULT(Photon GUI support) ;; *** ../vim60.52/src/gui_photon.c Sun Sep 2 14:29:10 2001 --- src/gui_photon.c Tue Oct 23 17:30:22 2001 *************** *** 137,145 **** {Pk_F30, 'F', 'K'}, {Pk_F31, 'F', 'L'}, {Pk_F32, 'F', 'M'}, ! {Pk_F33, 'F', 'O'}, ! {Pk_F34, 'F', 'P'}, ! {Pk_F35, 'F', 'Q'}, {Pk_Help, '%', '1'}, {Pk_BackSpace, 'k', 'b'}, --- 137,145 ---- {Pk_F30, 'F', 'K'}, {Pk_F31, 'F', 'L'}, {Pk_F32, 'F', 'M'}, ! {Pk_F33, 'F', 'N'}, ! {Pk_F34, 'F', 'O'}, ! {Pk_F35, 'F', 'P'}, {Pk_Help, '%', '1'}, {Pk_BackSpace, 'k', 'b'}, *************** *** 488,497 **** { /* Detect if a keypad number key has been pressed * and change the key if Num Lock is on */ ! if( key->key_cap >= Pk_KP_0 && key->key_cap <= Pk_KP_9 && ( key->key_mods & Pk_KM_Num_Lock ) ) { ! ch = TO_SPECIAL( 'K', key->key_cap - Pk_KP_0 + 'C' ); } else ch = TO_SPECIAL( special_keys[i].vim_code0, --- 488,499 ---- { /* Detect if a keypad number key has been pressed * and change the key if Num Lock is on */ ! if( key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9 && ( key->key_mods & Pk_KM_Num_Lock ) ) { ! /* FIXME: For now, just map the key to a ascii value ! * (see ) */ ! ch = key->key_cap - 0xf080; } else ch = TO_SPECIAL( special_keys[i].vim_code0, *************** *** 924,933 **** } static void ! gui_ph_get_panelgroup_margins( short *top, short *bottom, short *left, short *right ) { unsigned short abs_raw_x, abs_raw_y, abs_panel_x, abs_panel_y; ! const unsigned short *margin_top, *margin_bottom, *margin_left, *margin_right; PtGetAbsPosition( gui.vimTextArea, &abs_raw_x, &abs_raw_y ); PtGetAbsPosition( gui.vimPanelGroup, &abs_panel_x, &abs_panel_y ); --- 926,940 ---- } static void ! gui_ph_get_panelgroup_margins( ! short *top, ! short *bottom, ! short *left, ! short *right ) { unsigned short abs_raw_x, abs_raw_y, abs_panel_x, abs_panel_y; ! const unsigned short *margin_top, *margin_bottom; ! const unsigned short *margin_left, *margin_right; PtGetAbsPosition( gui.vimTextArea, &abs_raw_x, &abs_raw_y ); PtGetAbsPosition( gui.vimPanelGroup, &abs_panel_x, &abs_panel_y ); *************** *** 1318,1349 **** /****************************************************************************/ /* events */ void gui_mch_update(void) { ! int working = -1; ! while( working && !vim_is_input_buf_full()) { ! switch( PhEventPeek( gui.event_buffer, EVENT_BUFFER_SIZE ) ) ! { ! case 0: /* No messages */ ! working = 0; ! break; ! ! case Ph_EVENT_MSG: ! PtEventHandler( gui.event_buffer ); ! break; ! ! case -1: ! perror( "gui_mch_update: PhEventPeek failed" ); ! working = 0; ! break; ! default: ! perror( "PhEventPeek default reached" ); ! working = 0; ! break; ! } } } --- 1325,1348 ---- /****************************************************************************/ /* events */ + /* When no events are available, photon will call this function, working is + * set to FALSE, and the gui_mch_update loop will exit. */ + static int + exit_gui_mch_update( void *data ) + { + *(int *)data = FALSE; + return( Pt_END ); + } + void gui_mch_update(void) { ! int working = TRUE; ! PtAppAddWorkProc( NULL, exit_gui_mch_update, &working ); ! while( ( working == TRUE ) && !vim_is_input_buf_full()) { ! PtProcessEvent(); } } *************** *** 1357,1385 **** while( 1 ) { ! switch( PhEventNext( gui.event_buffer, EVENT_BUFFER_SIZE ) ) { ! case Ph_EVENT_MSG: ! PtEventHandler( gui.event_buffer ); ! if( !vim_is_input_buf_empty() ) ! { ! PtSetResource( gui_ph_timer_timeout, Pt_ARG_TIMER_INITIAL, 0, 0 ); ! return( OK ); ! } ! else if( is_timeout == TRUE ) ! return( FAIL ); ! ! break; ! ! case Ph_RESIZE_MSG: ! /* FIXME */ ! return( FAIL ); ! break; ! ! case -1: ! perror( "PhEventNext" ); ! return( FAIL ); } } } --- 1356,1369 ---- while( 1 ) { ! PtProcessEvent(); ! if( !vim_is_input_buf_empty() ) { ! PtSetResource( gui_ph_timer_timeout, Pt_ARG_TIMER_INITIAL, 0, 0 ); ! return( OK ); } + else if( is_timeout == TRUE ) + return( FAIL ); } } *************** *** 1577,1585 **** button_count, (const char **) button_array, NULL, default_button, 0, Pt_MODAL ); #else ! /* PtPrompt doesn't work if you're not using PtMainLoop(), so create the dialog directly. ! * It does give us the option ofadding extra features, like trapping the escape key and ! * returning 0 to vim */ { int n; PtArg_t args[5]; --- 1561,1568 ---- button_count, (const char **) button_array, NULL, default_button, 0, Pt_MODAL ); #else ! /* Writing the dialog ourselves lets us add extra features, like ! * trapping the escape key and returning 0 to vim */ { int n; PtArg_t args[5]; *************** *** 2384,2390 **** /* Only turn on the timer on if none of the times are zero */ if( blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { ! PtSetResource( gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL, blink_waittime, 0 ); blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); } --- 2367,2374 ---- /* Only turn on the timer on if none of the times are zero */ if( blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { ! PtSetResource( gui_ph_timer_cursor, Pt_ARG_TIMER_INITIAL, ! blink_waittime, 0 ); blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); } *************** *** 2792,2798 **** PtWidgetIsClass( PtWidgetParent( menu->id ), PtMenu ) ) { fields = Pt_FALSE; ! mask = Pt_SELECTABLE; } else { --- 2776,2782 ---- PtWidgetIsClass( PtWidgetParent( menu->id ), PtMenu ) ) { fields = Pt_FALSE; ! mask = Pt_SELECTABLE | Pt_HIGHLIGHTED; } else { *** ../vim60.52/src/main.c Fri Sep 21 20:27:36 2001 --- src/main.c Tue Oct 23 17:30:22 2001 *************** *** 167,174 **** (void)mb_init(); /* init mb_bytelen_tab[] to ones */ #endif ! #ifdef __QNX__ ! qnx_init(); /* PhAttach() for clipboard, mouse (and gui) */ #endif #ifdef FEAT_GUI_MAC --- 167,174 ---- (void)mb_init(); /* init mb_bytelen_tab[] to ones */ #endif ! #ifdef __QNXNTO__ ! qnx_init(); /* PhAttach() for clipboard, (and gui) */ #endif #ifdef FEAT_GUI_MAC *************** *** 1424,1429 **** --- 1424,1433 ---- gui_wait_for_chars(50L); TIME_MSG("GUI delay"); } + #endif + + #if defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD) + qnx_clip_init(); #endif #ifdef FEAT_XCLIPBOARD *** ../vim60.52/src/misc2.c Mon Oct 29 17:19:02 2001 --- src/misc2.c Mon Oct 29 17:14:44 2001 *************** *** 1829,1834 **** --- 1829,1835 ---- {K_NETTERM_MOUSE, (char_u *)"NetMouse"}, {K_DEC_MOUSE, (char_u *)"DecMouse"}, {K_JSBTERM_MOUSE, (char_u *)"JsbMouse"}, + {K_PTERM_MOUSE, (char_u *)"PtermMouse"}, {K_LEFTMOUSE, (char_u *)"LeftMouse"}, {K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"}, {K_LEFTDRAG, (char_u *)"LeftDrag"}, *** ../vim60.52/src/option.h Sun Sep 16 15:03:16 2001 --- src/option.h Tue Oct 23 17:30:22 2001 *************** *** 661,667 **** EXTERN char_u *p_ttym; /* 'ttymouse' */ EXTERN unsigned ttym_flags; # ifdef IN_OPTION_C ! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", NULL}; # endif # define TTYM_XTERM 0x01 # define TTYM_XTERM2 0x02 --- 661,667 ---- EXTERN char_u *p_ttym; /* 'ttymouse' */ EXTERN unsigned ttym_flags; # ifdef IN_OPTION_C ! static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", NULL}; # endif # define TTYM_XTERM 0x01 # define TTYM_XTERM2 0x02 *** ../vim60.52/src/os_qnx.c Thu Apr 5 12:13:43 2001 --- src/os_qnx.c Tue Oct 23 17:30:22 2001 *************** *** 15,41 **** #include "vim.h" int is_photon_available; ! void qnx_init() { ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) ! is_photon_available = (PhAttach( NULL, NULL ) != NULL) ? TRUE : FALSE; #endif } ! #if defined(FEAT_CLIPBOARD) || defined(PROTO) ! #define CLIP_TYPE_VIM "TEXTVIM" #define CLIP_TYPE_TEXT "TEXT" void qnx_clip_init() { ! if( is_photon_available == TRUE ) ! { clip_init( TRUE ); - } } /*****************************************************************************/ --- 15,46 ---- #include "vim.h" + #if defined(FEAT_GUI_PHOTON) int is_photon_available; ! #endif void qnx_init() { ! #if defined(FEAT_GUI_PHOTON) ! PhChannelParms_t parms; ! ! memset( &parms, 0, sizeof( parms ) ); ! parms.flags = Ph_DYNAMIC_BUFFER; ! ! is_photon_available = (PhAttach( NULL, &parms ) != NULL) ? TRUE : FALSE; #endif } ! #if (defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD)) || defined(PROTO) ! #define CLIP_TYPE_VIM "VIMTYPE" #define CLIP_TYPE_TEXT "TEXT" + /* Turn on the clipboard for a console vim when photon is running */ void qnx_clip_init() { ! if( is_photon_available == TRUE && !gui.in_use) clip_init( TRUE ); } /*****************************************************************************/ *************** *** 56,62 **** void clip_mch_request_selection( VimClipboard *cbd ) { ! int type = MLINE, clip_length = 0; void *cbdata; PhClipHeader *clip_header; char_u *clip_text = NULL; --- 61,67 ---- void clip_mch_request_selection( VimClipboard *cbd ) { ! int type = MLINE, clip_length = 0, is_type_set = FALSE; void *cbdata; PhClipHeader *clip_header; char_u *clip_text = NULL; *************** *** 66,101 **** { /* Look for the vim specific clip first */ clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_VIM ); ! if( clip_header != NULL ) { ! clip_text = clip_header->data; ! /* Skip past the initial type specifier */ ! /* clip_header->length also includes the trailing NUL */ ! clip_length = clip_header->length - 2; ! ! if( clip_text != NULL ) { ! switch( *clip_text++ ) ! { ! default: /* fallthrough to line type */ ! case 'L': type = MLINE; break; ! case 'C': type = MCHAR; break; ! case 'B': type = MBLOCK; break; ! } } } ! else { ! /* Try for just normal text */ ! clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_TEXT ); ! if( clip_header != NULL ) ! { ! clip_text = clip_header->data; ! clip_length = clip_header->length - 1; ! if( clip_text != NULL ) ! type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR; ! } } if( (clip_text != NULL) && (clip_length > 0) ) --- 71,97 ---- { /* Look for the vim specific clip first */ clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_VIM ); ! if( clip_header != NULL && clip_header->data != NULL ) { ! switch( *(char *) clip_header->data ) { ! default: /* fallthrough to line type */ ! case 'L': type = MLINE; break; ! case 'C': type = MCHAR; break; ! case 'B': type = MBLOCK; break; } + is_type_set = TRUE; } ! ! /* Try for just normal text */ ! clip_header = PhClipboardPasteType( cbdata, CLIP_TYPE_TEXT ); ! if( clip_header != NULL ) { ! clip_text = clip_header->data; ! clip_length = clip_header->length - 1; ! if( clip_text != NULL && is_type_set == FALSE ) ! type = (strchr( clip_text, '\r' ) != NULL) ? MLINE : MCHAR; } if( (clip_text != NULL) && (clip_length > 0) ) *************** *** 112,118 **** { int type; long_u len; ! char_u *text_clip, *vim_clip, *str = NULL; cbd->owned = TRUE; clip_get_selection( cbd ); --- 108,119 ---- { int type; long_u len; ! char_u *text_clip, vim_clip[2], *str = NULL; ! PhClipHeader clip_header[2]; ! ! /* Prevent recursion from clip_get_selection() */ ! if( cbd->owned == TRUE ) ! return; cbd->owned = TRUE; clip_get_selection( cbd ); *************** *** 122,135 **** if( type >= 0 ) { text_clip = lalloc( len + 1, TRUE ); /* Normal text */ - vim_clip = lalloc( len + 2, TRUE ); /* vim specific info + text */ if( text_clip && vim_clip ) { ! PhClipHeader clip_header[2]; STRNCPY( clip_header[0].type, CLIP_TYPE_VIM, 8 ); ! clip_header[0].length = len + 2; clip_header[0].data = vim_clip; STRNCPY( clip_header[1].type, CLIP_TYPE_TEXT, 8 ); --- 123,135 ---- if( type >= 0 ) { text_clip = lalloc( len + 1, TRUE ); /* Normal text */ if( text_clip && vim_clip ) { ! memset( clip_header, 0, sizeof( clip_header ) ); STRNCPY( clip_header[0].type, CLIP_TYPE_VIM, 8 ); ! clip_header[0].length = sizeof( vim_clip ); clip_header[0].data = vim_clip; STRNCPY( clip_header[1].type, CLIP_TYPE_TEXT, 8 ); *************** *** 147,159 **** STRNCPY( text_clip, str, len ); text_clip[ len ] = NUL; ! STRNCPY( vim_clip + 1, str, len ); ! vim_clip[ len + 1 ] = NUL; PhClipboardCopy( PhInputGroup( NULL ), 2, clip_header); } vim_free( text_clip ); - vim_free( vim_clip ); } vim_free( str ); } --- 147,157 ---- STRNCPY( text_clip, str, len ); text_clip[ len ] = NUL; ! vim_clip[ 1 ] = NUL; PhClipboardCopy( PhInputGroup( NULL ), 2, clip_header); } vim_free( text_clip ); } vim_free( str ); } *** ../vim60.52/src/os_qnx.h Tue Aug 28 17:42:00 2001 --- src/os_qnx.h Tue Oct 23 17:30:22 2001 *************** *** 14,19 **** #define POSIX /* Used by pty.c */ ! #if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) extern int is_photon_available; #endif --- 14,19 ---- #define POSIX /* Used by pty.c */ ! #if defined(FEAT_GUI_PHOTON) extern int is_photon_available; #endif *** ../vim60.52/src/syntax.c Wed Oct 31 11:17:27 2001 --- src/syntax.c Wed Oct 31 11:11:24 2001 *************** *** 6493,6498 **** --- 6493,6504 ---- 4+8, 4+8, 2+8, 2+8, 6+8, 6+8, 1+8, 1+8, 5+8, 5+8, 3+8, 3+8, 7+8, -1}; + #if defined(__QNXNTO__) + static int *color_numbers_8_qansi = color_numbers_8; + /* On qnx, the 8 & 16 color arrays are the same */ + if (STRNCMP(T_NAME, "qansi", 5) == 0) + color_numbers_8_qansi = color_numbers_16; + #endif /* reduce calls to STRICMP a bit, it can be slow */ off = TO_UPPER(*arg); *************** *** 6514,6520 **** --- 6520,6530 ---- if (t_colors == 8) { /* t_Co is 8: use the 8 colors table */ + #if defined(__QNXNTO__) + color = color_numbers_8_qansi[i]; + #else color = color_numbers_8[i]; + #endif if (key[5] == 'F') { /* set/reset bold attribute to get light foreground *** ../vim60.52/src/version.c Thu Nov 1 12:04:29 2001 --- src/version.c Thu Nov 1 12:18:27 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 53, /**/ -- A M00se once bit my sister ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///