Port to Solaris 10u9.

Added -lrt which is a required library for the sem_*() functions
Fixed xf_window.c to not return null for zero-width windows - rather coerce values to be valid as was already being done for height and width. This fixes intermittent crashs on Solars and Linux.
This commit is contained in:
David Sundstrom 2011-10-31 12:55:05 -05:00
parent f714af7659
commit 7322ef8047
2 changed files with 54 additions and 49 deletions

View File

@ -278,6 +278,14 @@ void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* heigh
vscreen_width = xfi->vscreen.area.right - xfi->vscreen.area.left + 1;
vscreen_height = xfi->vscreen.area.bottom - xfi->vscreen.area.top + 1;
if (*width < 1)
{
*width = 1;
}
if (*height < 1)
{
*height = 1;
}
if (*x < xfi->vscreen.area.left)
{
*width += *x;
@ -306,9 +314,6 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
window = (xfWindow*) xzalloc(sizeof(xfWindow));
if ((width * height) < 1)
return NULL;
xf_FixWindowCoordinates(xfi, &x, &y, &width, &height);
window->left = x;
@ -318,55 +323,52 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
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)
{
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);
}
XSetWMProtocols(xfi->display, window->handle, &(xfi->WM_DELETE_WINDOW), 1);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
PointerMotionMask | ExposureMask;
XSelectInput(xfi->display, window->handle, input_mask);
XMapWindow(xfi->display, window->handle);
memset(&gcv, 0, sizeof(gcv));
window->gc = XCreateGC(xfi->display, window->handle, GCGraphicsExposures, &gcv);
window->surface = XCreatePixmap(xfi->display, window->handle, window->width, window->height, xfi->depth);
xf_MoveWindow(xfi, window, x, y, width, height);
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);
}
XSetWMProtocols(xfi->display, window->handle, &(xfi->WM_DELETE_WINDOW), 1);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
PointerMotionMask | ExposureMask;
XSelectInput(xfi->display, window->handle, input_mask);
XMapWindow(xfi->display, window->handle);
memset(&gcv, 0, sizeof(gcv));
window->gc = XCreateGC(xfi->display, window->handle, GCGraphicsExposures, &gcv);
window->surface = XCreatePixmap(xfi->display, window->handle, window->width, window->height, xfi->depth);
xf_MoveWindow(xfi, window, x, y, width, height);
return window;
}

View File

@ -60,5 +60,8 @@ target_link_libraries(freerdp-utils ${CMAKE_THREAD_LIBS_INIT})
if(WIN32)
target_link_libraries(freerdp-utils ws2_32)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
target_link_libraries(freerdp-utils rt)
endif()
install(TARGETS freerdp-utils DESTINATION ${CMAKE_INSTALL_LIBDIR})