popup.c
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:2k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. #include <X11/Xlib.h>
  2. #include <X11/Xutil.h>
  3. #include <X11/Xos.h>
  4. #include <X11/Xatom.h>
  5. #include <X11/keysym.h>
  6. #include <X11/cursorfont.h>
  7. #include "www.h"
  8. extern int statusHeight;
  9. extern int sbar_width;
  10. extern int ToolBarHeight;
  11. extern long PixelOffset;
  12. extern long buf_height;
  13. extern int PixelIndent;
  14. extern int buf_width;
  15. extern char *buffer;
  16. extern int hdrlen;
  17. extern int Authorize;
  18. extern int OpenURL;
  19. extern int IsIndex;
  20. extern int SaveFile;
  21. extern int FindStr;
  22. extern char *FindStrVal, *FindNextStr;
  23. extern int font;
  24. extern Field *focus;
  25. extern Frame background;
  26. extern Byte *paint;
  27. extern Bool TextFieldFocus;
  28. extern double lens_factor;
  29. extern GC disp_gc, gc_fill;
  30. extern Doc *CurrentDoc;
  31. extern char *bufptr;
  32. extern Display *display;
  33. void ShowLink(x, y)
  34.     int x,y;
  35. {
  36.     int element,tag, end;
  37.     char *c, *anchor_start, *anchor_end;
  38.     int dx,dy;
  39.     char *href, *name, *class,*ref;
  40.     int hreflen, namelen;
  41.     int class_len;
  42.     XEvent e;
  43.    
  44.     ParseAnchorAttrs(&href, &hreflen, &name, &namelen, &class, &class_len);
  45.     anchor_start = anchor_end = 0;
  46.     tag = 0;
  47.     
  48.     if (!DocHTML(CurrentDoc))
  49. return;
  50.     if (CurrentDoc->show_raw)
  51. return;
  52.     element = WhichObject(BUTTONDOWN, x, y, &tag, &anchor_start, &anchor_end, &dx, &dy);
  53.     
  54.     if (tag == TAG_ANCHOR)
  55.     {
  56. bufptr = anchor_start;
  57. ParseAnchorAttrs(&href, &hreflen, &name, &namelen, &class, &class_len);
  58.         ref = HTAnchor_address(libExpandHref(href, hreflen));
  59. if(ref)
  60. {
  61.     c = (char *)calloc(strlen(ref)+7, sizeof(char));
  62.     strcpy(c,"Link: ");
  63.     strcpy(c+6, ref);
  64.     Announce(c);
  65.     free(c);
  66.     end = 0;
  67.     while (!end)
  68.     {
  69. XNextEvent(display, &e);
  70. switch(e.type)
  71. {
  72. case Expose:
  73.     while (XCheckTypedEvent(display, Expose, &e));
  74.     break;
  75. case ButtonRelease:
  76.     end=TRUE;
  77.     Announce(CurrentDoc->url);
  78.     break;
  79. default:
  80.     break;
  81. };
  82.     };
  83.     Free(ref);
  84. }
  85.     }
  86. }