[989] in Zephyr_Bugs

home help back first fref pref prev next nref lref last post

URL hack to zephyr-2.0.4

daemon@ATHENA.MIT.EDU (Jon Yi)
Wed Jan 26 16:31:14 2000

Message-Id: <200001262130.QAA15992@elysium.mit.edu>
To: zephyr-bugs@MIT.EDU
Reply-To: jonyi@MIT.EDU
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 26 Jan 2000 16:30:31 EST
From: Jon Yi <jonyi@MIT.EDU>


hi,

i hacked zephyr-2.0.4 so that shift clicking with the middle
button opens an URL in netscape.  i added this to clients/zwgc/xmark.c:

char *xmarkGetWord()
{
    int index, len, block, startblock, endblock;
    char *text = markgram->text;
    
    index = markchar[XMARK_TEMP_BOUND];
    block = markblock[XMARK_TEMP_BOUND];
    startblock = markgram->blocks[block].strindex;
    endblock = startblock + markgram->blocks[block].strlen;
    index += startblock;

    /* Find space on left */
    for(;index>=startblock;index--)
      if(text[index] == ' ')
	break;
    index++;

    /* Find space on right */
    for(len=0;index+len<=endblock;len++)
      if(text[index+len] == ' ')
	break;
    len--;

    return(string_CreateFromData(text+index, len));
}

then the following diffs to xcut.c:

47d46
< extern char *xmarkGetWord();
146d144
< #define PRESSOP_LINK 6  /* link */
190d187
<     char *ptr, string[1024];
238,239d234
< 	} else if (current_pressop == PRESSOP_LINK) {
< 	   xmarkSetBound(gram,event->xbutton.x,event->xbutton.y,XMARK_TEMP_BOUND);
267,269d261
< 	   } else if (event->xbutton.button==Button2) {
< 	     xmarkSetBound(gram,event->xbutton.x,event->xbutton.y,XMARK_TEMP_BOUND);
< 	     current_pressop = PRESSOP_LINK;
295,303d286
< 	} else if (current_pressop == PRESSOP_LINK) {
< 	  selected_text = xmarkGetWord();
< 	  for(ptr=selected_text;*ptr;ptr++)
< 	    if(*ptr == ':')
< 	      break;
< 	  if(ptr[0] == ':' && ptr[1] == '/' && ptr[2] == '/') {
< 	    sprintf(string, "netscape-remote -remote 'openURL(%s, new-window)' &", 
selected_text);
< 	    system(string);
< 	  }

netscape-remote is a utility that can be downloaded from:

http://home.netscape.com/newsref/std/x-remote.html

i would love to see this zwgc feature (or a massaged version thereof)
appear in the next athena release.

thanks,

jon


home help back first fref pref prev next nref lref last post