Example #1
0
File: mouse.c Project: dvdhoo/wine
/***********************************************************************
 *		set_window_cursor
 */
void set_window_cursor( struct x11drv_win_data *data, HCURSOR handle )
{
    Cursor cursor, prev;

    wine_tsx11_lock();
    if (!handle) cursor = get_empty_cursor();
    else if (!cursor_context || XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&cursor ))
    {
        /* try to create it */
        wine_tsx11_unlock();
        if (!(cursor = create_cursor( handle ))) return;

        wine_tsx11_lock();
        if (!cursor_context) cursor_context = XUniqueContext();
        if (!XFindContext( gdi_display, (XID)handle, cursor_context, (char **)&prev ))
        {
            /* someone else was here first */
            XFreeCursor( gdi_display, cursor );
            cursor = prev;
        }
        else
        {
            XSaveContext( gdi_display, (XID)handle, cursor_context, (char *)cursor );
            TRACE( "cursor %p created %lx\n", handle, cursor );
        }
    }

    XDefineCursor( gdi_display, data->whole_window, cursor );
    /* make the change take effect immediately */
    XFlush( gdi_display );
    data->cursor = handle;
    wine_tsx11_unlock();
}
Example #2
0
File: DragBS.c Project: att/uwin
/*
 * cache the atoms table
 */
static void
set_targets_table(Display *display, XmDndTargetsTable table)
{
    XmDndTargetsTable targets;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:set_targets_table(%d) - %p\n",
		      __FILE__, __LINE__, table));

    if (displayToTargets == (XContext)0)
    {
	displayToTargets = XUniqueContext();
    }

    if (XFindContext(display, DefaultRootWindow(display),
		     displayToTargets, (XPointer *)&targets) == XCSUCCESS)
    {

	if (targets == table)
	{
	    return;
	}

	XDeleteContext(display, DefaultRootWindow(display),
		       displayToTargets);
    }

    XSaveContext(display, DefaultRootWindow(display),
		 displayToTargets, (XPointer)table);
}
Example #3
0
File: tray.c Project: guns/subtle
SubTray *
subTrayNew(Window win)
{
  SubTray *t = NULL;

  assert(win);

  /* Create new tray */
  t = TRAY(subSharedMemoryAlloc(1, sizeof(SubTray)));
  t->flags = SUB_TYPE_TRAY;
  t->win   = win;
  t->width = subtle->ph; ///< Default width

  /* Update tray properties */
  subSharedPropertyName(subtle->dpy, win, &t->name, PKG_NAME);
  subEwmhSetWMState(t->win, WithdrawnState);
  XSelectInput(subtle->dpy, t->win, TRAYMASK);
  XReparentWindow(subtle->dpy, t->win, subtle->windows.tray, 0, 0);
  XAddToSaveSet(subtle->dpy, t->win);
  XSaveContext(subtle->dpy, t->win, TRAYID, (void *)t);

  /* Start embedding life cycle */
  subEwmhMessage(t->win, SUB_EWMH_XEMBED, 0xFFFFFF, CurrentTime,
    XEMBED_EMBEDDED_NOTIFY, 0, subtle->windows.tray, 0);

  subSharedLogDebugSubtle("new=tray, name=%s, win=%#lx\n", t->name, win);

  return t;
} /* }}} */
Example #4
0
/*----------------------------------------------------------------------
 * wCoreCreate--
 * 	Creates a brand new child window.
 * 	The window will have a border width of 0 and color is black.
 *
 * Returns:
 * 	A initialized core window structure.
 *
 * Side effects:
 * 	A window context for the created window is saved.
 *
 * Notes:
 * 	The event mask is initialized to a default value.
 *--------------------------------------------------------------------- */
WCoreWindow *wCoreCreate(WCoreWindow *parent, int x, int y, int width, int height)
{
	WCoreWindow *core;
	int vmask;
	XSetWindowAttributes attribs;

	core = wmalloc(sizeof(WCoreWindow));

	vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap;
	attribs.cursor = wCursor[WCUR_DEFAULT];
	attribs.background_pixmap = None;
	attribs.background_pixel = parent->screen_ptr->black_pixel;
	attribs.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
			     ButtonReleaseMask | ButtonMotionMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask;
	attribs.colormap = parent->screen_ptr->w_colormap;
	core->window = XCreateWindow(dpy, parent->window, x, y, width, height, 0,
			  parent->screen_ptr->w_depth, CopyFromParent,
			  parent->screen_ptr->w_visual, vmask, &attribs);

	core->width = width;
	core->height = height;
	core->screen_ptr = parent->screen_ptr;
	core->descriptor.self = core;

	XSaveContext(dpy, core->window, wWinContext, (XPointer) & core->descriptor);
	return core;
}
Example #5
0
File: DragBS.c Project: att/uwin
/*
 * cache the atoms table
 */
static void
set_atoms_table(Display *display, XmDndAtomsTable table)
{
    XmDndAtomsTable atoms;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:set_atoms_table(%d)\n",
		      __FILE__, __LINE__));

    if (displayToAtoms == (XContext)0)
	displayToAtoms = XUniqueContext();

    if (XFindContext(display, DefaultRootWindow(display),
		     displayToAtoms, (XPointer *)&atoms) == XCSUCCESS)
    {
	if (atoms == table)
	{
	    return;
	}

	XDeleteContext(display, DefaultRootWindow(display),
		       displayToAtoms);
    }

    XSaveContext(display, DefaultRootWindow(display),
		 displayToAtoms, (XPointer)table);
}
Example #6
0
Bool container_client_add(container_t *container, client_t *client) {
  XWindowAttributes attr;
  int ret;
  container_t *tmp = NULL;

  ret = XFindContext(container->wm->dpy, client->window, container_context,
                     (XPointer*)&tmp);
  if (ret != XCNOENT) {
    wm_log(container->wm, LOG_INFO, "%s: ignoring attempt to add container as a client: %d", __func__, client->window);
    return False;
  }

  /* Ignore the add if this window already belongs to a container */
  ret = XFindContext(container->wm->dpy, client->window, client_container_context,
                     (XPointer*)&tmp);
  if (ret != XCNOENT) {
    wm_log(container->wm, LOG_INFO, "%s: window %d already in a container, ignoring mapnotify", __func__, client->window);
    return False;
  }

  wm_log(container->wm, LOG_INFO, "%s: client add window %d", __func__, client->window);
  XAddToSaveSet(container->wm->dpy, client->window);
  XGetWindowAttributes(container->wm->dpy, container->frame, &attr);
  XSetWindowBorderWidth(container->wm->dpy, client->window, 0);
  XSelectInput(container->wm->dpy, client->window, CLIENT_EVENT_MASK);
  XReparentWindow(container->wm->dpy, client->window, container->frame, 0, TITLE_HEIGHT);
  XResizeWindow(container->wm->dpy, client->window, attr.width, attr.height - TITLE_HEIGHT);
  XSaveContext(container->wm->dpy, client->window, client_container_context, (XPointer)container);

  //container_paint(container);
  container_client_show(container, client);
  return True;
}
Example #7
0
void wcore_map_toplevel(WCoreWindow *core, virtual_screen *vscr, int x, int y,
			int width, int height, int bwidth, int depth,
			Visual *visual, Colormap colormap, WMPixel border_pixel)
{
	int vmask;
	XSetWindowAttributes attribs;

	vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap;
	attribs.override_redirect = True;
	attribs.cursor = wPreferences.cursor[WCUR_NORMAL];
	attribs.background_pixmap = None;
	attribs.background_pixel = vscr->screen_ptr->black_pixel;
	attribs.border_pixel = border_pixel;
	attribs.event_mask = SubstructureRedirectMask | ButtonPressMask |
			     ButtonReleaseMask | ButtonMotionMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask;

	attribs.colormap = colormap;

	if (wPreferences.use_saveunders) {
		vmask |= CWSaveUnder;
		attribs.save_under = True;
	}

	core->window = XCreateWindow(dpy, vscr->screen_ptr->root_win, x, y, width, height,
				     bwidth, depth, CopyFromParent, visual, vmask, &attribs);
	core->descriptor.self = core;

	XClearWindow(dpy, core->window);
	XSaveContext(dpy, core->window, w_global.context.client_win, (XPointer) & core->descriptor);
}
Example #8
0
File: dock.c Project: Cougar/pwm
static bool do_create_dock(WDock *dock, int x, int y, int flags)
{
	Window win;
	
	flags|=WTHING_UNFOCUSABLE;
	
	dock->x=x;
	dock->y=y;
	dock->w=DOCKWIN_W;
	dock->h=DOCKWIN_H;
	
	win=create_simple_window(x, y, dock->w, dock->h,
							 GRDATA->base_colors.pixels[WCG_PIX_BG]);
	
	dock->flags|=flags;
	dock->win=win;
	dock->dockwin_count=0;
	dock->max_vis_dockwin=1;
	dock->dock_w=1;
	dock->dock_h=1;
	SCREEN->dock=dock;
	
	XSelectInput(wglobal.dpy, win, DOCK_MASK);
	XSaveContext(wglobal.dpy, win, wglobal.win_context, (XPointer)dock);

	grab_bindings(win, ACTX_DOCKWIN|ACTX_GLOBAL);

	add_winobj((WWinObj*)dock, WORKSPACE_STICKY, LVL_KEEP_ON_TOP);
	
	return TRUE;
}
Example #9
0
void UrlBar::createXWindow(Window parent, XContext context)
{
    m_window = XCreateSimpleWindow(m_display, parent, m_size.origin.x, m_size.origin.y, m_size.size.width, m_size.size.height, 1, createXColor("#C1C1C1"), WhitePixel(m_display, 0));

    XSelectInput(m_display, m_window, ExposureMask | ButtonPressMask | ButtonReleaseMask);
    XSaveContext(m_display, m_window, context, (XPointer)this);
    XMapWindow(m_display, m_window);
}
static void
set_window_surface (x_global_t *xg, Window wid, cairo_5c_surface_t *c5s)
{
    if (c5s == NULL)
	XDeleteContext (xg->dpy, wid, xg->context);
    else
	XSaveContext (xg->dpy, wid, xg->context, (XPointer) c5s);
}
Boolean
xawt_addWindow (JNIEnv *env, Window window, jobject object)
{

  XPointer obj = (XPointer)(*env)->NewGlobalRef(env, object);

  return (XSaveContext(xawt_display, window, xawt_context, obj) == 0);
}
Example #12
0
void AppendMenuItem(Menu *menu,char *name,void *data,short type)
{
  MenuItem *item;
  XSetWindowAttributes wattr;
  int width;

  item=MyCalloc(1,sizeof(MenuItem));
  item->y=menu->height;
  item->menu=menu;

  if((item->type=type)==I_LINE) {
    menu->height+=2*MENUBORDERW;
    item->win=None;
    item->name=linename;
  } else {
    item->name=MyCalloc(strlen(name)+1,sizeof(char));
    strcpy(item->name,name);
    item->data=data;

    width=XTextWidth(menu->font,item->name,strlen(item->name)) +\
                                    4 * MENUBORDERW + 2*MENUXOFS;
    if(item->type==I_SUBMENU) width+=7*MENUBORDERW;
    if((item->type==I_SWITCH_ON)||(item->type==I_SWITCH_OFF))
      width+=6*MENUBORDERW;
    if(width>menu->width) {
      Node *mi=NULL;
      menu->width=width;
      while((mi=NodeNext(menu->Items,mi)))
        if(((MenuItem *)(mi->data))->type!=I_LINE)
          XResizeWindow(disp,((MenuItem *)(mi->data))->win,\
                menu->width-2*MENUBORDERW,menu->ItemHeight);
    }

    wattr.background_pixel=TheScreen.Colors[TheScreen.desktop.ActiveWorkSpace]\
                                                              [UDE_Back].pixel;
    wattr.backing_store=WhenMapped;
    wattr.override_redirect=True;
    item->win=XCreateWindow(disp,menu->win,MENUBORDERW,menu->height-MENUBORDERW\
                   ,menu->width-2*MENUBORDERW,menu->ItemHeight,0,CopyFromParent,
                                                     InputOutput,CopyFromParent,
                              (TheScreen.DoesBackingStore ? CWBackingStore : 0)|
                                         CWBackPixel|CWOverrideRedirect,&wattr);

    XSelectInput(disp, item->win, EnterWindowMask|ExposureMask);

    menu->height+=menu->ItemHeight;

    XSaveContext(disp,item->win,TheScreen.MenuContext,(XPointer)item);
  }

  if(!NodeAppend(menu->Items,item))
    SeeYa(1,"FATAL: out of memory!");
  XResizeWindow(disp,menu->win,menu->width,menu->height);
}
Example #13
0
File: screen.c Project: guns/subtle
SubScreen *
subScreenNew(int x,
  int y,
  unsigned int width,
  unsigned int height)
{
  SubScreen *s = NULL;
  XSetWindowAttributes sattrs;
  unsigned long mask = 0;

  /* Create screen */
  s = SCREEN(subSharedMemoryAlloc(1, sizeof(SubScreen)));
  s->flags       = SUB_TYPE_SCREEN;
  s->geom.x      = x;
  s->geom.y      = y;
  s->geom.width  = width;
  s->geom.height = height;
  s->base        = s->geom; ///< Backup size
  s->vid         = subtle->screens->ndata; ///< Init

  /* Create panel windows */
  sattrs.event_mask        = ButtonPressMask|EnterWindowMask|
    LeaveWindowMask|ExposureMask;
  sattrs.override_redirect = True;
  sattrs.background_pixmap = ParentRelative;
  mask                     = CWEventMask|CWOverrideRedirect|CWBackPixmap;

  s->panel1 = XCreateWindow(subtle->dpy, ROOT, 0, 1, 1, 1, 0,
    CopyFromParent, InputOutput, CopyFromParent, mask, &sattrs);
  s->panel2 = XCreateWindow(subtle->dpy, ROOT, 0, 0, 1, 1, 0,
    CopyFromParent, InputOutput, CopyFromParent, mask, &sattrs);

  XSaveContext(subtle->dpy, s->panel1, SCREENID, (void *)s);
  XSaveContext(subtle->dpy, s->panel2, SCREENID, (void *)s);

  subSharedLogDebugSubtle("new=screen, x=%d, y=%d, width=%u, height=%u\n",
    s->geom.x, s->geom.y, s->geom.width, s->geom.height);

  return s;
} /* }}} */
Example #14
0
void wApplicationDestroy(WApplication * wapp)
{
	WWindow *wwin;
	WScreen *scr;

	if (!wapp)
		return;

	wapp->refcount--;
	if (wapp->refcount > 0)
		return;

	if (wapp->urgent_bounce_timer) {
		WMDeleteTimerHandler(wapp->urgent_bounce_timer);
		wapp->urgent_bounce_timer = NULL;
	}
	if (wapp->flags.bouncing) {
		/* event.c:handleDestroyNotify forced this destroy
		   and thereby overlooked the bounce callback */
		wapp->refcount = 1;
		return;
	}

	scr = wapp->main_window_desc->screen_ptr;

	if (wapp == scr->wapp_list) {
		if (wapp->next)
			wapp->next->prev = NULL;
		scr->wapp_list = wapp->next;
	} else {
		if (wapp->next)
			wapp->next->prev = wapp->prev;
		if (wapp->prev)
			wapp->prev->next = wapp->next;
	}

	XDeleteContext(dpy, wapp->main_window, wAppWinContext);
	wAppMenuDestroy(wapp->menu);

	/* Remove application icon */
	removeAppIconFor(wapp);

	wwin = wWindowFor(wapp->main_window_desc->client_win);

	wWindowDestroy(wapp->main_window_desc);
	if (wwin) {
		/* undelete client window context that was deleted in
		 * wWindowDestroy */
		XSaveContext(dpy, wwin->client_win, wWinContext, (XPointer) & wwin->client_descriptor);
	}
	wfree(wapp);
}
Example #15
0
bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp, 
                WRegionSimpleCreateFn *create_frame_fn, bool ci)
{
    ws->split_tree=NULL;
    ws->create_frame_fn=(create_frame_fn 
                         ? create_frame_fn
                         : create_frame_tiling);
    ws->stdispnode=NULL;
    ws->managed_list=NULL;
    ws->batchop=FALSE;
    
    ws->dummywin=XCreateWindow(ioncore_g.dpy, parent->win,
                                fp->g.x, fp->g.y, 1, 1, 0,
                                CopyFromParent, InputOnly,
                                CopyFromParent, 0, NULL);
    if(ws->dummywin==None)
        return FALSE;

    region_init(&(ws->reg), parent, fp);

    ws->reg.flags|=(REGION_GRAB_ON_PARENT|
                    REGION_PLEASE_WARP);
    
    if(ci){
        WRegionAttachData data;
        WRegion *res;
        
        data.type=REGION_ATTACH_NEW;
        data.u.n.fn=(WRegionCreateFn*)ws->create_frame_fn;
        data.u.n.param=NULL;
    
        res=region_attach_helper((WRegion*)ws, parent, fp,
                                 (WRegionDoAttachFn*)tiling_do_attach_initial, 
                                 NULL, &data);

        if(res==NULL){
            XDestroyWindow(ioncore_g.dpy, ws->dummywin);
            return FALSE;
        }
    }
    
    XSelectInput(ioncore_g.dpy, ws->dummywin,
                 FocusChangeMask|KeyPressMask|KeyReleaseMask|
                 ButtonPressMask|ButtonReleaseMask);
    XSaveContext(ioncore_g.dpy, ws->dummywin, ioncore_g.win_context,
                 (XPointer)ws);
    
    region_register(&(ws->reg));
    region_add_bindmap((WRegion*)ws, mod_tiling_tiling_bindmap);
    
    return TRUE;
}
void
ExternalClientEventHandler (Display *display, Window win, XEvent *event)
{
  if (win != event->xany.window)
    return;
  
  if (event->type == ClientMessage &&
      event->xclient.message_type == a_EXTW_NOTIFY &&
      event->xclient.data.l[0] == extw_shell_send)
    switch (event->xclient.data.l[1]) {
    case extw_notify_gm:
      /* for the moment, just refuse geometry requests. */
      extw_send_notify_3(display, win, extw_notify_gm, XtGeometryNo, 0, 0);
      break;
      
    case extw_notify_init:
      extw_send_notify_3(display, win, extw_notify_init, EXTW_TYPE_XLIB, 0, 0);
      break;
      
    case extw_notify_end:
      XClearArea(display, win, 0, 0, 0, 0, True);
      break;
    }
  else
    {
      int focus_status;
      XPointer current_focus;

      if (event->type == FocusIn)
	focus_status = 1;
      else if (event->type == FocusOut)
	focus_status = 0;
      else if (event->type == EnterNotify &&
	       event->xcrossing.detail != NotifyInferior)
	focus_status = window_has_focus_p(display, win, 1);
      else if (event->type == LeaveNotify &&
	       event->xcrossing.detail != NotifyInferior)
	focus_status = window_has_focus_p(display, win, 0);
      else
	return;
      XFindContext(display, win, focus_context, &current_focus);
      if (focus_status != (int) current_focus)
	{
	  XSaveContext(display, win, focus_context, (XPointer) focus_status);
	  extw_send_notify_3(display, win, focus_status ?
			     extw_notify_focus_in : extw_notify_focus_out,
			     0, 0, 0);
	}
    }
}
void
ExternalClientInitialize (Display *display, Window win)
{
  extw_initialize_atoms(display);
  extw_which_side = extw_client_send;
  if (!context_inited)
    {
      focus_context = XUniqueContext();
      context_inited = 1;
    }
  XSaveContext(display, win, focus_context, 0);
  XSelectInput(display, win, EnterWindowMask | LeaveWindowMask |
	       FocusChangeMask);
}
Example #18
0
static XawVendorShellExtPart *
SetExtPart(VendorShellWidget w, XawVendorShellExtWidget vew)
{
    contextDataRec *contextData;

    if (extContext == (XContext)0) extContext = XUniqueContext();

    contextData = XtNew(contextDataRec);
    contextData->parent = (Widget)w;
    contextData->ve = (Widget)vew;
    if (XSaveContext(XtDisplay(w), (Window)(((intptr_t)w)&0xffffffff), extContext, (char *)contextData)) {
	return(NULL);
    }
    return(&(vew->vendor_ext));
}
Example #19
0
static Widget SetErrCnxt(Widget w, XIM xim)
{
    contextErrDataRec *contextErrData;

    if (errContext == (XContext)0) errContext = XUniqueContext();

    contextErrData = XtNew(contextErrDataRec);
    contextErrData->widget = w;
    contextErrData->xim = xim;
    if (XSaveContext(XtDisplay(w), (Window)(uintptr_t)xim, errContext,
	(char *)contextErrData)) {
	return(NULL);
    }
    return(contextErrData->widget);
}
Example #20
0
void mfb_close(void* window_info)
{
	WindowInfo* info = (WindowInfo*)window_info;

	if (!info->draw_buffer)
		return;

	XSaveContext(s_display, info->window, s_context, (XPointer)0);

	free(info->draw_buffer);

	info->ximage->data = NULL;
	info->draw_buffer = 0;

	XDestroyImage(info->ximage);
	XDestroyWindow(s_display, info->window);
}
Example #21
0
container_t *container_new(wm_t *wm, Window parent, int x, int y,
                           int width, int height) {
  XWindowAttributes attr;
  container_t *container;
  container = xmalloc(sizeof(container_t));
  container->context = XUniqueContext();
  container->frame = mkframe(wm, parent, x, y, width, height);
  //container->title = mktitle(wm, parent, x, y, width, height);
  container->wm = wm;
  container->focused = False;

  XGetWindowAttributes(wm->dpy, parent, &attr);
  container->screen = attr.screen;

  container_create_gc(container);
  XSaveContext(wm->dpy, container->frame, container_context, (XPointer)container);
  return container;
}
Example #22
0
Menu *MenuCreate(char *name)
{
  Menu *menu;
  XSetWindowAttributes wattr;

  if(!(menu=malloc(sizeof(Menu)))) return (NULL);

  if(name) {
    menu->name = MyCalloc(strlen(name)+1, sizeof(char));
    strcpy(menu->name, name);
  } else {
    menu->name = NULL;
  }
  if(!(menu->Items=NodeListCreate()))
    SeeYa(1,"FATAL: out of memory!");
  menu->font=TheScreen.MenuFont;
  menu->width = (menu->name
                 ? XTextWidth(menu->font, menu->name, strlen(menu->name))
		 : 0) + 4 * MENUBORDERW + 2*MENUXOFS;
  menu->ItemHeight=menu->font->ascent + menu->font->descent +
                 2 * MENUBORDERW + 2*MENUYOFS;

  menu->height = (menu->name ? menu->ItemHeight : 0) + 2 * MENUBORDERW;

  wattr.background_pixel=TheScreen.Colors[TheScreen.desktop.ActiveWorkSpace]\
                                                            [UDE_Back].pixel;
  wattr.backing_store=WhenMapped;
  wattr.override_redirect=True;
  wattr.save_under=True;
  menu->win=XCreateWindow(disp, TheScreen.root, 0, 0, menu->width, menu->height,
                               0,CopyFromParent,InputOutput,CopyFromParent,
                               (TheScreen.DoesSaveUnders ? CWSaveUnder : 0)|
                          (TheScreen.DoesBackingStore ? CWBackingStore : 0)|
	                             CWBackPixel|CWOverrideRedirect,&wattr);
  XSelectInput(disp, menu->win, ExposureMask | LeaveWindowMask 
                                | EnterWindowMask | VisibilityChangeMask);

  XSaveContext(disp,menu->win,TheScreen.MenuFrameContext,(XPointer)menu);

  return(menu);
}
Example #23
0
void W_RealizeView(W_View * view)
{
	Window parentWID;
	Display *dpy = view->screen->display;
	W_View *ptr;

	assert(view->size.width > 0);
	assert(view->size.height > 0);

	if (view->parent && !view->parent->flags.realized) {
		wwarning("trying to realize widget of unrealized parent");
		return;
	}

	if (!view->flags.realized) {
		parentWID = view->parent->window;
		view->window = XCreateWindow(dpy, parentWID, view->pos.x, view->pos.y,
					     view->size.width, view->size.height, 0,
					     view->screen->depth, InputOutput,
					     view->screen->visual, view->attribFlags, &view->attribs);

		XSaveContext(dpy, view->window, ViewContext, (XPointer) view);

		view->flags.realized = 1;

		if (view->flags.mapWhenRealized) {
			W_MapView(view);
			view->flags.mapWhenRealized = 0;
		}

		WMPostNotificationName(WMViewRealizedNotification, view, NULL);
	}

	/* realize children */
	ptr = view->childrenList;
	while (ptr != NULL) {
		W_RealizeView(ptr);

		ptr = ptr->nextSister;
	}
}
Example #24
0
File: DragBS.c Project: att/uwin
/*
 * cache (program local) the value of the drag window
 */
static void
set_drag_window(Display *display, Window win)
{
    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:set_drag_window(%d)\n",
		      __FILE__, __LINE__));

    if (displayToDW == None)
    {
	displayToDW = XUniqueContext();
    }

    if (XFindContext(display, DefaultRootWindow(display),
		     displayToDW, (XPointer *)&win) == XCSUCCESS)
    {
	XDeleteContext(display, DefaultRootWindow(display),
		       displayToDW);
    }

    XSaveContext(display, DefaultRootWindow(display),
		 displayToDW, (XPointer)win);
}
Example #25
0
void wcore_map(WCoreWindow *core, WCoreWindow *parent, virtual_screen *vscr,
	       int x, int y, int width, int height, int bwidth, int depth,
	       Visual *visual, Colormap colormap)
{
	int vmask;
	XSetWindowAttributes attribs;

	vmask = CWBorderPixel | CWCursor | CWEventMask | CWColormap;
	attribs.cursor = wPreferences.cursor[WCUR_NORMAL];
	attribs.background_pixmap = None;
	attribs.background_pixel = vscr->screen_ptr->black_pixel;
	attribs.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
			     ButtonReleaseMask | ButtonMotionMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask;
	attribs.colormap = colormap;
	core->window = XCreateWindow(dpy, parent->window, x, y, width, height, bwidth,
				     depth, CopyFromParent, visual, vmask, &attribs);

	core->descriptor.self = core;

	XSaveContext(dpy, core->window, w_global.context.client_win, (XPointer) & core->descriptor);
}
Example #26
0
File: x.c Project: Limsik/e17
static void
EXidAdd(Win win)
{
#if DEBUG_XWIN
   Eprintf("EXidAdd: %p %#lx\n", win, win->xwin);
#endif
   if (!xid_context)
      xid_context = XUniqueContext();

   XSaveContext(disp, win->xwin, xid_context, (XPointer) win);

   if (!win_first)
     {
	win_first = win_last = win;
     }
   else
     {
	win->prev = win_last;
	win_last->next = win;
	win_last = win;
     }
}
Example #27
0
File: UxXt.c Project: juddy/edcde
/******************************************************************************
NAME:           UxPutContext( wgt, context )

INPUT:          Widget  wgt             - Widget
                XtPointer context       - context pointer

RETURN:         int                     UX_ERROR / UX_NO_ERROR

DESCRIPTION:    Uses the X Context manager to store the given context pointer
                in a memory location that is indexed by the given widget id.
                Also adds a destroyCallback to delete that context when the
                widget is destroyed.

EXT REFERENCES: UxTopLevel, xcontext_id
EXT EFFECTS:    xcontext_id

CREATION:       Visual Edge Software            April 6 1991
-----------------------------------------------------------------------------*/
int     UxPutContext( Widget wgt, caddr_t context )
{
        int             status;

        if ( xcontext_id == 0 )
                xcontext_id = XUniqueContext();

        if ( wgt == NULL )
                return ( UX_ERROR );

        status = XSaveContext( XtDisplay( UxTopLevel ),
                               (Window) wgt,
                               xcontext_id,
                               (char *) context );
        if ( status != 0 )
                return ( UX_ERROR );

        XtAddCallback (wgt, XmNdestroyCallback,
                        UxDeleteContextCB, (XtPointer)(XtArgVal) xcontext_id);

        return ( UX_NO_ERROR );
}
Example #28
0
bool window_do_init(WWindow *wwin, WWindow *par, 
                    const WFitParams *fp, Window win, const char *name)
{
    if(win==None){
        assert(par!=NULL);
        win=create_xwindow(region_rootwin_of((WRegion*)par),
                           par->win, &(fp->g), name);
        if(win==None)
            return FALSE;
    }

    wwin->win=win;
    wwin->xic=NULL;
    wwin->event_mask=0;
    wwin->stacking=NULL;
    
    region_init(&(wwin->region), par, fp);
    
    XSaveContext(ioncore_g.dpy, win, ioncore_g.win_context, 
                 (XPointer)wwin);
    
    return TRUE;
}
Example #29
0
XObject* x_frame_create(XObject* parent, int x, int y, unsigned width, unsigned height,
		Bool visible, unsigned bordersize, unsigned long bordercolor, unsigned long background,
		XPointer cbdata)
{
	XObject* f=(XObject*) calloc(1,sizeof(XObject));
	if(!f)
	{
		fprintf(stderr,"Impossible to create window: out of memory!\n");
		exit(OUT_OF_MEMORY);
	}
	f->frame.obj.type=XFRAME;
	f->frame.obj.cbdata=cbdata;
	f->frame.obj.dis=dis;
	f->obj.height=height;
	f->obj.width=width;
	f->frame.x=x;
	f->frame.y=y;
	f->frame.visible=visible;
	f->frame.obj.background=background;
	f->frame.obj.win=XCreateSimpleWindow(dis,parent->obj.win,x,y,width,height,bordersize,bordercolor,background);
	if(!f->frame.obj.win)
	{
		fprintf(stderr,"Failed to create window\n");
		exit(2);
	}
	f->obj.parentwindow=parent->obj.parentwindow;
	f->obj.isfocused=False;
	XSelectInput(dis,f->obj.win,KeyPressMask|ExposureMask);
	f->frame.visible=visible;
	if(f->frame.visible)
	{
		XMapRaised(dis,f->frame.obj.win);
	}

	XSaveContext(dis,f->frame.obj.win,xctxt,(char*)f);
	return f;
}
Example #30
0
/*----------------------------------------------------------------------
 * wCoreCreateTopLevel--
 * 	Creates a toplevel window used for icons, menus and dialogs.
 *
 * Returns:
 * 	The created window.
 *--------------------------------------------------------------------- */
WCoreWindow *wCoreCreateTopLevel(WScreen *screen, int x, int y, int width, int height, int bwidth, int depth, Visual *visual, Colormap colormap, WMPixel border_pixel)
{
	WCoreWindow *core;
	int vmask;
	XSetWindowAttributes attribs;

	core = wmalloc(sizeof(WCoreWindow));

	vmask = CWBorderPixel | CWCursor | CWEventMask | CWOverrideRedirect | CWColormap;
	attribs.override_redirect = True;
	attribs.cursor = wCursor[WCUR_DEFAULT];
	attribs.background_pixmap = None;
	attribs.background_pixel = screen->black_pixel;
	attribs.border_pixel = border_pixel;
	attribs.event_mask = SubstructureRedirectMask | ButtonPressMask |
			     ButtonReleaseMask | ButtonMotionMask |
			     ExposureMask | EnterWindowMask | LeaveWindowMask;

	attribs.colormap = colormap;

	if (wPreferences.use_saveunders) {
		vmask |= CWSaveUnder;
		attribs.save_under = True;
	}

	core->window = XCreateWindow(dpy, screen->root_win, x, y, width, height,
				     bwidth, depth, CopyFromParent, visual, vmask, &attribs);
	core->width = width;
	core->height = height;
	core->screen_ptr = screen;
	core->descriptor.self = core;

	XClearWindow(dpy, core->window);
	XSaveContext(dpy, core->window, wWinContext, (XPointer) & core->descriptor);

	return core;
}