Example #1
0
int
fb_dd_close(void)
{
#ifdef WIN32
    window_redraw();

    //WaitForSingleObject(thread, INFINITE);
#endif	/* WITH_OPENGL	*/



#ifdef WITH_X11
    XPutImage(disp, window, gc, xim, 0, 0, 0, 0, gwidth, gheight);
    XFlush(disp);

    pthread_join(thread, NULL);

    /* gbuf is already freed by XDestroyImage().
     * No ri_mem_free(gbuf) is required.
     */

#endif

#ifdef WITH_AQUA
    int packetsize;

    //display(aglctx);

    //pthread_join(thread, NULL);

    if (bufcount != 0) {
        /* send reminder */

        packetsize = bufcount;

        /* send packet data size */
        write(gfd[1], (void *)&packetsize, sizeof(int));

        /* send pixel contents */
        write(gfd[1],
              (void *)&pixpackets,
              sizeof(pixel_packet_t) * packetsize);

    }

    wait((int *)0);

    ri_mem_free(gbuf);

#endif

    ri_mem_free(gmask);

    return 1;
}
Example #2
0
int gled_init()
{
  if(SDL_Init(SDL_INIT_EVERYTHING) != 0){
    printf("SDL init failed.\n");
    return -1;
  }
  if(TTF_Init() != 0){
    printf("TTF init failed: %s\n", TTF_GetError());
    return -2;
  }

  main_win = new_Window(40, 25);
  if(main_win == NULL){
    return -3;
  }
  window_redraw(main_win);
  return 0;
}
Example #3
0
BOOL wl_post_connect(freerdp* instance)
{
	struct window* window;
	struct wl_context* context;

	context = (struct wl_context*) instance->context;

	window = malloc(sizeof(*window));
	window->width = instance->settings->DesktopWidth;
	window->height = instance->settings->DesktopHeight;
	window->buffers[0].busy = 0;
	window->buffers[1].busy = 0;
	window->callback = NULL;
	window->display = context->display;
	window->surface = wl_compositor_create_surface(window->display->compositor);
	window->shell_surface = wl_shell_get_shell_surface(window->display->shell, window->surface);

	wl_shell_surface_add_listener(window->shell_surface, &wl_shell_surface_listener, NULL);
	wl_shell_surface_set_title(window->shell_surface, "FreeRDP");
	wl_shell_surface_set_toplevel(window->shell_surface);
	wl_surface_damage(window->surface, 0, 0, window->width, window->height);

	 /* GC/GDI logic here */
	rdpGdi* gdi;

	gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
	gdi = instance->context->gdi;

	 /* fill buffer with first image here */
	window->data = malloc (gdi->width * gdi->height *4);
	memcpy(window->data, (void*) gdi->primary_buffer, gdi->width * gdi->height * 4);
	instance->update->BeginPaint = wl_begin_paint;
	instance->update->EndPaint = wl_end_paint;

	 /* put Wayland data in the context here */
	context->window = window;

	freerdp_channels_post_connect(instance->context->channels, instance);

	window_redraw(window, NULL, 0);

	return TRUE;
}
Example #4
0
void window_fill_rect(struct OsecpuWindow* window, int color, int x, int y, int width, int height)
{
	struct WindowQueue* qdata;
	double r = ((double)((color & 0xff0000) >> 16))/255;
	double g = ((double)((color & 0x00ff00) >>  8))/255;
	double b = ((double)((color & 0x0000ff) >>  0))/255;
	cairo_t* cr;

	pthread_mutex_lock(&window->surface_mutex);

	cr = cairo_create(window->surface);
	cairo_set_source_rgb(cr, r, g, b);
	cairo_rectangle(cr, x, y, width, height);
	cairo_fill(cr);
	cairo_destroy(cr);

	pthread_mutex_unlock(&window->surface_mutex);

	window_redraw(window);
}
Example #5
0
void window_fill_oval(struct OsecpuWindow* window, int color, int x, int y, int width, int height)
{
	struct WindowQueue* qdata;
	double r = ((double)((color & 0xff0000) >> 16))/255;
	double g = ((double)((color & 0x00ff00) >>  8))/255;
	double b = ((double)((color & 0x0000ff) >>  0))/255;
	cairo_t* cr;

	pthread_mutex_lock(&window->surface_mutex);

	cr = cairo_create(window->surface);
	cairo_set_source_rgb(cr, r, g, b);
	cairo_save(cr);
	cairo_translate(cr, x, y);
	cairo_scale(cr, width/2, height/2);
	cairo_arc(cr, 0, 0, 1.0, 0, M_PI*2);
	cairo_restore(cr);
	cairo_fill(cr);
	cairo_destroy(cr);

	pthread_mutex_unlock(&window->surface_mutex);

	window_redraw(window);
}
Example #6
0
void window_loop()
{
    WNDCLASSEX	wc;
    RECT		clientrect, winrect;
    int		nw, nh;
    MSG		msg;
    HINSTANCE	hinst;

    hinst		= (HINSTANCE)GetModuleHandle(NULL);
    wc.cbSize	= sizeof(WNDCLASSEX);
    wc.style        = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc  = win32_window_proc;
    wc.cbClsExtra	= 0;
    wc.cbWndExtra	= 0;
    wc.hInstance	= hinst;
    wc.hIcon	= LoadIcon(NULL, IDI_APPLICATION);
    wc.hIconSm	= LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor	= LoadCursor(NULL, IDC_ARROW);
    //wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "framebuffer";

    if (!RegisterClassEx(&wc)) {
        printf("cannot register class\n");
        exit(-1);
    }

    ghwnd = CreateWindow(
                "framebuffer", "framebuffer",
                WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT,
                0, gwidth, gheight,
                NULL, NULL, hinst, NULL);

    if (!ghwnd) {
        printf("cant create window\n");
        exit(-1);
    }

    ShowWindow(ghwnd, SW_SHOW);
    UpdateWindow(ghwnd);

    GetWindowRect(ghwnd, &winrect);
    GetClientRect(ghwnd, &clientrect);

    nw = gwidth + (winrect.right - winrect.left) -
         (clientrect.right - clientrect.left);
    nh = gheight + (winrect.bottom - winrect.top) -
         (clientrect.bottom - clientrect.top);

    SetWindowPos(ghwnd, NULL, 0, 0, nw, nh, SWP_SHOWWINDOW);

    bitmap.bmiHeader.biSize		= sizeof(BITMAPINFOHEADER);
    bitmap.bmiHeader.biWidth	= gwidth;
    bitmap.bmiHeader.biHeight	= gheight;
    bitmap.bmiHeader.biPlanes	= 1;
    bitmap.bmiHeader.biBitCount	= 32;
    bitmap.bmiHeader.biCompression	= BI_RGB;
    bitmap.bmiHeader.biSizeImage	= gwidth * gheight * 4;
    bitmap.bmiHeader.biXPelsPerMeter = 0;
    bitmap.bmiHeader.biYPelsPerMeter = 0;
    bitmap.bmiHeader.biClrUsed	= 0;
    bitmap.bmiHeader.biClrImportant	= 0;

    window_redraw();

    /* message loop */
    while (GetMessage(&msg, NULL, 0, 0)) {
        if (msg.message == WM_PAINT) {
            window_redraw();
        }

        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    gactive = 0;
}
Example #7
0
void gled_update()
{
  window_update(main_win);
  window_redraw(main_win);
}
Example #8
0
void gled_redraw()
{
  window_redraw(main_win);
}