예제 #1
0
int SetWindowManagerHints(Display * prDisplay, const char *psPrgClass,
                          Window nWnd, int nMinWidth, int nMinHeight,
			  const char *psTitle, const char *psIconTitle,
			  Pixmap nIconPixmap)
{
  XSizeHints rSizeHints;

  XWMHints rWMHints;
  XClassHint rClassHint;
  XTextProperty prWindowName, prIconName;

  if (!XStringListToTextProperty ((char**) &psTitle, 1, &prWindowName)
      || !XStringListToTextProperty ((char**) &psIconTitle, 1, &prIconName))
    return 1;			/* No memory! */

  rSizeHints.flags = PPosition | PSize | PMinSize;
  rSizeHints.min_width = nMinWidth;
  rSizeHints.min_height = nMinHeight;

  rWMHints.flags = StateHint | IconPixmapHint | InputHint;
  rWMHints.initial_state = NormalState;
  rWMHints.input = True;
  rWMHints.icon_pixmap = nIconPixmap;

  rClassHint.res_name = 0;
  rClassHint.res_class = (char*) psPrgClass;

  XSetWMProperties (prDisplay, nWnd, &prWindowName, &prIconName, 0, 0,
		    &rSizeHints, &rWMHints, &rClassHint);

  return 0;
}
예제 #2
0
static void setup_window_hints_and_icon(Display* dpy, Window win, Window parent, const int maxsize) {
	XTextProperty	x_wname, x_iname;
	XSizeHints	hints;
	XWMHints	wmhints;
	char *w_name ="xjadeo";
	char *i_name ="xjadeo";

	/* default settings which allow arbitraray resizing of the window */
	hints.flags = PSize | PMaxSize | PMinSize;
	hints.min_width = 32;
	hints.min_height = 18;
	hints.max_width = maxsize;
	hints.max_height = maxsize;

	wmhints.input = True;
	XpmCreatePixmapFromData(dpy, parent, xjadeo8_xpm, &wmhints.icon_pixmap, &wmhints.icon_mask, NULL);
	wmhints.flags = InputHint | IconPixmapHint | IconMaskHint;

	if (XStringListToTextProperty (&w_name, 1, &x_wname) &&
			XStringListToTextProperty (&i_name, 1, &x_iname))
	{
		XSetWMProperties (dpy, win, &x_wname, &x_iname, NULL, 0, &hints, &wmhints, NULL);
		XFree (x_wname.value);
		XFree (x_iname.value);
	}
}
예제 #3
0
set_window_title(Window win,char *string)
{
 XTextProperty wname,iname;
  XStringListToTextProperty(&string,1,&wname);
  XStringListToTextProperty(&string,1,&iname);
 XSetWMProperties(display,win,&wname,&iname,NULL,0,NULL,NULL,NULL);
}
예제 #4
0
static inline int up_x11createframe(void)
{
  XGCValues gcval;
  char *argv[2] = { "nuttx", NULL };
  char *winName = "NuttX";
  char *iconName = "NX";
  XTextProperty winprop;
  XTextProperty iconprop;
  XSizeHints hints;

  g_display = XOpenDisplay(NULL);
  if (g_display == NULL)
    {
      printf("Unable to open display.\n");
      return -1;
    }

  g_screen = DefaultScreen(g_display);
  g_window = XCreateSimpleWindow(g_display, DefaultRootWindow(g_display),
                                 0, 0, g_fbpixelwidth, g_fbpixelheight, 2,
                                 BlackPixel(g_display, g_screen),
                                 BlackPixel(g_display, g_screen));

  XStringListToTextProperty(&winName, 1, &winprop);
  XStringListToTextProperty(&iconName, 1, &iconprop);

  hints.flags = PSize | PMinSize | PMaxSize;
  hints.width = hints.min_width  = hints.max_width  = g_fbpixelwidth;
  hints.height= hints.min_height = hints.max_height = g_fbpixelheight;

  XSetWMProperties(g_display, g_window, &winprop, &iconprop, argv, 1,
                   &hints, NULL, NULL);

  XMapWindow(g_display, g_window);

  /* Select window input events */

  XSelectInput(g_display, g_window,
               ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|KeyPressMask);

  /* Release queued events on the display */

#ifdef CONFIG_SIM_TOUCHSCREEN
  (void)XAllowEvents(g_display, AsyncBoth, CurrentTime);

  /* Grab mouse button 1, enabling mouse-related events */

  (void)XGrabButton(g_display, Button1, AnyModifier, g_window, 1,
                    ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
                    GrabModeAsync, GrabModeAsync, None, None);
#endif

  gcval.graphics_exposures = 0;
  g_gc = XCreateGC(g_display, g_window, GCGraphicsExposures, &gcval);

  return 0;
}
/* Sets basic window manager hints for a window. */
void InputWindowXWin::setHints(Window window, char* window_name,
                               char* icon_name, char* class_name,
                               char* class_type)
{
    XTextProperty  w_name;
    XTextProperty  i_name;
    XSizeHints     sizehints;
    XWMHints       wmhints;
    XClassHint     classhints;
    int            status;

    /*
     * Generate window and icon names.
     */
   status = XStringListToTextProperty(&window_name, 1, &w_name);

   if (0 == status)
   {
      vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
         << "Error allocating XString\n" << vprDEBUG_FLUSH;
   }

   status = XStringListToTextProperty(&icon_name, 1, &i_name);

   if (0 == status)
   {
      vprDEBUG(vprDBG_ERROR, vprDBG_CRITICAL_LVL)
         << "Error allocating XString\n" << vprDEBUG_FLUSH;
   }

   sizehints.width       = mWidth;    /* -- Obsolete in R4 */
   sizehints.height      = mHeight;   /* -- Obsolete in R4 */
   sizehints.base_width  = mWidth;    /* -- New in R4 */
   sizehints.base_height = mHeight;   /* -- New in R4 */

   /* Set up flags for all the fields we've filled in. */
   sizehints.flags = USPosition | USSize | PBaseSize;

   /*   assume the window starts in "normal" (rather than
    *    iconic) state and wants keyboard input.
    */
   wmhints.initial_state = NormalState;
   wmhints.input         = True;
   wmhints.flags         = StateHint | InputHint;

   /* Fill in class name. */
   classhints.res_name  = class_name;
   classhints.res_class = class_type;

   XSetWMProperties(mXDisplay, window, &w_name, &i_name,
                    //argv, argc, /* Note reversed order. */
                    NULL, 0,
                    &sizehints, &wmhints, &classhints);

   XFree(w_name.value);
   XFree(i_name.value);
}
예제 #6
0
파일: xtest.c 프로젝트: shah-/c-projs
static Window InitWindow(Display* dpy, int argc, char* argv[])
{
    static char* window_name = "Test Window Name";
    static char* icon_name = "XTest";
    XTextProperty windowName, iconName;
    int sn = DefaultScreen(dpy);
    unsigned dw = DisplayWidth(dpy, sn);
    unsigned dh = DisplayHeight(dpy, sn);
    XSizeHints size_hints = {0};
    XWMHints wm_hints = {0};
    XClassHint class_hints = {0};
    Window win = XCreateSimpleWindow(dpy, RootWindow(dpy, sn)
            , 0, 0, dw / 2, dh / 2, 0
            //    , BlackPixel(dpy, screen_num)
            //    , WhitePixel(dpy, screen_num));
        , 0x000000, 0x88FF88);
    //To avoid sending Expose message the a part of window is covered
    //set the mode to backup the covered part of the window
    if(DoesBackingStore(DefaultScreenOfDisplay(dpy)) == Always)
    {
        XSetWindowAttributes attr;
        //CWBackingStore - Backup covered window image (not repaint)
        //CWBitGravity - repaint on size change
        attr.backing_store = Always;
        //only for top-right
        //    attr.bit_gravity = NorthWestGravity;
        //XChangeWindowAttributes keeps all other attr. unchanged
        XChangeWindowAttributes(dpy, win, CWBackingStore /*| CWBitGravity*/, &attr);
    }
    if(XStringListToTextProperty(&window_name, 1, &windowName) == 0)
    {
        perror("Structure allocation for windowName failed");
        return 0;
    }
    if(XStringListToTextProperty(&icon_name, 1, &iconName) == 0)
    {
        perror("Structure allocation for iconName failed");
        return 0;
    }
    size_hints.flags = PMinSize;
    size_hints.min_width = 200;
    size_hints.min_height = 100;

    wm_hints.flags = StateHint | InputHint;
    wm_hints.initial_state = NormalState;
    wm_hints.input = True;

    class_hints.res_name = argv[0];
    class_hints.res_class = "xtest";

    XSetWMProperties(dpy, win, &windowName, &iconName, argv, argc, &size_hints, &wm_hints, &class_hints);

    XFree(windowName.value);
    XFree(iconName.value);
    return win;
}
예제 #7
0
void set_window_title(Window win,char *string)
{
  XTextProperty wname,iname;
  XStringListToTextProperty(&string,1,&wname);
  XStringListToTextProperty(&string,1,&iname);
  
  XClassHint class_hints;
  class_hints.res_name="";
  class_hints.res_class="";
 
  XSetWMProperties(display,win,&wname,&iname,NULL,0,NULL,NULL,&class_hints);
}
예제 #8
0
void
x_window_rep::set_hints (int min_w, int min_h, int max_w, int max_h) {
  XSizeHints* size_hints;
  XWMHints*   wm_hints;
  XClassHint* class_hints;
  ASSERT (size_hints= XAllocSizeHints (), "out of memory (X server)");
  ASSERT (wm_hints= XAllocWMHints (), "out of memory (X server)");
  ASSERT (class_hints= XAllocClassHint (), "out of memory (X server)");

  XTextProperty Window_Name;
  XTextProperty Icon_Name;
  ASSERT (XStringListToTextProperty (&name, 1, &Window_Name) != 0,
	  "out of memory (X server)");
  ASSERT (XStringListToTextProperty (&name, 1, &Icon_Name) != 0,
	  "out of memory (X server)");

  // time_t start_1= texmacs_time ();
  Pixmap pm= retrieve_pixmap (load_xpm ("TeXmacs.xpm"));
  // cout << "Getting pixmap required " << (texmacs_time ()-start_1) << " ms\n";

  // time_t start_2= texmacs_time ();
  size_hints->flags       = PPosition | PSize | PMinSize | PMaxSize;
  size_hints->min_width   = min_w;
  size_hints->min_height  = min_h;
  size_hints->max_width   = max_w;
  size_hints->max_height  = max_h;
  wm_hints->initial_state = NormalState;
  wm_hints->input         = true;
  wm_hints->icon_pixmap   = pm;
  wm_hints->flags         = StateHint | IconPixmapHint | InputHint;
  class_hints->res_name   = name;
  class_hints->res_class  = name;

  XSetWMProperties (
    dpy,
    win,
    &Window_Name,
    &Icon_Name,
    gui->argv,
    gui->argc,
    size_hints,
    wm_hints,
    class_hints
  );

  XFree(size_hints);
  XFree(wm_hints);
  XFree(class_hints);
  XFree(Window_Name.value);
  XFree(Icon_Name.value);
  // cout << "Setting hints required " << (texmacs_time ()-start_2) << " ms\n";
}
예제 #9
0
파일: title.c 프로젝트: andy722/spline-xlib
int main() {
	char *str = "My program title";

	dpy=XOpenDisplay(NULL);
	assert(dpy);
	scr=DefaultScreen(dpy);

	win=XCreateSimpleWindow(dpy, RootWindow(dpy,scr), 
			0, 0, /* coordinates */
			SCREEN_WIDTH/2, SCREEN_HEIGHT/2, /* size */
			1, /* border width */
			WhitePixel(dpy,scr), /* foreground */
			BlackPixel(dpy,scr)  /* background */
			);
	XMapWindow(dpy, win);
	XMoveWindow(dpy, win, 0, 0);

	XTextProperty title;
	XStringListToTextProperty(&str, 1, &title);
	XSetWMName(dpy, win, &title);
	XSetWMIconName(dpy, win, &title);


	XFlush(dpy);
	getchar();
	return EXIT_SUCCESS;
}
예제 #10
0
파일: wsys_glx.c 프로젝트: tllw/sray
void wsys_set_title(const char *title)
{
	XTextProperty tp_wname;
	XStringListToTextProperty((char**)&title, 1, &tp_wname);
	XSetWMName(dpy, win, &tp_wname);
	XFree(tp_wname.value);
}
예제 #11
0
파일: common.c 프로젝트: Remmy/afterstep
/****f* libAfterImage/tutorials/create_top_level_window()
 * NAME
 * create_top_level_window()
 * SYNOPSIS
 * Window create_top_level_window( ASVisual *asv, Window root,
 *                                 int x, int y,
 *                                 unsigned int width,
 *                                 unsigned int height,
 *                                 unsigned int border_width,
 *                                 unsigned long attr_mask,
 *                                 XSetWindowAttributes *attr,
 *                                 char *app_class );
 * INPUTS
 * asv           - pointer to valid preinitialized ASVisual structure.
 * root          - root window of the screen on which to create window.
 * x, y          - desired position of the window
 * width, height - desired window size.
 * border_width  - desired initial border width of the window (may not
 *                 have any effect due to Window Manager intervention.
 * attr_mask     - mask of the attributes that has to be set on the
 *                 window
 * attr          - values of the attributes to be set.
 * app_class     - title of the application to be used as its window
 *                 Title and resources class.
 * RETURN VALUE
 * ID of the created window.
 * DESCRIPTION
 * create_top_level_window() is autyomating process of creating top
 * level application window. It creates window for specified ASVisual,
 * and then sets up basic ICCCM hints for that window, such as WM_NAME,
 * WM_ICON_NAME, WM_CLASS and WM_PROTOCOLS.
 * SOURCE
 */
Window
create_top_level_window( ASVisual *asv, Window root, int x, int y,
                         unsigned int width, unsigned int height,
						 unsigned int border_width, 
						 unsigned long attr_mask,
						 XSetWindowAttributes *attr, 
						 const char *app_class, const char *app_name )
{
 	Window w = None;
#ifndef X_DISPLAY_MISSING
	char *tmp ;
	XTextProperty name;
	XClassHint class1;

	w = create_visual_window(asv, root, x, y, width, height, border_width, 
							 InputOutput, attr_mask, attr );

	tmp = (app_name==NULL)?(char*)get_application_name():(char*)app_name;
    XStringListToTextProperty (&tmp, 1, &name);

    class1.res_name = tmp;	/* for future use */
    class1.res_class = (char*)app_class;
    XSetWMProtocols (asv->dpy, w, &_XA_WM_DELETE_WINDOW, 1);
    XSetWMProperties (asv->dpy, w, &name, &name, NULL, 0, NULL, NULL, &class1);
    /* final cleanup */
    XFree ((char *) name.value);

#endif /* X_DISPLAY_MISSING */
	return w;
}
예제 #12
0
파일: calc.c 프로젝트: tommie/xppaut
static void make_calc(Calc *calc) {
  int width, height;
  static char *name[] = {"Answer"};
  Window base;
  XTextProperty winname;
  XSizeHints size_hints;

  calc->last_val = 0;
  width = 20 + 24 * DCURXs;
  height = 4 * DCURYs;
  base =
    make_plain_window(RootWindow(display, screen), 0, 0, width, height, 4);
  calc->base = base;
  size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
  size_hints.x = 0;
  size_hints.y = 0;
  size_hints.width = width;
  size_hints.height = height;
  size_hints.min_width = width;
  size_hints.min_height = height;
  size_hints.max_width = width;
  size_hints.max_height = height;

  XStringListToTextProperty(name, 1, &winname);
  XSetWMProperties(display, base, &winname, &winname, NULL, 0, &size_hints,
                   NULL, NULL);
  XFree(winname.value);
  calc->answer = make_window(base, 10, DCURYs / 2, 24 * DCURXs, DCURYs, 0);
  width = (width - 4 * DCURXs) / 2;
  calc->quit =
    make_window(base, width, (int)(2.5 * DCURYs), 4 * DCURXs, DCURYs, 1);
  XSelectInput(display, calc->quit, MYMASK);
  x11_events_listen(g_x11_events, X11_EVENTS_ANY_WINDOW, MYMASK, calc_event, &g_calc);
  calc->use = 1;
}
예제 #13
0
파일: xdrape.c 프로젝트: nkuitse/xdrape
void
set_window_name(Display *disp, Window win, char *name)
{
    XTextProperty name_prop;
    XStringListToTextProperty(&name, 1, &name_prop);
    XSetWMName(disp, win, &name_prop);
}
예제 #14
0
void CStdWindow::SetTitle(const char *Title) {
#ifdef USE_X11
  XTextProperty title_property;
  StdStrBuf tbuf(Title, true);
  char *tbufstr = tbuf.getMData();
  XStringListToTextProperty(&tbufstr, 1, &title_property);
  XSetWMName(dpy, wnd, &title_property);
#endif
}
예제 #15
0
bool XPlatformWindow::set_icon_name(const char* icon_name) {  
  XTextProperty iconName;
  if (XStringListToTextProperty((char**)&icon_name, 1, &iconName) == 0) {
    warning("X structure allocation for icon name failed--window won't work.");
    return false;
  }
  XSetWMIconName(_display, _xwindow, &iconName);
  return true;
}
예제 #16
0
파일: window.c 프로젝트: Ismael-VC/goomwwm
int window_set_text_prop(Window w, Atom atom, char *txt)
{
	XTextProperty prop;
	if (XStringListToTextProperty(&txt, 1, &prop))
	{
		XSetTextProperty(display, w, &prop, atom);
		XFree(prop.value);
	}
	return 0;
}
예제 #17
0
/* sets up the 'workspace names' property */
static void
gnome_set_workspace_names (int count, char **names)
{
  XTextProperty text;

  if (XStringListToTextProperty (names, count, &text))
    {
      XSetTextProperty (dpy, root_win, &text, _XA_WIN_WORKSPACE_NAMES);
      XFree (text.value);
    }
}
예제 #18
0
/******************************************************************************
  ChangeWindowName - Self explanitory
    Original work from FvwmIdent:
      Copyright 1994, Robert Nation and Nobutaka Suzuki.
******************************************************************************/
void ChangeWindowName(char *str)
{
XTextProperty name;
  if (XStringListToTextProperty(&str,1,&name) == 0) {
    fprintf(stderr,"%s: cannot allocate window name.\n",Module);
    return;
  }
  XSetWMName(dpy,win,&name);
  XSetWMIconName(dpy,win,&name);
  XFree(name.value);
}
예제 #19
0
/*
 * Set the icon name of Infowin
 */
static errr Infowin_set_icon_name(cptr name)
{
	Status st;
	XTextProperty tp;
	char buf[128];
	char *bp = buf;
	my_strcpy(buf, name, sizeof(buf));
	st = XStringListToTextProperty(&bp, 1, &tp);
	if (st) XSetWMIconName(Metadpy->dpy, Infowin->win, &tp);
	return (0);
}
예제 #20
0
파일: audit.c 프로젝트: Remmy/afterstep
/* text_prop_return is really XTextProperty*, but to avoid extra includes, we'll use void* */
Status
count_xstringlisttotextproperty (const char *fname, int line, char **list, int count, void *text_prop_return)
{
	Status        val;
	XTextProperty *prop = text_prop_return;

	val = XStringListToTextProperty (list, count, prop);
	if (val && prop->nitems)
		count_alloc (fname, line, (void *)prop->value,
					 prop->nitems * prop->format / 8, C_XMEM | C_XSTRINGLISTTOTEXTPROPERTY);
	return val;
}
예제 #21
0
bool CWindowUnix::SetText(const wchar_t *unicodetext)
{
    XTextProperty title;

    const char *buff = axelynx::utils::WideCharToMultiByte(unicodetext);

    XStringListToTextProperty((char**)&buff, sizeof(char), &title );
    XSetWMName(dpy_,win_,&title);

    delete[] buff;
	return 0;
}
예제 #22
0
/**************************************************************************
 *  Change the window name displayed in the title bar.
 **************************************************************************/
void change_window_name(char *str)
{
  XTextProperty name;

  if (XStringListToTextProperty(&str,1,&name) == 0)
    {
      fprintf(stderr,"FvwmBanner: cannot allocate window name");
      return;
    }
  XSetWMName(dpy,win,&name);
  XSetWMIconName(dpy,win,&name);
  XFree(name.value);
}
예제 #23
0
/**************************************************************************
 *  Change the window name displayed in the icon.
 **************************************************************************/
void change_icon_name(char *str)
{
  XTextProperty name;
  
  if(str == NULL)return;
  if (XStringListToTextProperty(&str,1,&name) == 0) 
    {
      fprintf(stderr,"%s: cannot allocate window name",MyName);
      return;
    }
  XSetWMIconName(dpy,main_win,&name);
  XFree(name.value);
}
예제 #24
0
파일: wmname.c 프로젝트: ombt/ombt
// set window name using text properties
void
SetWindowNameWithTextProps(Display *display, Window window, char *name)
{
	XTextProperty text_property;

	// convert character string to text property
	(void) XStringListToTextProperty(&name, 1, &text_property);

	// set window name
	(void) XSetWMName(display, window, &text_property);

	// all done
	return;
}
예제 #25
0
파일: pop_list.c 프로젝트: tommie/xppaut
static void make_sbox_windows(STRING_BOX *sb, int row, int col, char *title,
                              int maxchar) {
  int width, height;
  int i;
  int xpos, ypos, n = sb->n;
  int xstart, ystart;

  XTextProperty winname;
  XSizeHints size_hints;
  Window base;
  width = (maxchar + 4) * col * DCURX;
  height = (row + 4) * (DCURY + 16);
  base = make_plain_window(DefaultRootWindow(display), 0, 0, width, height, 4);
  size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
  size_hints.x = 0;
  size_hints.y = 0;
  size_hints.width = width;
  size_hints.height = height;
  size_hints.min_width = width;
  size_hints.min_height = height;
  size_hints.max_width = width;
  size_hints.max_height = height;

  XClassHint class_hints;
  class_hints.res_name = "";
  class_hints.res_class = "";

  make_icon((char *)info_bits, info_width, info_height, base);
  XStringListToTextProperty(&title, 1, &winname);
  XSetWMProperties(display, base, &winname, NULL, NULL, 0, &size_hints, NULL,
                   &class_hints);
  XFree(winname.value);
  sb->base = base;
  sb->hgt = height;
  sb->wid = width;
  ystart = DCURY;
  xstart = DCURX;
  for (i = 0; i < n; i++) {
    xpos = xstart + (maxchar + 4) * DCURX * (i / row);
    ypos = ystart + (i % row) * (DCURY + 10);
    sb->win[i] = make_window(base, xpos, ypos, maxchar * DCURX, DCURY, 1);
  }

  ypos = height - 2 * DCURY;
  xpos = (width - 16 * DCURX) / 2;
  (sb->ok) = make_window(base, xpos, ypos, 8 * DCURX, DCURY, 1);
  (sb->cancel) =
      make_window(base, xpos + 8 * DCURX + 4, ypos, 8 * DCURX, DCURY, 1);
  XRaiseWindow(display, base);
}
예제 #26
0
파일: edit-box.c 프로젝트: tommie/xppaut
static void make_ebox_windows(EDIT_BOX *sb, const char *title) {
  int width, height;
  int i;
  int xpos, ypos, n = sb->n;
  int xstart, ystart;

  XTextProperty winname;
  XSizeHints size_hints;
  Window base;
  width = (MAX_LEN_EBOX + 4) * DCURX;
  height = (n + 4) * (DCURY + 16);
  base = make_plain_window(DefaultRootWindow(display), 0, 0, width, height, 4);
  size_hints.flags = PPosition | PSize | PMinSize | PMaxSize;
  size_hints.x = 0;
  size_hints.y = 0;
  size_hints.width = width;
  size_hints.height = height;
  size_hints.min_width = width;
  size_hints.min_height = height;
  size_hints.max_width = width;
  size_hints.max_height = height;
  XStringListToTextProperty((char **)&title, 1, &winname);
  XSetWMProperties(display, base, &winname, NULL, NULL, 0, &size_hints, NULL,
                   NULL);
  XFree(winname.value);
  sb->base = base;

  ystart = DCURY;
  xstart = DCURX;
  for (i = 0; i < n; i++) {
    xpos = xstart;
    ypos = ystart + i * (DCURY + 10);
    sb->win[i] = make_window(base, xpos, ypos, MAX_LEN_EBOX * DCURX, DCURY, 1);
  }

  ypos = height - 2 * DCURY;
  xpos = (width - 19 * DCURX) / 2;
  sb->ok = make_window(base, xpos, ypos, 2 * DCURX, DCURY, 1);
  sb->cancel = make_window(base, xpos + 4 * DCURX, ypos, 6 * DCURX, DCURY, 1);
  sb->reset = make_window(base, xpos + 12 * DCURX, ypos, 5 * DCURX, DCURY, 1);

  XSelectInput(display, sb->cancel, BUT_MASK);
  XSelectInput(display, sb->ok, BUT_MASK);
  XSelectInput(display, sb->reset, BUT_MASK);
  x11_events_listen(g_x11_events, X11_EVENTS_ANY_WINDOW, BUT_MASK,
                    edit_box_event, sb);

  XRaiseWindow(display, base);
}
void
set_dialog_properties (Display *d, Window w, char *name, int width, int height)
{
  XTextProperty nameprop;
  if (!XStringListToTextProperty (&name, 1, &nameprop)) {
    warn ("XStringListToTextProperty failed\n");
    return;
  }
  XSetWMName (d, w, &nameprop);

  XSizeHints *sh = XAllocSizeHints ();
  sh->base_width = sh->min_width = sh->max_width = width;
  sh->base_height = sh->min_height = sh->max_height = height;
  sh->flags = PBaseSize | PMinSize | PMaxSize;
  XSetWMNormalHints (d, w, sh);
  XFree (sh);
}
예제 #28
0
bool GSWndOGL::SetWindowText(const char* title)
{
	if (!m_managed) return true;

	XTextProperty prop;

	memset(&prop, 0, sizeof(prop));

	char* ptitle = (char*)title;
	if (XStringListToTextProperty(&ptitle, 1, &prop)) {
		XSetWMName(m_NativeDisplay, m_NativeWindow, &prop);
	}

	XFree(prop.value);
	XFlush(m_NativeDisplay);

	return true;
}
예제 #29
0
static void
set_window_title(ModeInfo * mi)
{
	XTextProperty prop;
	char       *buf;
	unsigned int status;

	buf = (char *) malloc(strlen(MI_NAME(mi)) + strlen(MI_DESC(mi)) + 3);
	(void) sprintf(buf, "%s: %s", MI_NAME(mi), MI_DESC(mi));
	status = XStringListToTextProperty(&buf, 1, &prop);
	if (status != 0) {
		XSetWMName(MI_DISPLAY(mi), MI_WINDOW(mi), &prop);
		XFree((caddr_t) prop.value);
	}
	free(buf);
	if (MI_IS_ICONIC(mi) && description) {
		modeDescription(mi);
	}
}
예제 #30
0
void GLWindow::SetTitle(char *strtitle)
{
#ifndef USE_GSOPEN2
    if (!glDisplay or !glWindow) return;
	if (fullScreen) return;

    XTextProperty prop;
    memset(&prop, 0, sizeof(prop));

    char* ptitle = strtitle;
    if (XStringListToTextProperty(&ptitle, 1, &prop)) {
        XLockDisplay(glDisplay);
        XSetWMName(glDisplay, glWindow, &prop);
        XUnlockDisplay(glDisplay);
    }

    XFree(prop.value);
#endif
}