Esempio n. 1
0
File: iclass.c Progetto: Limsik/e17
static void
ImagestateColorsAlloc(ImageState * is)
{
   if (!is || is->got_colors)
      return;

   is->bg_pixel = EAllocColor(WinGetCmap(VROOT), is->bg);
   is->hi_pixel = EAllocColor(WinGetCmap(VROOT), is->hi);
   is->lo_pixel = EAllocColor(WinGetCmap(VROOT), is->lo);
   is->hihi_pixel = EAllocColor(WinGetCmap(VROOT), is->hihi);
   is->lolo_pixel = EAllocColor(WinGetCmap(VROOT), is->lolo);

   is->got_colors = 1;
}
Esempio n. 2
0
File: x.c Progetto: Limsik/e17
Win
ECreateWinFromXwin(Window xwin)
{
   Win                 win;
   Window              rr;
   int                 x, y;
   unsigned int        w, h, bw, depth;

   if (!XGetGeometry(disp, xwin, &rr, &x, &y, &w, &h, &bw, &depth))
      return NULL;

   win = EXidCreate();
   if (!win)
      return NULL;

   win->xwin = xwin;
   win->x = x;
   win->y = y;
   win->w = w;
   win->h = h;
   win->depth = depth;
   win->visual = WinGetVisual(VROOT);
   win->cmap = WinGetCmap(VROOT);
#if DEBUG_XWIN
   Eprintf("EXidWFX: %p %#lx\n", win, win->xwin);
#endif

   return win;
}
Esempio n. 3
0
File: x.c Progetto: Limsik/e17
/*
 * create a window which will accept the keyboard focus when no other 
 * windows have it
 */
Win
ECreateFocusWindow(Win parent, int x, int y, int w, int h)
{
   Win                 win;
   XSetWindowAttributes attr;

   attr.backing_store = NotUseful;
   attr.override_redirect = False;
   attr.colormap = WinGetCmap(VROOT);
   attr.border_pixel = 0;
   attr.background_pixel = 0;
   attr.save_under = False;
   attr.event_mask = KeyPressMask | FocusChangeMask;

   Window              xwin, xpar;

   win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
		       CopyFromParent,
		       CWOverrideRedirect | CWSaveUnder | CWBackingStore |
		       CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
		       &attr);

   XSetWindowBackground(disp, win, 0);
   XMapWindow(disp, win);
   XSetInputFocus(disp, win, RevertToParent, CurrentTime);

   return win;
}
Esempio n. 4
0
static              EX_Cursor
ECreatePixmapCursor(EX_Pixmap cpmap, EX_Pixmap cmask,
		    unsigned int w __UNUSED__, unsigned int h __UNUSED__,
		    int xh, int yh, unsigned int fg, unsigned int bg)
{
   EX_Cursor           curs;
   XColor              fgxc, bgxc;

   COLOR32_TO_RGB16(fg, fgxc.red, fgxc.green, fgxc.blue);
   COLOR32_TO_RGB16(bg, bgxc.red, bgxc.green, bgxc.blue);
   XAllocColor(disp, WinGetCmap(VROOT), &fgxc);
   XAllocColor(disp, WinGetCmap(VROOT), &bgxc);

   curs = XCreatePixmapCursor(disp, cpmap, cmask, &fgxc, &bgxc, xh, yh);

   return curs;
}
Esempio n. 5
0
void
_xft_FdcSetColor(TextState * ts, unsigned int color)
{
   FontCtxXft         *fdc = (FontCtxXft *) ts->fdc;
   XRenderColor        xrc;

   COLOR32_TO_ARGB16(color, xrc.alpha, xrc.red, xrc.green, xrc.blue);

   XftColorAllocValue(disp, WinGetVisual(fdc->win), WinGetCmap(fdc->win),
		      &xrc, &(fdc->xftc));
}
Esempio n. 6
0
int
_xft_FdcInit(TextState * ts, Win win, EX_Drawable draw)
{
   FontCtxXft         *fdc = (FontCtxXft *) ts->fdc;

   fdc->win = win;
   fdc->draw = draw;

   fdc->xftd = XftDrawCreate(disp, draw, WinGetVisual(win), WinGetCmap(win));
   if (!fdc->xftd)
      return -1;
   return 0;
}
Esempio n. 7
0
static              Window
ExtInitWinMain(void)
{
   int                 i, loop, err;
   Ecore_X_Window      win;
   XGCValues           gcv;
   GC                  gc;
   Pixmap              pmap;
   Atom                a;
   EiwData             eiwd;
   EiwLoopFunc        *eiwc_loop_func;

   if (EDebug(EDBUG_TYPE_SESSION))
      Eprintf("ExtInitWinMain enter\n");

   err = EDisplayOpen(NULL, -1);
   if (err)
      return None;

   EGrabServer();

   EImageInit();

   eiwd.attr.backing_store = NotUseful;
   eiwd.attr.override_redirect = True;
   eiwd.attr.colormap = WinGetCmap(VROOT);
   eiwd.attr.border_pixel = 0;
   eiwd.attr.background_pixel = 0;
   eiwd.attr.save_under = True;
   win = XCreateWindow(disp, WinGetXwin(VROOT),
		       0, 0, WinGetW(VROOT), WinGetH(VROOT),
		       0, CopyFromParent, InputOutput, CopyFromParent,
		       CWOverrideRedirect | CWSaveUnder | CWBackingStore |
		       CWColormap | CWBackPixel | CWBorderPixel, &eiwd.attr);

   pmap = XCreatePixmap(disp, win,
			WinGetW(VROOT), WinGetH(VROOT), WinGetDepth(VROOT));
   gcv.subwindow_mode = IncludeInferiors;
   gc = XCreateGC(disp, win, GCSubwindowMode, &gcv);
   XCopyArea(disp, WinGetXwin(VROOT), pmap, gc,
	     0, 0, WinGetW(VROOT), WinGetH(VROOT), 0, 0);
   XSetWindowBackgroundPixmap(disp, win, pmap);
   XMapRaised(disp, win);
   XFreePixmap(disp, pmap);
   XFreeGC(disp, gc);

   a = EInternAtom("ENLIGHTENMENT_RESTART_SCREEN");
   ecore_x_window_prop_window_set(WinGetXwin(VROOT), a, &win, 1);

   XSelectInput(disp, win, StructureNotifyMask);

   EUngrabServer();
   ESync(0);

#if USE_EIWC_WINDOW && USE_EIWC_RENDER
   eiwc_loop_func = _eiw_render_init(win, &eiwd);
   if (!eiwc_loop_func)
      eiwc_loop_func = _eiw_window_init(win, &eiwd);
#elif USE_EIWC_RENDER
   eiwc_loop_func = _eiw_render_init(win, &eiwd);
#elif USE_EIWC_WINDOW
   eiwc_loop_func = _eiw_window_init(win, &eiwd);
#endif
   if (!eiwc_loop_func)
      return None;

   {
      XWindowAttributes   xwa;
      char                s[1024];
      EImage             *im;

      for (i = loop = 1;; i++, loop++)
	{
	   if (i > 12)
	      i = 1;

	   /* If we get unmapped we are done */
	   XGetWindowAttributes(disp, win, &xwa);
	   if (xwa.map_state == IsUnmapped)
	      break;

	   Esnprintf(s, sizeof(s), "pix/wait%i.png", i);
	   if (EDebug(EDBUG_TYPE_SESSION) > 1)
	      Eprintf("ExtInitWinCreate - child %s\n", s);

	   im = ThemeImageLoad(s);
	   if (im)
	     {
		eiwc_loop_func(win, im, &eiwd);
		EImageFree(im);
	     }
	   ESync(0);
	   usleep(50000);

	   /* If we still are here after 5 sec something is wrong. */
	   if (loop > 100)
	      break;
	}
   }

   if (EDebug(EDBUG_TYPE_SESSION))
      Eprintf("ExtInitWinMain exit\n");

   EDisplayClose();

   exit(0);
}