Ejemplo n.º 1
0
static void xdpy_set_window_title_default(ALLEGRO_DISPLAY *display, const char *title)
{
   ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
   ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display;

   {
      Atom WM_NAME = XInternAtom(system->x11display, "WM_NAME", False);
      Atom _NET_WM_NAME = XInternAtom(system->x11display, "_NET_WM_NAME", False);
      char *list[1] = { (char *) title };
      XTextProperty property;

      Xutf8TextListToTextProperty(system->x11display, list, 1, XUTF8StringStyle,
         &property);
      XSetTextProperty(system->x11display, glx->window, &property, WM_NAME);
      XSetTextProperty(system->x11display, glx->window, &property, _NET_WM_NAME);
      XSetTextProperty(system->x11display, glx->window, &property, XA_WM_NAME);
      XFree(property.value);
   }
   {
      XClassHint *hint = XAllocClassHint();
      if (hint) {
         ALLEGRO_PATH *exepath = al_get_standard_path(ALLEGRO_EXENAME_PATH);
         // hint doesn't use a const char*, so we use strdup to create a non const string
         hint->res_name = strdup(al_get_path_basename(exepath));
         hint->res_class = strdup(al_get_path_basename(exepath));
         XSetClassHint(system->x11display, glx->window, hint);
         free(hint->res_name);
         free(hint->res_class);
         XFree(hint);
         al_destroy_path(exepath);
      }
   }
}
Ejemplo n.º 2
0
static void InternalLinkScreenAndGo( const char * WindowName )
{
	XGetWindowAttributes( CNFGDisplay, CNFGWindow, &CNFGWinAtt );

	XGetClassHint( CNFGDisplay, CNFGWindow, CNFGClassHint );
	if (!CNFGClassHint) {
		CNFGClassHint = XAllocClassHint();
		if (CNFGClassHint) {
			CNFGClassHint->res_name = "cnping";
			CNFGClassHint->res_class = "cnping";
			XSetClassHint( CNFGDisplay, CNFGWindow, CNFGClassHint );
		} else {
			fprintf( stderr, "Failed to allocate XClassHint!\n" );
		}
	} else {
		fprintf( stderr, "Pre-existing XClassHint\n" );
	}

	XSelectInput (CNFGDisplay, CNFGWindow, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ExposureMask | PointerMotionMask );
	XSetStandardProperties( CNFGDisplay, CNFGWindow, WindowName, WindowName, None, NULL, 0, NULL );

	CNFGWindowGC = XCreateGC(CNFGDisplay, CNFGWindow, 0, 0);

	CNFGPixmap = XCreatePixmap( CNFGDisplay, CNFGWindow, CNFGWinAtt.width, CNFGWinAtt.height, CNFGWinAtt.depth );
	CNFGGC = XCreateGC(CNFGDisplay, CNFGPixmap, 0, 0);
}
Ejemplo n.º 3
0
Archivo: x.c Proyecto: Toqozz/yarn-c
// Apply atoms to window.
static void
x_set_wm(Window win, Display *dsp)
{
    Atom property[3];  // Change 2 things at once, (parent + 2 children).

    // Set window's WM_NAME property.
    // char *title = "yarn"; -- only used twice.
    XStoreName(dsp, win, "yarn");
    // No children.
    property[2] = XInternAtom(dsp, "_NET_WM_NAME", false); // Get WM_NAME atom and store it in _net_wm_title.
    XChangeProperty(dsp, win, property[2], XInternAtom(dsp, "UTF8_STRING", false), 8, PropModeReplace, (unsigned char *) "yarn", 4);

    // Set window's class.
    // char *class = "yarn"; -- only used once.
    XClassHint classhint = { "yarn", "yarn" };
    XSetClassHint(dsp, win, &classhint);

    // Parent.
    property[2] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE", false);   // Let WM know type.
    // Children.
    property[0] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE_NOTIFICATION", false);
    property[1] = XInternAtom(dsp, "_NET_WM_WINDOW_TYPE_UTILITY", false);
    // Reach for 2 longs, (2L).
    XChangeProperty(dsp, win, property[2], XA_ATOM, 32, PropModeReplace, (unsigned char *) property, 2L);

    // Parent.
    property[2] = XInternAtom(dsp, "_NET_WM_STATE", false);   // Let WM know state.
    // Child.
    property[0] = XInternAtom(dsp, "_NET_WM_STATE_ABOVE", false);
    // Reach for 1 long, (1L).
    XChangeProperty(dsp, win, property[2], XA_ATOM, 32, PropModeReplace, (unsigned char *) property, 1L);
}
Ejemplo n.º 4
0
static void x11_set_window_class(Display *dpy, Window win)
{
   XClassHint hint = {0};
   hint.res_name   = (char*)"retroarch"; // Broken header.
   hint.res_class  = (char*)"retroarch";
   XSetClassHint(dpy, win, &hint);
}
Ejemplo n.º 5
0
static void
newwin(void *foo, int item, Time time)
{
    Window win;
    XClassHint classhint;
    char title[100];

    win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
                              0, 0, 200, 100, 0, 0, 0);
    prots[0] = delete_win;
    XSetWMProtocols(dpy, win, prots, 1);
    sprintf(title, "Notify Test Window");
    XStoreName(dpy, win, title);

    /* set class hint */
    classhint.res_name = "notest";
    classhint.res_class = "Notest";
    XSetClassHint(dpy, win, &classhint);

    hints = XAllocWMHints();
    /* set window group leader */
    hints->window_group = leader;
    hints->flags = WindowGroupHint;
    XSetWMHints(dpy, win, hints);

    WMAppAddWindow(app, win);
    XMapWindow(dpy, win);
}
Ejemplo n.º 6
0
static void
set_name_and_icon(void)
{
    char *icon_name = "HyperDoc";
    char *s;
    Pixmap icon_pixmap;
    XWMHints wmhints;
    XClassHint ch;

    ch.res_name = "HyperDoc";
    ch.res_class = gArgv[0];
    for (s = gArgv[0] + strlen(gArgv[0]) - 1; s != gArgv[0]; s--) {
        if (*s == '/') {
            ch.res_class = s + 1;
            break;
        }
    }
    XSetClassHint(gXDisplay, gWindow->fMainWindow, &ch);

    XStoreName(gXDisplay, gWindow->fMainWindow, "HyperDoc");

    /* define and assign the pixmap for the icon */
    icon_pixmap = XCreateBitmapFromData(gXDisplay, gWindow->fMainWindow,
                                        ucharp_to_charp(ht_icon_bits),
                                        ht_icon_width, ht_icon_height);
    wmhints.icon_pixmap = icon_pixmap;
    wmhints.flags = IconPixmapHint;

    XSetWMHints(gXDisplay, gWindow->fMainWindow, &wmhints);

    /* name the icon */
    XSetIconName(gXDisplay, gWindow->fMainWindow, icon_name);
}
Ejemplo n.º 7
0
/**
 * @brief Set basic properties on a window.
 */
void
wm_wid_set_info(session_t *ps, Window wid, const char *name,
		Atom window_type) {
	// Set window name
	{
		char *textcpy = mstrjoin("skippy-xd ", name);
		{
			XTextProperty text_prop = { };
			if (Success == XmbTextListToTextProperty(ps->dpy, &textcpy, 1,
						XStdICCTextStyle, &text_prop))
				XSetWMName(ps->dpy, wid, &text_prop);
			sxfree(text_prop.value);
		}
		wm_wid_set_prop_utf8(ps, wid, _NET_WM_NAME, textcpy);
		free(textcpy);
	}

	// Set window class
	{
		XClassHint *classh = allocchk(XAllocClassHint());
		classh->res_name = "skippy-xd";
		classh->res_class = "skippy-xd";
		XSetClassHint(ps->dpy, wid, classh);
		XFree(classh);
	}

	// Set window type
	{
		if (!window_type)
			window_type = _NET_WM_WINDOW_TYPE_NORMAL;
		long val = window_type;
		XChangeProperty(ps->dpy, wid, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
				PropModeReplace, (unsigned char *) &val, 1);
	}
}
Ejemplo n.º 8
0
void CreateDock(int argc, char *argv[])    /* this part comes from http://www.linuxmag-france.org/ */
{
   Window root;
   XWMHints wmHints;
   XSizeHints sizeHints;
   XClassHint classHint;
   Pixmap pixmask;
   unsigned long p_blanc;
   unsigned long p_noir;
   unsigned int borderWidth = 2;
   char *wname = argv[0] ;

   dpy = XOpenDisplay(NULL) ;

   if(dpy == NULL)
	  {
	     fprintf(stderr, "Can't open display\n") ;
	     exit(1) ;
	  }

   root = RootWindow(dpy,screen);
   p_blanc = WhitePixel(dpy,screen) ;
   p_noir = BlackPixel(dpy,screen) ;
   gc = XDefaultGC(dpy,screen) ;
   XSetForeground(dpy, gc, p_noir);
   XSetBackground(dpy, gc,p_noir);

   sizeHints.x = 0 ;
   sizeHints.y = 0 ;
   sizeHints.width = 64 ;
   sizeHints.height = 64 ;

   win = XCreateSimpleWindow(dpy,root,sizeHints.x,sizeHints.y , sizeHints.width, sizeHints.height, borderWidth, p_noir,p_noir) ;
   iconWin = XCreateSimpleWindow(dpy,root,sizeHints.x,sizeHints.y,sizeHints.width, sizeHints.height, borderWidth, p_noir,p_noir ) ;

   sizeHints.flags = USSize | USPosition ;
   XSetWMNormalHints(dpy,win,&sizeHints) ;
   wmHints.initial_state = WithdrawnState ;
   wmHints.icon_window = iconWin ;
   wmHints.icon_x = sizeHints.x ;
   wmHints.icon_y = sizeHints.y ;
   wmHints.window_group = win ;
   wmHints.flags = StateHint | IconWindowHint | IconPositionHint | WindowGroupHint ;
   XSetWMHints(dpy, win, &wmHints) ;
   classHint.res_name = wname ;
   classHint.res_class = wname ;

   XSetClassHint(dpy, win, &classHint) ;
   XSetCommand(dpy,win, argv, argc) ;

   pixmask = XCreateBitmapFromData(dpy,win,fond_bits, fond_width, fond_height) ;
   XShapeCombineMask(dpy,win,ShapeBounding,0,0,pixmask,ShapeSet) ;
   XShapeCombineMask(dpy,iconWin,ShapeBounding, 0, 0, pixmask, ShapeSet) ;
   XpmCreatePixmapFromData(dpy,root,wmAppKill_xpm, &XPM, NULL,NULL) ;

   XSelectInput(dpy,win, ExposureMask | ButtonPressMask) ;
   XSelectInput(dpy,iconWin, ExposureMask | ButtonPressMask) ;

   XMapWindow(dpy,win) ;
}
Ejemplo n.º 9
0
void createWin(Window *win, int x, int y)
{
	XClassHint classHint;
	*win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
	classHint.res_name=NAME;
	classHint.res_class=CLASS;
	XSetClassHint(d_display, *win, &classHint);
}
Ejemplo n.º 10
0
/**
@brief    Used to generate a default name for the case when the XClassHints are not set correctly.
@return   void
**/
void
make_default_program_name(Display *display, Window window, char *name) {
  XClassHint program_hint;
  program_hint.res_name = name;
  program_hint.res_class = name;
  XSetClassHint(display, window, &program_hint);
  XFlush(display);
}
Ejemplo n.º 11
0
static void set_wm_class(void)
{
	XClassHint *classhint = XAllocClassHint();

	classhint->res_name = (char *)"jgmenu";
	classhint->res_class = (char *)"jgmenu";
	XSetClassHint(ui->dpy, ui->w[ui->cur].win, classhint);
	XFree(classhint);
}
Ejemplo n.º 12
0
static void sendhints(Window w,struct hints *h)
  {
  if(h->flg&1) XSetWMName(dsp,w,&h->window_name);
  if(h->flg&2) XSetWMIconName(dsp,w,&h->icon_name);
  if(h->flg&4) XSetCommand(dsp,w,h->argv,h->argc);
  if(h->flg&8) XSetClassHint(dsp,w,&h->class_hints);
  if(h->normal_hints.flags) XSetWMNormalHints(dsp,w,&h->normal_hints);  
  if(h->wm_hints.flags) XSetWMHints(dsp,w,&h->wm_hints);
  }
Ejemplo n.º 13
0
bool X11Helper::MakeWindow( Window &win, int screenNum, int depth, Visual *visual, int width, int height, bool overrideRedirect )
{
	if( !Dpy )
		return false;

	XSetWindowAttributes winAttribs;
	winAttribs.border_pixel = 0;
	winAttribs.event_mask = 0L;

	if( win )
	{
		// Preserve the event mask.
		XWindowAttributes attribs;
		XGetWindowAttributes( Dpy, win, &attribs );
		winAttribs.event_mask = attribs.your_event_mask;
		XDestroyWindow( Dpy, win );
	}
	// XXX: Error catching/handling?
	winAttribs.colormap = XCreateColormap( Dpy, RootWindow(Dpy, screenNum), visual, AllocNone );
	unsigned long mask = CWBorderPixel | CWColormap | CWEventMask;

	if( overrideRedirect )
	{
		winAttribs.override_redirect = True;
		mask |= CWOverrideRedirect;
	}
	win = XCreateWindow( Dpy, RootWindow(Dpy, screenNum), 0, 0, width, height, 0,
			     depth, InputOutput, visual, mask, &winAttribs );
	if( win == None )
		return false;

	XClassHint *hint = XAllocClassHint();
	if ( hint == nullptr ) {
		LOG->Warn("Could not set class hint for X11 Window");
	} else {
		hint->res_name   = (char*)g_XWMName.Get().c_str();
		hint->res_class  = (char*)PRODUCT_FAMILY;
		XSetClassHint(Dpy, win, hint);
		XFree(hint);
	}

	// Hide the mouse cursor in certain situations.
    if( !PREFSMAN->m_bShowMouseCursor )
	{
		const char pBlank[] = { 0,0,0,0,0,0,0,0 };
		Pixmap BlankBitmap = XCreateBitmapFromData( Dpy, win, pBlank, 8, 8 );

		XColor black = { 0, 0, 0, 0, 0, 0 };
		Cursor pBlankPointer = XCreatePixmapCursor( Dpy, BlankBitmap, BlankBitmap, &black, &black, 0, 0 );
		XFreePixmap( Dpy, BlankBitmap );

		XDefineCursor( Dpy, win, pBlankPointer );
		XFreeCursor( Dpy, pBlankPointer );
	}

	return true;
}
Ejemplo n.º 14
0
void setWndClass(QWidget *w, const char *name)
{
    Display *dsp = w->x11Display();
    WId win = w->winId();

    XClassHint classhint;
    classhint.res_name  = (char*)"sim";
    classhint.res_class = (char*)name;
    XSetClassHint(dsp, win, &classhint);
}
static void setClassHint(Display *disp, Window window, jlong wm_name, jlong wm_class) {
	XClassHint* hint = XAllocClassHint();
	
	hint->res_name = (char *)(intptr_t)wm_name;
	hint->res_class = (char *)(intptr_t)wm_class;
	
	XSetClassHint(disp, window, hint);
	
	XFree(hint);
}
Ejemplo n.º 16
0
	TrayIconWharf(TrayIcon *object, const QPixmap &pm)
		: TrayIconPrivate(object, 44)
	{
		// set the class hint
		XClassHint classhint;
		classhint.res_name  = (char*)"psidock-wharf";
		classhint.res_class = (char*)"Psi";
		XSetClassHint(QX11Info::display(), winId(), &classhint);

		setPixmap(pm);
	}
Ejemplo n.º 17
0
void x11wmClass(Display *dsp, WId wid, QString resName)
{
	char app_name[] = "jabbinchat";

	//Display *dsp = x11Display();                 // get the display
	//WId win = winId();                           // get the window
	XClassHint classhint;                          // class hints
	classhint.res_name = (char *)resName.latin1(); // res_name
	classhint.res_class = app_name;                // res_class
	XSetClassHint(dsp, wid, &classhint);           // set the class hints
}
Ejemplo n.º 18
0
void setX11Resource(QWidget* widget, const QString& c) {
#ifdef Q_WS_X11
	char res_class[] = SWIFT_APPLICATION_NAME;
	XClassHint hint;
	hint.res_name = (QString(SWIFT_APPLICATION_NAME) + "-" + c).toUtf8().data();
	hint.res_class = res_class;
	XSetClassHint(widget->x11Info().display(), widget->winId(), &hint);
#else
	(void) widget;
	(void) c;
#endif
}
Ejemplo n.º 19
0
static void set_class_hint(Display *p_display, Window p_window) {
	XClassHint *classHint;

	/* set the name and class hints for the window manager to use */
	classHint = XAllocClassHint();
	if (classHint) {
		classHint->res_name = (char *)"Godot_Engine";
		classHint->res_class = (char *)"Godot";
	}
	XSetClassHint(p_display, p_window, classHint);
	XFree(classHint);
}
Ejemplo n.º 20
0
Archivo: wsys_glx.c Proyecto: tllw/sray
static Window create_window(Display *dpy, int scr, int xsz, int ysz)
{
	Window root;
	XSetWindowAttributes wattr;
	XClassHint chint;
	XVisualInfo *vis;
	int glx_attr[32];

	fill_glx_attrib(glx_attr, mode_mask);

	root = RootWindow(dpy, scr);

	if(!(vis = glXChooseVisual(dpy, scr, glx_attr))) {
		fprintf(stderr, "requested GLX visual is not available\n");
		return 0;
	}
	if(!(ctx = glXCreateContext(dpy, vis, 0, True))) {
		fprintf(stderr, "failed to create GLX context\n");
		XFree(vis);
		return 0;
	}

	wattr.background_pixel = wattr.border_pixel = BlackPixel(dpy, scr);
	wattr.colormap = XCreateColormap(dpy, root, vis->visual, AllocNone);

	win = XCreateWindow(dpy, root, 10, 10, xsz, ysz, 0, vis->depth, InputOutput,
			vis->visual, CWColormap | CWBackPixel | CWBorderPixel, &wattr);
	XSelectInput(dpy, win, inpmask);

	wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False);
	wm_del = XInternAtom(dpy, "WM_DELETE_WINDOW", False);

	XSetWMProtocols(dpy, win, &wm_del, 1);

	wsys_set_title("vsray");

	chint.res_name = "vsray";
	chint.res_class = "vsray";
	XSetClassHint(dpy, win, &chint);

	if(glXMakeCurrent(dpy, win, ctx) == False) {
		fprintf(stderr, "failed to make GLX context current\n");
		glXDestroyContext(dpy, ctx);
		XDestroyWindow(dpy, win);
		return 0;
	}

	XMapWindow(dpy, win);
	win_xsz = xsz;
	win_ysz = ysz;
	return win;
}
Ejemplo n.º 21
0
void setX11Resource(QWidget* widget, const QString& c) {
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
	char res_class[] = SWIFT_APPLICATION_NAME;
	XClassHint hint;
	QByteArray resName = (QString(SWIFT_APPLICATION_NAME) + "-" + c).toUtf8();
	hint.res_name = resName.data();
	hint.res_class = res_class;
	XSetClassHint(widget->x11Info().display(), widget->winId(), &hint);
#else
	(void) widget;
	(void) c;
#endif
}
Ejemplo n.º 22
0
void hook_init() {
    g_event_window = XCreateSimpleWindow(g_display, g_root, 42, 42, 42, 42, 0, 0, 0);
    // set wm_class for window
    XClassHint *hint = XAllocClassHint();
    hint->res_name = (char*)HERBST_HOOK_CLASS;
    hint->res_class = (char*)HERBST_HOOK_CLASS;
    XSetClassHint(g_display, g_event_window, hint);
    XFree(hint);
    // ignore all events for this window
    XSelectInput(g_display, g_event_window, 0l);
    // set its window id in root window
    XChangeProperty(g_display, g_root, ATOM(HERBST_HOOK_WIN_ID_ATOM),
        XA_ATOM, 32, PropModeReplace, (unsigned char*)&g_event_window, 1);
}
Ejemplo n.º 23
0
xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, boolean decorations)
{
	xfWindow* window;

	window = (xfWindow*) xzalloc(sizeof(xfWindow));

	if (window != NULL)
	{
		int input_mask;
		XClassHint* class_hints;

		window->width = width;
		window->height = height;
		window->fullscreen = False;
		window->decorations = decorations;

		window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen),
			xfi->workArea.x, xfi->workArea.y, xfi->width, xfi->height, 0, xfi->depth, InputOutput, xfi->visual,
			CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
			CWBorderPixel, &xfi->attribs);

		class_hints = XAllocClassHint();

		if (class_hints != NULL)
		{
			class_hints->res_name = "xfreerdp";
			class_hints->res_class = "xfreerdp";
			XSetClassHint(xfi->display, window->handle, class_hints);
			XFree(class_hints);
		}

		xf_ResizeDesktopWindow(xfi, window, width, height);
		xf_SetWindowDecorations(xfi, window, decorations);

		input_mask =
			KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
			VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
			PointerMotionMask | ExposureMask | PropertyChangeMask;

		if (xfi->grab_keyboard)
			input_mask |= EnterWindowMask | LeaveWindowMask;

		XSelectInput(xfi->display, window->handle, input_mask);
		XMapWindow(xfi->display, window->handle);
	}

	XStoreName(xfi->display, window->handle, name);

	return window;
}
Ejemplo n.º 24
0
xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, uint32 id)
{
	xfWindow* window;

	window = (xfWindow*) xzalloc(sizeof(xfWindow));

	if ((width * height) < 1)
		return NULL;

	xf_FixWindowCoordinates(xfi, &x, &y, &width, &height);

	window->left = x;
	window->top = y;
	window->right = x + width - 1;
	window->bottom = y + height - 1;
	window->width = width;
	window->height = height;

	if (window != NULL)
	{
		XGCValues gcv;
		int input_mask;
		XClassHint* class_hints;

		window->decorations = False;
		window->fullscreen = False;
		window->window = wnd;
		window->localMoveSize = False;

		window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen),
			x, y, window->width, window->height, 0, xfi->depth, InputOutput, xfi->visual,
			CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
			CWBorderPixel, &xfi->attribs);

		xf_SetWindowDecorations(xfi, window, window->decorations);

		class_hints = XAllocClassHint();

		if (class_hints != NULL)
		{
			char* class;
			class = xmalloc(sizeof(rail_window_class));
			snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id);
			class_hints->res_name = "RAIL";
			class_hints->res_class = class;
			XSetClassHint(xfi->display, window->handle, class_hints);
			XFree(class_hints);
			xfree(class);
		}
Ejemplo n.º 25
0
Archivo: mygraph.c Proyecto: ombt/ombt
// set class hints
int
SetClassHints(Display *display, Window window, char *res_name, char *res_class)
{
	XClassHint class_hints;

	// fill in class hints
	class_hints.res_class = res_class;
	class_hints.res_name = res_name;

	// set values
	XSetClassHint(display, window, &class_hints);

	// all done
	return(OK);
}
Ejemplo n.º 26
0
void x11wmClass(Display *dsp, WId wid, QString resName)
{
	//Display *dsp = x11Display();				 // get the display
	//WId win = winId();						   // get the window
	XClassHint classhint;						  // class hints
	// Get old class hint. It is important to save old class name
	XGetClassHint(dsp, wid, &classhint);
	XFree(classhint.res_name);

	const QByteArray latinResName = resName.toLatin1();
	classhint.res_name = (char *)latinResName.data(); // res_name
	XSetClassHint(dsp, wid, &classhint);		   // set the class hints

	XFree(classhint.res_class);
}
Ejemplo n.º 27
0
void OS_X11::set_context(int p_context) {

	XClassHint* classHint = NULL;
	classHint = XAllocClassHint();
	if (classHint) {

		if (p_context == CONTEXT_EDITOR)
			classHint->res_name = (char *)"Godot_Editor";
		if (p_context == CONTEXT_PROJECTMAN)
			classHint->res_name = (char *)"Godot_ProjectList";
		classHint->res_class = (char *)"Godot";
		XSetClassHint(x11_display, x11_window, classHint);
		XFree(classHint);
	}
}
Ejemplo n.º 28
0
void setXorgClassHint(const video::SExposedVideoData &video_data,
	const std::string &name)
{
#ifdef XORG_USED
	if (video_data.OpenGLLinux.X11Display == NULL)
		return;

	XClassHint *classhint = XAllocClassHint();
	classhint->res_name  = (char *)name.c_str();
	classhint->res_class = (char *)name.c_str();

	XSetClassHint((Display *)video_data.OpenGLLinux.X11Display,
		video_data.OpenGLLinux.X11Window, classhint);
	XFree(classhint);
#endif
}
Ejemplo n.º 29
0
bool KSMShutdownDlg::confirmShutdown(
        bool maysd, bool choose, KWorkSpace::ShutdownType& sdtype, QString& bootOption,
        const QString& theme)
{
    QScopedPointer<KSMShutdownDlg> l(new KSMShutdownDlg( 0, maysd, choose, sdtype, theme ));

    XClassHint classHint;
    classHint.res_name = const_cast<char*>("ksmserver");
    classHint.res_class = const_cast<char*>("ksmserver");
    XSetClassHint(QX11Info::display(), l->winId(), &classHint);

    bool result = l->exec();
    sdtype = l->m_shutdownType;
    bootOption = l->m_bootOption;

    return result;
}
Ejemplo n.º 30
0
void set_wm_class(window *win, wm_class_context *ctx)
{
    XClassHint *hint = XAllocClassHint();

    if (hint == NULL) {
        print_error("system error: XAllocClassHint");
        exit(EXIT_FAILURE);
    }

    hint->res_name = ctx->name;
    hint->res_class = ctx->class;
    XSetClassHint(win->display, win->window, hint);

    *(ctx->done) += 1;

    XFree(hint);
}