See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Image:Xhole.png - Wikipedia, the free encyclopedia

Image:Xhole.png

From Wikipedia, the free encyclopedia

[edit] Summary

A window with a hole in the middle. Used to illustrate the X Window shape extension. The decorative frames etc. are generated by twm. The program that creates this window is below; it has been written by User:Tizio, who release it in the public domain. I have took the screenshot myself.

/*
  xhole.c

A sample application using the shape extension.
Creates a window with a hole in the middle. Works
with twm, fvwm, and mwm, but kde refuses to add
a title bar to it.
*/

#include<X11/Xlib.h>
#include<X11/extensions/shape.h>

int main() {
  Display *d;
  int s;
  Window w;
  Pixmap p;
  GC gw, gp;
  XEvent e;
  int x, y;

                        /* open connection with the server */
  d=XOpenDisplay(NULL);
  if(d==NULL) {
    printf("Cannot open display\n");
    exit(1);
  }
  s=DefaultScreen(d);
  gw=DefaultGC(d, s);

                        /* create window, select events, map  */
  w=XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 300, 200, 1,
                        BlackPixel(d, s), WhitePixel(d, s));
  XSelectInput(d, w, ExposureMask | KeyPressMask | ButtonPressMask);
  XStoreName(d, w, "XHole");
  XMapWindow(d, w);

                        /* create the pixmap that specifies the shape */
  p=XCreatePixmap(d, w, 400, 300, 1);
  gp=XCreateGC(d, p, 0, NULL);
  XSetForeground(d, gp, WhitePixel(d, s));
  XFillRectangle(d, p, gp, 0, 0, 400, 300);
  XSetForeground(d, gp, BlackPixel(d, s));
  XFillArc(d, p, gp, 120, 100, 100, 100, 0, 360*64);

                        /* set the pixmap as the new window mask;
                        the pixmap is slightly larger than the window
                        to allow for the window border and title bar
                        (as added by the window manager) to be visible */
  XShapeCombineMask(d, w, ShapeBounding, -20, -50, p, ShapeSet);

                        /* event polling loop */
  while(1) {
    XNextEvent(d, &e);
                        /* draw or redraw the window */
    if(e.type==Expose) {
      /* not the correct way of drawing text... */
      for(y=10; y<=210; y+=11)
        for(x=0; x<300; x+=25)
          XDrawString(d, w, gw, x, y, "test", 4);
    }

                        /* exit on button press */
    if(e.type==ButtonPress)
      break;
  }

                        /* close connection to display */
  XCloseDisplay(d);

  return 0;
}

[edit] Licensing

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current20:38, 11 January 2006433×384 (8 KB)Tizio (Talk | contribs) (Cleaner version)
13:08, 2 January 2006448×387 (8 KB)Tizio (Talk | contribs) (A window with a hole in the middle. Used to illustrate the X Window shape extension.)

The following pages on the English Wikipedia link to this file (pages on other projects are not listed):


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -