xfreerdp-client: attempted fixing build

This commit is contained in:
C-o-r-E 2013-06-26 19:16:28 -04:00
parent 340c3a4246
commit 11b0a9f185
7 changed files with 181 additions and 79 deletions

View File

@ -1704,22 +1704,22 @@ void freerdp_client_reset_scale(xfContext* xfc)
{
ResizeWindowEventArgs e;
xfc->scale = 1.0;
xfc->offset_x = 0;
xfc->offset_y = 0;
xfc->scale = 1.0;
xfc->offset_x = 0;
xfc->offset_y = 0;
xfc->currentWidth = xfc->originalWidth;
xfc->currentHeight = xfc->originalHeight;
xfc->currentWidth = xfc->originalWidth;
xfc->currentHeight = xfc->originalHeight;
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
//IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
//IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
EventArgsInit(&e, "xfreerdp");
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
EventArgsInit(&e, "xfreerdp");
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
xf_draw_screen_scaled(xfc, 0, 0, 0, 0, FALSE);
xf_draw_screen_scaled(xfc, 0, 0, 0, 0, FALSE);
}
int xfreerdp_client_new(freerdp* instance, rdpContext* context)

View File

@ -97,7 +97,7 @@ static BOOL xf_event_Expose(xfContext* xfc, XEvent* event, BOOL app)
if (!app)
{
if ((xfi->scale != 1.0) || (xfi->offset_x) || (xfi->offset_y))
if ((xfc->scale != 1.0) || (xfc->offset_x) || (xfc->offset_y))
{
xf_draw_screen_scaled(xfc, x - xfc->offset_x,
y - xfc->offset_y, w, h, FALSE);

View File

@ -28,10 +28,6 @@
#include <math.h>
#include "xf_event.h"
<<<<<<< HEAD
=======
>>>>>>> awake/master
#include "xf_input.h"
#ifdef WITH_XI
@ -241,7 +237,7 @@ void xf_input_save_last_event(XGenericEventCookie* cookie)
}
void xf_input_detect_pan(xfInfo* xfi)
void xf_input_detect_pan(xfContext* xfc)
{
double dx[2];
double dy[2];
@ -291,7 +287,15 @@ void xf_input_detect_pan(xfInfo* xfi)
*/
IFCALL(xfi->client->OnPan, xfi->instance, 5, 0);
//IFCALL(xfi->client->OnPan, xfi->instance, 5, 0);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 5;
e.ydiff = 0;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
px_vector = 0;
@ -309,7 +313,15 @@ void xf_input_detect_pan(xfInfo* xfi)
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
*/
IFCALL(xfi->client->OnPan, xfi->instance, -5, 0);
//IFCALL(xfi->client->OnPan, xfi->instance, -5, 0);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = -5;
e.ydiff = 0;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
px_vector = 0;
@ -335,7 +347,15 @@ void xf_input_detect_pan(xfInfo* xfi)
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
*/
IFCALL(xfi->client->OnPan, xfi->instance, 0, 5);
//IFCALL(xfi->client->OnPan, xfi->instance, 0, 5);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 0;
e.ydiff = 5;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
py_vector = 0;
@ -352,7 +372,15 @@ void xf_input_detect_pan(xfInfo* xfi)
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
*/
IFCALL(xfi->client->OnPan, xfi->instance, 0, -5);
//IFCALL(xfi->client->OnPan, xfi->instance, 0, -5);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 0;
e.ydiff = -5;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
py_vector = 0;
@ -417,8 +445,8 @@ void xf_input_detect_pinch(xfContext* xfc)
{
xfc->scale -= 0.05;
if (xfi->scale < 0.8)
xfi->scale = 0.8;
if (xfc->scale < 0.8)
xfc->scale = 0.8;
/*
xfi->currentWidth = xfi->originalWidth * xfi->scale;
xfi->currentHeight = xfi->originalHeight * xfi->scale;
@ -435,7 +463,7 @@ void xf_input_detect_pinch(xfContext* xfc)
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
xf_transform_window(xfi);
xf_transform_window(xfc);
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
z_vector = 0;
@ -449,8 +477,8 @@ void xf_input_detect_pinch(xfContext* xfc)
{
xfc->scale += 0.05;
if (xfi->scale > 1.2)
xfi->scale = 1.2;
if (xfc->scale > 1.2)
xfc->scale = 1.2;
/*
xfi->currentWidth = xfi->originalWidth * xfi->scale;
xfi->currentHeight = xfi->originalHeight * xfi->scale;
@ -467,7 +495,7 @@ void xf_input_detect_pinch(xfContext* xfc)
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
xf_transform_window(xfi);
xf_transform_window(xfc);
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);

View File

@ -219,78 +219,101 @@ BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
if (keysym == XK_period)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
//Zoom in (scale larger)
double s = xfi->scale;
double s = xfc->scale;
s += 0.1;
if (s > 2.0)
s = 2.0;
xfi->scale = s;
xfc->scale = s;
xfi->currentWidth = xfi->originalWidth * s;
xfi->currentHeight = xfi->originalHeight * s;
xfc->currentWidth = xfc->originalWidth * s;
xfc->currentHeight = xfc->originalHeight * s;
xf_transform_window(xfi);
xf_transform_window(xfc);
IFCALL(xfi->client->OnResizeWindow,
xfi->instance, xfi->currentWidth, xfi->currentHeight);
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
//IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->currentWidth, xfi->currentHeight);
{
ResizeWindowEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
}
xf_draw_screen_scaled(xfc, 0, 0, 0, 0, FALSE);
return TRUE;
}
}
if (keysym == XK_comma)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
//Zoom out (scale smaller)
double s = xfi->scale;
double s = xfc->scale;
s -= 0.1;
if (s < 0.5)
s = 0.5;
xfi->scale = s;
xfc->scale = s;
xfi->currentWidth = xfi->originalWidth * s;
xfi->currentHeight = xfi->originalHeight * s;
xfc->currentWidth = xfc->originalWidth * s;
xfc->currentHeight = xfc->originalHeight * s;
xf_transform_window(xfi);
xf_transform_window(xfc);
IFCALL(xfi->client->OnResizeWindow,
xfi->instance, xfi->currentWidth, xfi->currentHeight);
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
//IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->currentWidth, xfi->currentHeight);
{
ResizeWindowEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
}
xf_draw_screen_scaled(xfc, 0, 0, 0, 0, FALSE);
return TRUE;
}
}
if (keysym == XK_KP_4)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
/*
xfi->offset_x -= 5;
xfc->offset_x -= 5;
xf_transform_window(xfi);
xf_transform_window(xfc);
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
printf("pan left : %d\n", xfi->offset_x);
xf_draw_screen_scaled(xfc, 0, 0, 0, 0, FALSE);
printf("pan left : %d\n", xfc->offset_x);
*/
IFCALL(xfi->client->OnPan, xfi->instance, -5, 0);
//IFCALL(xfc->client->OnPan, xfi->instance, -5, 0);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = -5;
e.ydiff = 0;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
return TRUE;
}
@ -298,10 +321,10 @@ BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
if (keysym == XK_KP_6)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
/*
@ -316,17 +339,25 @@ BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
printf("pan right : %d\n", xfi->offset_x);
*/
IFCALL(xfi->client->OnPan, xfi->instance, 5, 0);
//IFCALL(xfi->client->OnPan, xfi->instance, 5, 0);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 5;
e.ydiff = 0;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
return TRUE;
}
}
if (keysym == XK_KP_8)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
/*
@ -337,17 +368,25 @@ BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
printf("pan up : %d\n", xfi->offset_y);
*/
IFCALL(xfi->client->OnPan, xfi->instance, 0, -5);
//IFCALL(xfi->client->OnPan, xfi->instance, 0, -5);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 0;
e.ydiff = -5;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
return TRUE;
}
}
if (keysym == XK_KP_2)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L)
|| xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L)
|| xf_kbd_key_pressed(xfi,
if ((xf_kbd_key_pressed(xfc, XK_Alt_L)
|| xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L)
|| xf_kbd_key_pressed(xfc,
XK_Control_R)))
{
/*
@ -361,7 +400,15 @@ BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
xf_draw_screen_scaled(xfi, 0, 0, 0, 0, FALSE);
printf("pan down : %d\n", xfi->offset_y);
*/
IFCALL(xfi->client->OnPan, xfi->instance, 0, 5);
//IFCALL(xfi->client->OnPan, xfi->instance, 0, 5);
{
PanEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.xdiff = 0;
e.ydiff = 5;
PubSub_OnPan(((rdpContext*) xfc)->pubSub, xfc, &e);
}
return TRUE;
}
}

View File

@ -161,8 +161,6 @@ struct xf_context
/* Channels */
RdpeiClientContext* rdpei;
BOOL use_xinput;
};
void xf_create_window(xfContext* xfc);
@ -214,7 +212,7 @@ void xf_lock_x11(xfContext* xfc, BOOL display);
void xf_unlock_x11(xfContext* xfc, BOOL display);
void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h, BOOL scale);
void xf_transform_window(xfInfo* xfi);
void xf_transform_window(xfContext* xfc);
DWORD xf_exit_code_from_disconnect_reason(DWORD reason);

View File

@ -92,6 +92,30 @@ HANDLE freerdp_client_get_thread(rdpContext* context)
return ((rdpClientContext*) context)->thread;
}
double freerdp_client_get_scale(rdpContext* context)
{
return context->scale;
}
void freerdp_client_set_scale(rdpContext* context, double newScale)
{
context->scale = newScale;
context->currentWidth = context->originalWidth * context->scale;
context->currentHeight = context->originalHeight * context->scale;
//need to call transform window
{
ResizeWindowEventArgs e;
EventArgsInit(&e, "xfreerdp");
e.width = (int) xfc->originalWidth * xfc->scale;
e.height = (int) xfc->originalHeight * xfc->scale;
PubSub_OnResizeWindow(((rdpContext*) xfc)->pubSub, xfc, &e);
}
}
int freerdp_client_parse_command_line(rdpContext* context, int argc, char** argv)
{
int status;

View File

@ -41,6 +41,11 @@ DEFINE_EVENT_BEGIN(ResizeWindow)
int width;
int height;
DEFINE_EVENT_END(ResizeWindow)
DEFINE_EVENT_BEGIN(Pan)
int xdiff;
int ydiff;
DEFINE_EVENT_END(Pan)
DEFINE_EVENT_BEGIN(EmbedWindow)
BOOL embed;