home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Enlightenment / enl_BETA-0.13.src.tar.gz / enl_BETA-0.13.src.tar / enl-0.13 / actions.c next >
C/C++ Source or Header  |  1997-11-18  |  15KB  |  582 lines

  1. #include "enlightenment.h"
  2.  
  3. void DoBaseMenu(Menu *m, int x, int y) {
  4.     int px,py;
  5.  
  6.     if (m) {
  7.         px=x-m->popup_x;
  8.         py=y-m->popup_y;
  9.         if (px<0) 
  10.             px=0;
  11.         if (py<0) 
  12.             py=0;
  13.         if (px+m->width>DisplayWidth(disp,screen)) 
  14.             px=DisplayWidth(disp,screen)-m->width-1;
  15.         if (py+m->height>DisplayHeight(disp,screen)) 
  16.             py=DisplayHeight(disp,screen)-m->height-1;
  17.         /* save the location in the menu structure */
  18.         m->px = px;
  19.         m->py = py;
  20.         XMoveWindow(disp,m->win,m->px,m->py);
  21.         ShowMenu(m);
  22.         AddActiveMenuToList(m);
  23.     }
  24. }
  25.  
  26. void DoRootMenu(int btn, int mod, int x, int y) {
  27.     Menu *m;
  28.     char *s;
  29.  
  30.     s = malloc(btn+6);
  31.     sprintf(s,"root%i",btn);
  32.     strcpy(evmd.mname,s);
  33.     m=FindMenu(s);
  34.     free(s);
  35.     DoBaseMenu(m,x,y);
  36. }
  37.  
  38. void Do_Exec(char *line) {
  39. #ifdef USE_PTHREADS
  40.     pthread_t thread;
  41.     pthread_create(&thread,0,(void*)system,line);
  42. #else
  43.     if(fork()) return;
  44.     setsid();
  45.     if(execl("/bin/sh","sh","-c",line,0)==-1) exit(100);
  46.     exit(0);
  47. #endif
  48. }
  49.  
  50. void Do_Exit() {
  51.     char *s;
  52.     s = malloc(strlen(Theme_Path)+8);
  53.     if ((Theme_Path[0])&&(!nodel)) {
  54.         sprintf(s,"rm -rf %s",Theme_Path);
  55.         system(s); 
  56.     }
  57.     XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
  58.     XSelectInput(disp, root, 0);
  59.     MapClients(global_l);
  60.     free(s);
  61.     exit(0);
  62. }
  63.  
  64. void Do_Restart() {
  65.     char s[2048];
  66.  
  67.     if ((Theme_Path[0])&&(!nodel)) {
  68.         sprintf(s,"rm -rf %s",Theme_Path);
  69.         system(s); 
  70.     }
  71.     restart=1;
  72.     WriteAllWindowStates();
  73.     UnmapClients(0);
  74.     XCloseDisplay(disp);
  75.     sleep(5);
  76.     if (Theme_Name[0]!=0) {
  77.         sprintf(s,"%s -restart -theme %s",argv1,Theme_Name);
  78.         execl("/bin/sh","/bin/sh","-c",s,NULL);
  79.     } else {
  80.         execl("/bin/sh","/bin/sh","-c",argv1,"-restart",NULL);
  81.     }
  82.     exit(10);
  83. }
  84.  
  85. void Do_ChangeMouseFocus(char *newfocus) {
  86.  
  87.     if(!newfocus) {
  88.         switch(cfg.focus_policy) {
  89.             case PointerFocus:
  90.                 cfg.focus_policy = SloppyFocus;
  91.                 return;
  92.             case SloppyFocus:
  93.                 cfg.focus_policy = ClickToFocus;
  94.                 return;
  95.             case ClickToFocus:
  96.                 cfg.focus_policy = PointerFocus;
  97.                 return;
  98.         }
  99.     } else {
  100.         if(!strcmp(newfocus,"click")) {
  101.             cfg.focus_policy = ClickToFocus;
  102.             return;
  103.         } else if(!strcmp(newfocus,"sloppy")) {
  104.             cfg.focus_policy = SloppyFocus;
  105.             return;
  106.         } else if(!strcmp(newfocus,"mouse")) {
  107.             cfg.focus_policy = PointerFocus;
  108.             return;
  109.         }
  110.     }
  111. }
  112.  
  113. void Do_ChangeMouseCursor(char *newcursor) {
  114.  
  115.  /* created 08/09/97 by mandrake */
  116.  
  117.     XColor fg, bg;
  118.     Cursor cur;
  119.     Pixmap curs, curs_mask;
  120.     char ss[FILENAME_MAX];
  121.     char c1[FILENAME_MAX];
  122.        char c2[FILENAME_MAX]; 
  123.     unsigned int pw,ph,mw,mh;
  124.     int i,defaultcursor,chsx,chsy,mhsx,mhsy;
  125.     char usedefault=1;
  126.  
  127.     for(i=0;i<Cursors_num;i++) {
  128.         if(!strcmp(newcursor,Cursors_list[i].cursor_name)) {
  129.             usedefault=0;
  130.             break;
  131.         }
  132.         if(!strcmp("default",Cursors_list[i].cursor_name)) {
  133.             defaultcursor=i;
  134.         }
  135.     }
  136.     if(usedefault) {
  137.         i=defaultcursor;
  138.     }
  139.  
  140.        if ((Cursors_list[i].root_pix!=NULL)&&(Cursors_list[i].root_mask!=NULL)&&(!ccfg.doneroot)) {
  141.               ccfg.doneroot=1;
  142.               if (Cursors_list[i].root_pix[0]!='/') {
  143.             sprintf(ss,".enlightenment/%s",Cursors_list[i].root_pix);
  144.             if (!exists(ss)) {
  145.                      sprintf(ss,"%s/.enlightenment/%s",getenv("HOME"),Cursors_list[i].root_pix);
  146.                      if (!exists(ss)) {
  147.                          if (Theme_Path[0])
  148.                                sprintf(ss,"%s/%s",Theme_Path,Cursors_list[i].root_pix);
  149.                          else
  150.                                strcpy(ss,Cursors_list[i].root_pix);
  151.                          if (!exists(ss)) {
  152.                           Alert("Allrighty then Mr. I cant find that damned %s file!\nYou're going to be in for a nasty day!\n",Cursors_list[i].root_pix);
  153.                            }
  154.                   }
  155.                  }
  156.                strcpy(c1,ss);
  157.         } else
  158.             strcpy(c1,Cursors_list[i].root_pix);
  159.               if (Cursors_list[i].root_mask[0]!='/') {
  160.             sprintf(ss,".enlightenment/%s",Cursors_list[i].root_mask);
  161.             if (!exists(ss)) {
  162.                      sprintf(ss,"%s/.enlightenment/%s",getenv("HOME"),Cursors_list[i].root_mask);
  163.                   if (!exists(ss)) {
  164.                          if (Theme_Path[0])
  165.                                sprintf(ss,"%s/%s",Theme_Path,Cursors_list[i].root_mask);
  166.                          else
  167.                                strcpy(ss,Cursors_list[i].root_mask);
  168.                          if (!exists(ss)) {
  169.                           Alert("Allrighty then Mr. I cant find that damned %s file!\nYou're going to be in for a nasty day!\n",Cursors_list[i].root_mask);
  170.                            }
  171.                   }
  172.                  }
  173.                strcpy(c2,ss);
  174.         } else
  175.             strcpy(c2,Cursors_list[i].root_mask);
  176.         if(XReadBitmapFile(disp,root,c1,&pw,&ph,&curs,&chsx,&chsy) == BitmapSuccess) {
  177.             if(XReadBitmapFile(disp,root,c2,&mw,&mh,&curs_mask, &mhsx,&mhsy) == BitmapSuccess) {
  178.                 fg.red=(Cursors_list[i].root_fg_r<<8)|Cursors_list[i].root_fg_r;
  179.                 fg.green=(Cursors_list[i].root_fg_g<<8)|Cursors_list[i].root_fg_g;
  180.                 fg.blue=(Cursors_list[i].root_fg_b<<8)|Cursors_list[i].root_fg_b;
  181.                 bg.red=(Cursors_list[i].root_bg_r<<8)|Cursors_list[i].root_bg_r;
  182.                 bg.green=(Cursors_list[i].root_bg_g<<8)|Cursors_list[i].root_bg_g;
  183.                 bg.blue=(Cursors_list[i].root_bg_b<<8)|Cursors_list[i].root_bg_b; 
  184.                 XAllocColor(disp,root_cmap,&fg);
  185.                 XAllocColor(disp,root_cmap,&bg); 
  186.                 cur = XCreatePixmapCursor(disp,curs,curs_mask,&fg,&bg,chsx,chsy); XDefineCursor(disp,root,cur); 
  187.                 ImlibFreePixmap(imd,curs);
  188.                 ImlibFreePixmap(imd,curs_mask);
  189.             }
  190.         }
  191.     }
  192.     XSync(disp,False);
  193. }
  194.  
  195. void Do_Restart_Theme(char *file) {
  196.     char *s;
  197.     s = malloc(strlen(Theme_Path)+strlen(argv1)+18);
  198.     if ((Theme_Path[0])&&(!nodel)) {
  199.         sprintf(s,"rm -rf %s",Theme_Path);
  200.         system(s); 
  201.     }
  202.     sprintf(s,"%s -restart -theme %s",argv1,file);
  203.     restart=1;
  204.     WriteAllWindowStates();
  205.     UnmapClients(0);
  206.     XCloseDisplay(disp);
  207.     sleep(5);
  208.     execl("/bin/sh","/bin/sh","-c",s,NULL);
  209.     free(s);
  210.     exit(100);
  211. }
  212.  
  213. void Do_MenuAction (char *PassedMenu, Window win) {
  214.  
  215.     /* created 07/20/97 by Mandrake (mandrake@mandrake.net) */
  216.  
  217.     XWindowAttributes xwa;
  218.     Menu *m;
  219.  
  220.        evmd.mode=MODE_MENU;
  221.     tmp_menu=NULL;
  222.     m=FindMenu(PassedMenu);
  223.     if (m) {
  224.         XGetWindowAttributes(disp,win,&xwa);
  225.         DoBaseMenu(m,xwa.x+(xwa.width/2),xwa.y+(xwa.height/2));
  226.     }
  227.  
  228. }
  229.  
  230. void DoButton(BWin *bwin, int btn, int mod) {
  231.    
  232.    /* if it wasnt a left, middle or right mouse button... ignore it */
  233.    if ((btn<1)||(btn>3)) return;
  234.    ButtonDraw(bwin);
  235.    switch(bwin->action[btn-1][mod].id) {
  236.     case ACTION_MENU: 
  237.         Do_MenuAction(bwin->action[btn-1][mod].params,bwin->win);
  238.         break;
  239.     case ACTION_EXEC:
  240.         Do_Exec(bwin->action[btn-1][mod].params);
  241.         break;
  242.     case ACTION_EXIT:
  243.         Do_Exit();
  244.         break;
  245.     case ACTION_RESTART:
  246.         Do_Restart();
  247.         break;
  248.     case ACTION_RESTART_THEME:
  249.         Do_Restart_Theme(bwin->action[btn-1][mod].params);
  250.         break;
  251.     case ACTION_BACKGROUND:
  252.         Do_Background(bwin->action[btn-1][mod].params);
  253.         break;
  254.     case ACTION_DESKTOP:
  255.         Do_DesktopSwitch(bwin->action[btn-1][mod].params);
  256.         break;
  257.     case ACTION_MOUSEFOCUS:
  258.         Do_ChangeMouseFocus(bwin->action[btn-1][mod].params);
  259.         break;
  260.     case ACTION_WINDOWOP:
  261.         PerformWindowOp(ParamToInt(bwin->action[btn-1][mod].params));
  262.         break;
  263.     case ACTION_MOUSECURSOR:
  264.         Do_ChangeMouseCursor(bwin->action[btn-1][mod].params);
  265.         break;
  266.     default:
  267.         btmd.bwin=bwin;
  268.         break;
  269.    }
  270.    return;
  271. }
  272.  
  273. void Do_DesktopSwitch(char *desktop) {
  274.  
  275.     /* Added 07/20/97 by mandrake (mandrake@mandrake.net) */
  276.     int n1;
  277.  
  278.     sscanf(desktop,"%i",&n1);
  279.     ChangeToDesk(n1);
  280.  
  281. }
  282.  
  283.  
  284. void Do_Background(char *background) {
  285.  
  286.     /* Added 07/20/97 by mandrake (mandrake@mandrake.net) */
  287.  
  288.     int n1,n2;
  289.     char s[1024];
  290.  
  291.     sscanf(background,"%i %i %s",&n1,&n2,s);
  292.     strcpy(desk.background[desk.current],s);
  293.     if (desk.bg_pmap[desk.current])
  294.           ImlibFreePixmap(imd,desk.bg_pmap[desk.current]);
  295.     desk.bg_pmap[desk.current]=0;
  296.     desk.bg_width[desk.current]=n1;
  297.     desk.bg_height[desk.current]=n2;
  298.     SetRoot();
  299.  
  300. }
  301.  
  302.  
  303. void RunContents(int action_id, char *params) {
  304.     /* Slight speedup */
  305.     if(action_id < ACTION_DESKTOP) switch(action_id) {
  306.         case ACTION_RAISE: 
  307.             if(params) 
  308.                 Do_RaiseFromMenu(params);
  309.             break;
  310.         case ACTION_EXEC: 
  311.             if(params) 
  312.                 Do_Exec(params);
  313.             break; 
  314.         case ACTION_EXIT: 
  315.             Do_Exit();
  316.             break;
  317.         case ACTION_RESTART: 
  318.             Do_Restart();
  319.             break;
  320.         case ACTION_RESTART_THEME: 
  321.             if(params) 
  322.                 Do_Restart_Theme(params);
  323.             break;
  324.         case ACTION_BACKGROUND: 
  325.             if(params) 
  326.                 Do_Background(params);
  327.             break;
  328.         default: 
  329.             break;
  330.     } else switch(action_id) {
  331.         case ACTION_DESKTOP: 
  332.             if(params) 
  333.                 Do_DesktopSwitch(params);
  334.             break;
  335.         case ACTION_CYCLE_NEXT: 
  336.             CycleToNextWindow();
  337.             break;
  338.         case ACTION_CYCLE_PREV: 
  339.             CycleToPreviousWindow();
  340.             break;
  341.         case ACTION_NEXT_DESK: 
  342.             NextDesk();
  343.             break;
  344.         case ACTION_PREV_DESK: 
  345.             PrevDesk();
  346.             break;
  347.         case ACTION_MOUSEFOCUS: 
  348.             if(params) 
  349.                 Do_ChangeMouseFocus(params);
  350.             break;
  351.         case ACTION_WINDOWOP: 
  352.             if(params) 
  353.                 PerformWindowOp(ParamToInt(params));
  354.             break;
  355.         default: 
  356.             break;
  357.     }
  358. }
  359.  
  360.  
  361. void DoMenu(Menu *m, int num) {
  362.     if(!m) 
  363.         return;
  364.     /* Let's do a lil' minor speedup here too */
  365. if(m->items[num]->action.id < ACTION_BACKGROUND)
  366.  switch(m->items[num]->action.id)
  367.      {
  368.      case ACTION_RAISE: Do_RaiseFromMenu(m->items[num]->action.params);
  369.           break;
  370.      case ACTION_EXEC: Do_Exec(m->items[num]->action.params);
  371.           break;
  372.      case ACTION_EXIT: Do_Exit();
  373.           break;
  374.      case ACTION_RESTART: Do_Restart();
  375.           break;
  376.      case ACTION_RESTART_THEME: Do_Restart_Theme(m->items[num]->action.params);
  377.           break;
  378.      default: break;
  379.      }
  380.  else
  381.  switch(m->items[num]->action.id)
  382.     {
  383.      case ACTION_BACKGROUND: Do_Background(m->items[num]->action.params);
  384.           break;
  385.      case ACTION_DESKTOP: Do_DesktopSwitch(m->items[num]->action.params);
  386.           break;
  387.      case ACTION_MOUSEFOCUS: Do_ChangeMouseFocus(m->items[num]->action.params);
  388.           break;
  389.      case ACTION_WINDOWOP: PerformWindowOp(ParamToInt(
  390.                            m->items[num]->action.params));
  391.           break;
  392.      default: break;
  393.     }
  394. }
  395.  
  396. void Do_RaiseFromMenu(char *itemtoraise) {
  397.     
  398.     /* 07/24/97 modified to use window id by Troy Pesola (trp@cyberoptics.com)*/
  399.     /* created 07/21/97 by mandrake (mandrake@mandrake.net) */
  400.     /* code initially by Troy Pesola (trp@cyberoptics.net) */
  401.  
  402.     struct list *l;
  403.     EWin *ewin;
  404.     int x,y,i;
  405.     XWindowAttributes xatt;
  406.  
  407.     /* check if the param is a number */
  408.     if (isdigit(*itemtoraise)) {
  409.         Window www;
  410.         sscanf(itemtoraise,"%lu",&www);
  411.         ewin = ListGetWinID(global_l,www);
  412.     } else 
  413.         ewin=NULL;
  414.     if (!ewin) {
  415.         /* search for a title if we still don't know which window */
  416.         for (l=global_l->first; l; l=l->next) {
  417.             if (!strcmp(l->win->title,itemtoraise))
  418.                 break;
  419.         }
  420.         ewin = (l)?l->win:NULL;
  421.     }
  422.  
  423.     /* raise the window and warp the cursor */
  424.     if (ewin) {
  425.         for (i=0;i<cfg.num_subwins;i++) {
  426.             if (cfg.subwin_type[i]==2) {
  427.                 XGetWindowAttributes(disp,ewin->subwins[i],&xatt);
  428.                 x=ewin->frame_x+xatt.x+(xatt.width/2);
  429.                 y=ewin->frame_y+xatt.y+(xatt.height/2);
  430.                 i=64;
  431.             }
  432.         }
  433.         XWarpPointer(disp,None,root,0,0,1,1,x,y);
  434.         FocWin(ewin->client_win,1);
  435.         Do_RaiseWin(ewin);
  436.         evmd.ewin=ewin;
  437.         evmd.wbtn=-1;
  438.         evmd.mode=MODE_NORMAL;
  439.     }
  440. }
  441.  
  442. void DoIcon(Icon *icon, int btn, int mod)
  443. {
  444.    EWin *ewin;
  445.  /* if it wasnt a left, middle or right mouse button... ignore it */
  446.  if ((btn<1)||(btn>3)) return;
  447.  if(icfg.action[btn-1][mod].id < ACTION_EXEC)
  448.  switch(icfg.action[btn-1][mod].id)
  449.     {
  450.      case ACTION_ICONIFY: Do_RaiseWin(icon->ewin);
  451.           break;
  452.      case ACTION_KILL: Do_KillWin(icon->ewin,0);
  453.           break;
  454.      case ACTION_CONFIGURE: Do_Configure();
  455.           break;
  456.      case ACTION_MENU: Do_MenuWin(icon->ewin);
  457.           break;
  458.      default: break;
  459.     }
  460.  else
  461.  switch(icfg.action[btn-1][mod].id)
  462.     {
  463.      case ACTION_EXEC: Do_Exec(icfg.action[btn-1][mod].params);
  464.          break;
  465.      case ACTION_KILL_NASTY: Do_KillWin(icon->ewin,1);
  466.          break;
  467.      case ACTION_DRAG: 
  468.        ewin = icon->ewin;
  469.        StartIconDrag(icon->ewin);
  470.            if (ewin->desk==desk.current)
  471.          {
  472.         XMapWindow(disp,ewin->frame_win);
  473.         Do_RaiseWin(ewin);
  474.          }
  475.          break;
  476.      case ACTION_WINDOWOP:
  477.         PerformWindowOp(ParamToInt(icfg.action[btn-1][mod].params));
  478.          break;
  479.      default: break;
  480.        }
  481. }
  482.  
  483. void Draw_Cursor(EWin *ewin, int a, int b, char ch, int start) {
  484.     static Cursor cursor;
  485.     static Pixmap pix, mask;
  486.     static GC cursorgc;
  487.     XGCValues gv;
  488.     static XSetWindowAttributes attr;
  489.     unsigned long msk;
  490.     char font_string[512];
  491.     char geom[32];
  492.     static int height, width, ow, oh;
  493.     static XColor col, col2;
  494.     static XFontStruct *font;
  495.     char *neg;
  496.     unsigned int wid, hgt;
  497.  
  498.     if(start==1) {    
  499.         sprintf(font_string,"-*-%s-%s-%s-*-*-%i-*-*-*-*-*-*-*",
  500.         cfg.font,font_weight,font_slant,ccfg.num_size);
  501.         font=XLoadQueryFont(disp,font_string);
  502.         if (!font) 
  503.             return;
  504.         height = font->max_bounds.ascent+font->max_bounds.descent + 2;
  505.         width = 10*(font->max_bounds.rbearing-font->max_bounds.lbearing);
  506. #ifdef BROKEN_XSERVER
  507.         if (width>CURSOR_MAX_WIDTH) width=CURSOR_MAX_WIDTH;
  508.         if (height>CURSOR_MAX_HEIGHT) height=CURSOR_MAX_HEIGHT;
  509. #else
  510.         XQueryBestCursor(disp,root,width,height,&wid,&hgt);
  511.         if (width>wid) width=wid;
  512.         if (height>hgt) height=hgt;
  513. #endif
  514.         pix = XCreatePixmap(disp, root, width, height, 1);
  515.         mask = XCreatePixmap(disp, root, width, height, 1);
  516.         msk = GCFont|GCForeground;
  517.         gv.foreground=0;
  518.         gv.font=font->fid;
  519.         ow=0; oh=0;
  520.         cursorgc=XCreateGC(disp, pix, msk, &gv);
  521.         col.red=(ccfg.num_fg_r<<8)|ccfg.num_fg_r;
  522.         col.green=(ccfg.num_fg_g<<8)|ccfg.num_fg_g;
  523.         col.blue=(ccfg.num_fg_b<<8)|ccfg.num_fg_b;
  524.         col2.red=(ccfg.num_bg_r<<8)|ccfg.num_bg_r;
  525.         col2.green=(ccfg.num_bg_g<<8)|ccfg.num_bg_g;
  526.         col2.blue=(ccfg.num_bg_b<<8)|ccfg.num_bg_b;
  527.         XAllocColor(disp, root_cmap, &col);
  528.         XAllocColor(disp, root_cmap, &col2);
  529.         XFillRectangle(disp, mask, cursorgc, 0, 0, width, height);
  530.         XFillRectangle(disp, pix, cursorgc, 0, 0, width, height);
  531.     } else if (start==2) {
  532.         XFreeCursor(disp, cursor);
  533.         XDefineCursor(disp, ewin->frame_win,None);
  534.         XFreeGC(disp, cursorgc);
  535.         ImlibFreePixmap(imd, pix);
  536.         ImlibFreePixmap(imd, mask);
  537.         XFreeFont(disp, font);
  538.         return;
  539.     }
  540.     if(!font) 
  541.         return;
  542.     if(ow!=a || oh!=b || start==1) {
  543.         neg = "";
  544.         if(a>=0 && ch == '+')
  545.             neg = "+";
  546.         else if(ch == '+') {
  547.             neg = "-";
  548.             a *= -1;
  549.         }
  550.         if(b<0) {
  551.             ch = '-';
  552.             b *= -1;
  553.         }
  554.         sprintf(geom, "%s%d%c%d", neg, a, ch, b);
  555.         msk = strlen(geom);
  556.         hgt = font->max_bounds.ascent;
  557.         XSetForeground(disp, cursorgc, 1);
  558.         XDrawString(disp, pix, cursorgc, 0, hgt, geom, msk);
  559.         XDrawString(disp, pix, cursorgc, 0, hgt+2, geom, msk);
  560.         XDrawString(disp, pix, cursorgc, 2, hgt, geom, msk);
  561.         XDrawString(disp, pix, cursorgc, 2, hgt+2, geom, msk);
  562.  
  563.         XCopyArea(disp, pix, mask, cursorgc, 0, 0, width, height, 0, 0);
  564.  
  565.         XDrawString(disp, mask, cursorgc, 1, hgt+1, geom, msk);
  566.         XSetForeground(disp, cursorgc, 0);
  567.         XDrawString(disp, pix, cursorgc, 1, hgt+1, geom, msk);
  568.  
  569.         if (cursor) 
  570.             XFreeCursor(disp, cursor);
  571.         cursor = XCreatePixmapCursor(disp, pix, mask, &col2, &col, 0, 0);
  572.         msk = CWCursor;
  573.         attr.cursor = cursor;
  574.         XChangeWindowAttributes(disp, ewin->frame_win, msk, &attr);
  575.  
  576.         XFillRectangle(disp, mask, cursorgc, 0, 0, width, height);
  577.         XFillRectangle(disp, pix, cursorgc, 0, 0, width, height);
  578.         ow = (evmd.x2-evmd.ewin->base_width)/evmd.ewin->sizeinc_x;
  579.         oh = (evmd.y2-evmd.ewin->base_height)/evmd.ewin->sizeinc_y;
  580.     }
  581. }
  582.