Esempio n. 1
0
static void* draw_framebuffer_data(GtkWidget *widget)
{
    char *pixels;
    struct fb_fix_screeninfo fix;
    struct fb_var_screeninfo var;

    get_screen_info(&var, &fix);
    gtk_widget_set_size_request(widget, var.xres, var.yres);
    pixels = mmap(NULL, fix.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb0, 0);

    switch (var.bits_per_pixel) {
    case 24:
        gdk_draw_rgb_image(widget->window,
                widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                var.xoffset, var.yoffset, var.xres, var.yres,
                GDK_RGB_DITHER_NONE, pixels, fix.line_length);
    case 32:
        gdk_draw_rgb_32_image(widget->window,
                widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                var.xoffset, var.yoffset, var.xres, var.yres,
                GDK_RGB_DITHER_NONE, pixels, fix.line_length);
        break;
    }

    munmap(pixels, fix.smem_len);
}
Esempio n. 2
0
static void on_set_screen(xcb_randr_set_screen_config_reply_t *reply)
{
    struct screen_info *screen_info = get_screen_info(reply->root);

    if (!screen_info) {
        g_warning("Unknown screen\n");
        return;
    }

    screen_info->config_timestamp = reply->config_timestamp;
}
Esempio n. 3
0
BOOL wf_peer_post_connect(freerdp_peer* client)
{
	int i;
	wfInfo* wfi;
	rdpSettings* settings;
	wfPeerContext* context = (wfPeerContext*) client->context;

	wfi = context->info;
	settings = client->settings;

	if (	(get_screen_info(wfi->screenID, NULL, &wfi->servscreen_width, &wfi->servscreen_height, &wfi->bitsPerPixel) == 0) ||
		(wfi->servscreen_width == 0) ||
		(wfi->servscreen_height == 0) ||
		(wfi->bitsPerPixel == 0) )
	{
		_tprintf(_T("postconnect: error getting screen info for screen %d\n"), wfi->screenID);
		_tprintf(_T("\t%dx%dx%d\n"), wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
		return FALSE;
	}

	if ((settings->DesktopWidth != wfi->servscreen_width) || (settings->DesktopHeight != wfi->servscreen_height))
	{
		/*
		printf("Client requested resolution %dx%d, but will resize to %dx%d\n",
			settings->DesktopWidth, settings->DesktopHeight, wfi->servscreen_width, wfi->servscreen_height);
			*/

		settings->DesktopWidth = wfi->servscreen_width;
		settings->DesktopHeight = wfi->servscreen_height;
		settings->ColorDepth = wfi->bitsPerPixel;

		client->update->DesktopResize(client->update->context);
	}

	for (i = 0; i < client->settings->ChannelCount; i++)
	{
		if (client->settings->ChannelDefArray[i].joined)
		{
			if (strncmp(client->settings->ChannelDefArray[i].Name, "rdpsnd", 6) == 0)
			{
				wf_peer_rdpsnd_init(context); /* Audio Output */
			}
		}
	}

	return TRUE;
}
Esempio n. 4
0
static gint
get_window_zorder (GdkWindow *window)
{
  GailScreenInfo *info;
  Window          xid;
  int             i;
  int             zorder;
  int             w_desktop;

  gail_return_val_if_fail (GDK_IS_WINDOW (window), -1);

  info = get_screen_info (
		gdk_drawable_get_screen (GDK_DRAWABLE (window)));

  gail_return_val_if_fail (info->stacked_windows != NULL, -1);

  xid = GDK_WINDOW_XID (window);

  w_desktop = -1;
  for (i = 0; i < info->stacked_windows_len; i++)
    {
      if (info->stacked_windows [i] == xid)
        {
          w_desktop = info->desktop[i];
          break;
        }
    }
  if (w_desktop < 0)
    return w_desktop;

  zorder = 0;
  for (i = 0; i < info->stacked_windows_len; i++)
    {
      if (info->stacked_windows [i] == xid)
        {
          return zorder;
        }
      else
        {
          if (info->desktop[i] == w_desktop)
            zorder++;
        }
     }

  return -1;
}
Esempio n. 5
0
BOOL wf_peer_post_connect(freerdp_peer* client)
{
	int i;
	wfInfo* wfi;
	rdpSettings* settings;
	wfPeerContext* context = (wfPeerContext*) client->context;

	wfi = context->info;
	settings = client->settings;

	if ((get_screen_info(wfi->screenID, NULL, &wfi->servscreen_width, &wfi->servscreen_height, &wfi->bitsPerPixel) == 0) ||
		(wfi->servscreen_width == 0) ||
		(wfi->servscreen_height == 0) ||
		(wfi->bitsPerPixel == 0) )
	{
		WLog_ERR(TAG, "postconnect: error getting screen info for screen %d", wfi->screenID);
		WLog_ERR(TAG, "\t%dx%dx%d", wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
		return FALSE;
	}

	if ((settings->DesktopWidth != wfi->servscreen_width) || (settings->DesktopHeight != wfi->servscreen_height))
	{
		/*
		WLog_DBG(TAG, "Client requested resolution %dx%d, but will resize to %dx%d",
			settings->DesktopWidth, settings->DesktopHeight, wfi->servscreen_width, wfi->servscreen_height);
			*/

		settings->DesktopWidth = wfi->servscreen_width;
		settings->DesktopHeight = wfi->servscreen_height;
		settings->ColorDepth = wfi->bitsPerPixel;

		client->update->DesktopResize(client->update->context);
	}

	if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "rdpsnd"))
	{
		wf_peer_rdpsnd_init(context); /* Audio Output */
	}

	return TRUE;
}
Esempio n. 6
0
static void on_screen_change(xcb_randr_screen_change_notify_event_t *ev)
{
    struct screen_info *screen_info = get_screen_info(ev->root);
    xcb_randr_rotation_t rotation = normalize_rotation(ev->rotation);

    if (!screen_info) {
        g_warning("Unable to find screen\n");
        return;
    }

    /* Update menu items with new rotation setting */
    screen_info->config_timestamp = ev->config_timestamp;
    screen_info->rotation = rotation;

    check_rotation_menu_item(screen_info,
            rotation & xcb_rotations_mask, TRUE);
    check_rotation_menu_item(screen_info, XCB_RANDR_ROTATION_REFLECT_X,
            rotation & XCB_RANDR_ROTATION_REFLECT_X);
    check_rotation_menu_item(screen_info, XCB_RANDR_ROTATION_REFLECT_Y,
            rotation & XCB_RANDR_ROTATION_REFLECT_Y);
}
Esempio n. 7
0
/**
 * Writes the given character to the focused process, if one exists. Otherwise
 * the character is discarded.
 * 
 * @param	c		The character to write
 */
void _ps2_write_to_active( char c ){

	// Grab focused process
	Pid active_p = get_active_pid();

	// Throw away the character if there is no focused process
	if( active_p == 0 ){
		return;
	}


	// Find the IO-request for this process
	int index = 0;
	while( index < TOTAL_IO_REQS ){
		if( requests[ index ]->pid == active_p )
			break;
		index ++;
	}
	if( index == TOTAL_IO_REQS )
		return; // The focused process does not want input
	
	// Write the character
	// Check if we need to return a special character, or write to buf
	//c_printf( "Index: %d    Size: %d\n", requests[ index ]->index, requests[ index ]->size);
	char *buf = requests[ index ]->buf;
	Uint8 flags = 0;
	//c_printf(" Writing Buf Addr: 0x%x\n", buf);
	Uint32 currentCr3 = _isr_vmem_getcr3();
	_vmeml2_change_page(requests[ index ]->pdt);
	//c_printf(" Writing Buf Addr: 0x%x 0x%x\n", buf, buf+sizeof(char));
	if( requests[ index ]->size == 0 ){
		buf[1] = c;
		if( shift_pressed )
			flags = flags | 4;
		if( alt_pressed )
			flags = flags | 2;
		if( ctrl_pressed )
			flags = flags | 1;
		buf[0] = (char) flags;
		Pcb *pcb = _ps2_remove_from_queue( index );
		_ps2_delete_request( index );
		_sched( pcb );
	}
	else{
		// We need to print the character for the user
        screen_info* si = get_screen_info( active_p );
        gl_putchar_s( c, si );

		// store the character
		int i = requests[ index ]->index;
		if( c != '\n'){
			buf[ i ] = c;
			requests[ index ]->index = i + 1;
		}
		
		// stop reading if full, or newline
		if( i == requests[ index ]->size || c == '\n' ){
			buf[ i ] = '\0';
			
			// pull from IO-blocking queue
			if( !_q_empty( _buf_block ) ){
				Pcb *pcb = _ps2_remove_from_queue( index );
				_sched( pcb );
			}
			else{
				// did someone forcefully remove it!?!
				c_printf( "keyboard, write active: buffered block queue is"
							" empty???\n" );
			}
			
			// Delete the process from our IO request array
			_ps2_delete_request( index );
		}
	}
	_vmeml2_change_page( currentCr3);
}