mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
xf_floatbar use XmbDrawString instead of XDrawString (#8127)
* xf_floatbar use XmbDrawString instead of XDrawString * xf_floatbar fall back to XDrawString when fontSet is NULL Co-authored-by: Jianfeng Liu <jfliu@zshield.net>
This commit is contained in:
parent
942273e9cb
commit
899424e941
@ -92,6 +92,7 @@ struct xf_floatbar
|
|||||||
BOOL created;
|
BOOL created;
|
||||||
Window root_window;
|
Window root_window;
|
||||||
char* title;
|
char* title;
|
||||||
|
XFontSet fontSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
static xfFloatbarButton* xf_floatbar_new_button(xfFloatbar* floatbar, int type);
|
static xfFloatbarButton* xf_floatbar_new_button(xfFloatbar* floatbar, int type);
|
||||||
@ -334,6 +335,16 @@ xfFloatbar* xf_floatbar_new(xfContext* xfc, Window window, const char* name, DWO
|
|||||||
floatbar->xfc = xfc;
|
floatbar->xfc = xfc;
|
||||||
floatbar->locked = flags & 0x0002;
|
floatbar->locked = flags & 0x0002;
|
||||||
xf_floatbar_toggle_fullscreen(floatbar, FALSE);
|
xf_floatbar_toggle_fullscreen(floatbar, FALSE);
|
||||||
|
char** missingList;
|
||||||
|
int missingCount;
|
||||||
|
char* defString;
|
||||||
|
floatbar->fontSet = XCreateFontSet(floatbar->xfc->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
|
||||||
|
&missingList, &missingCount, &defString);
|
||||||
|
if (floatbar->fontSet == NULL)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "Failed to create fontset");
|
||||||
|
}
|
||||||
|
XFreeStringList(missingList);
|
||||||
return floatbar;
|
return floatbar;
|
||||||
fail:
|
fail:
|
||||||
xf_floatbar_free(floatbar);
|
xf_floatbar_free(floatbar);
|
||||||
@ -401,8 +412,16 @@ static void xf_floatbar_event_expose(xfFloatbar* floatbar)
|
|||||||
/* draw the host name connected to (limit to maximum file name) */
|
/* draw the host name connected to (limit to maximum file name) */
|
||||||
len = strnlen(floatbar->title, MAX_PATH);
|
len = strnlen(floatbar->title, MAX_PATH);
|
||||||
XSetForeground(display, gc, xf_floatbar_get_color(floatbar, FLOATBAR_COLOR_FOREGROUND));
|
XSetForeground(display, gc, xf_floatbar_get_color(floatbar, FLOATBAR_COLOR_FOREGROUND));
|
||||||
XDrawString(display, floatbar->handle, gc, floatbar->width / 2 - len * 2, 15, floatbar->title,
|
if (floatbar->fontSet != NULL)
|
||||||
len);
|
{
|
||||||
|
XmbDrawString(display, floatbar->handle, floatbar->fontSet, gc,
|
||||||
|
floatbar->width / 2 - len * 2, 15, floatbar->title, len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XDrawString(display, floatbar->handle, gc, floatbar->width / 2 - len * 2, 15,
|
||||||
|
floatbar->title, len);
|
||||||
|
}
|
||||||
XFreeGC(display, gc);
|
XFreeGC(display, gc);
|
||||||
XFreeGC(display, shape_gc);
|
XFreeGC(display, shape_gc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user