commit
57029de270
@ -0,0 +1,147 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(_RAIL_H)
|
||||
#define _RAIL_H
|
||||
|
||||
/*
|
||||
ORDER_TYPE_WINDOW
|
||||
WINDOW_ORDER_TYPE_WINDOW
|
||||
WINDOW_ORDER_ICON
|
||||
WINDOW_ORDER_CACHED_ICON
|
||||
WINDOW_ORDER_STATE_DELETED
|
||||
WINDOW_ORDER_STATE_NEW on
|
||||
WINDOW_ORDER_STATE_NEW off
|
||||
WINDOW_ORDER_TYPE_NOTIFY
|
||||
WINDOW_ORDER_STATE_DELETED
|
||||
WINDOW_ORDER_STATE_NEW on
|
||||
WINDOW_ORDER_STATE_NEW off
|
||||
WINDOW_ORDER_TYPE_DESKTOP
|
||||
WINDOW_ORDER_FIELD_DESKTOP_NONE on
|
||||
WINDOW_ORDER_FIELD_DESKTOP_NONE off
|
||||
*/
|
||||
|
||||
/* Window Order Header Flags */
|
||||
#define WINDOW_ORDER_TYPE_WINDOW 0x01000000
|
||||
#define WINDOW_ORDER_TYPE_NOTIFY 0x02000000
|
||||
#define WINDOW_ORDER_TYPE_DESKTOP 0x04000000
|
||||
#define WINDOW_ORDER_STATE_NEW 0x10000000
|
||||
#define WINDOW_ORDER_STATE_DELETED 0x20000000
|
||||
#define WINDOW_ORDER_FIELD_OWNER 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_STYLE 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_SHOW 0x00000010
|
||||
#define WINDOW_ORDER_FIELD_TITLE 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET 0x00004000
|
||||
#define WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE 0x00010000
|
||||
#define WINDOW_ORDER_FIELD_RP_CONTENT 0x00020000
|
||||
#define WINDOW_ORDER_FIELD_ROOT_PARENT 0x00040000
|
||||
#define WINDOW_ORDER_FIELD_WND_OFFSET 0x00000800
|
||||
#define WINDOW_ORDER_FIELD_WND_CLIENT_DELTA 0x00008000
|
||||
#define WINDOW_ORDER_FIELD_WND_SIZE 0x00000400
|
||||
#define WINDOW_ORDER_FIELD_WND_RECTS 0x00000100
|
||||
#define WINDOW_ORDER_FIELD_VIS_OFFSET 0x00001000
|
||||
#define WINDOW_ORDER_FIELD_VISIBILITY 0x00000200
|
||||
#define WINDOW_ORDER_FIELD_ICON_BIG 0x00002000
|
||||
#define WINDOW_ORDER_ICON 0x40000000
|
||||
#define WINDOW_ORDER_CACHED_ICON 0x80000000
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_VERSION 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_TIP 0x00000001
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_STATE 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_NONE 0x00000001
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_HOOKED 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ARC_COMPLETED 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ARC_BEGAN 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ZORDER 0x00000010
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND 0x00000020
|
||||
|
||||
struct rail_icon_info
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
int cmap_bytes;
|
||||
int mask_bytes;
|
||||
int data_bytes;
|
||||
char* mask;
|
||||
char* cmap;
|
||||
char* data;
|
||||
};
|
||||
|
||||
struct rail_window_rect
|
||||
{
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
};
|
||||
|
||||
struct rail_notify_icon_infotip
|
||||
{
|
||||
int timeout;
|
||||
int flags;
|
||||
char* text;
|
||||
char* title;
|
||||
};
|
||||
|
||||
struct rail_window_state_order
|
||||
{
|
||||
int owner_window_id;
|
||||
int style;
|
||||
int extended_style;
|
||||
int show_state;
|
||||
char* title_info;
|
||||
int client_offset_x;
|
||||
int client_offset_y;
|
||||
int client_area_width;
|
||||
int client_area_height;
|
||||
int rp_content;
|
||||
int root_parent_handle;
|
||||
int window_offset_x;
|
||||
int window_offset_y;
|
||||
int window_client_delta_x;
|
||||
int window_client_delta_y;
|
||||
int window_width;
|
||||
int window_height;
|
||||
int num_window_rects;
|
||||
struct rail_window_rect* window_rects;
|
||||
int visible_offset_x;
|
||||
int visible_offset_y;
|
||||
int num_visibility_rects;
|
||||
struct rail_window_rect* visibility_rects;
|
||||
};
|
||||
|
||||
struct rail_notify_state_order
|
||||
{
|
||||
int version;
|
||||
char* tool_tip;
|
||||
struct rail_notify_icon_infotip infotip;
|
||||
int state;
|
||||
int icon_cache_entry;
|
||||
int icon_cache_id;
|
||||
struct rail_icon_info icon_info;
|
||||
};
|
||||
|
||||
struct rail_monitored_desktop_order
|
||||
{
|
||||
int active_window_id;
|
||||
int num_window_ids;
|
||||
int* window_ids;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,147 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(_RAIL_H)
|
||||
#define _RAIL_H
|
||||
|
||||
/*
|
||||
ORDER_TYPE_WINDOW
|
||||
WINDOW_ORDER_TYPE_WINDOW
|
||||
WINDOW_ORDER_ICON
|
||||
WINDOW_ORDER_CACHED_ICON
|
||||
WINDOW_ORDER_STATE_DELETED
|
||||
WINDOW_ORDER_STATE_NEW on
|
||||
WINDOW_ORDER_STATE_NEW off
|
||||
WINDOW_ORDER_TYPE_NOTIFY
|
||||
WINDOW_ORDER_STATE_DELETED
|
||||
WINDOW_ORDER_STATE_NEW on
|
||||
WINDOW_ORDER_STATE_NEW off
|
||||
WINDOW_ORDER_TYPE_DESKTOP
|
||||
WINDOW_ORDER_FIELD_DESKTOP_NONE on
|
||||
WINDOW_ORDER_FIELD_DESKTOP_NONE off
|
||||
*/
|
||||
|
||||
/* Window Order Header Flags */
|
||||
#define WINDOW_ORDER_TYPE_WINDOW 0x01000000
|
||||
#define WINDOW_ORDER_TYPE_NOTIFY 0x02000000
|
||||
#define WINDOW_ORDER_TYPE_DESKTOP 0x04000000
|
||||
#define WINDOW_ORDER_STATE_NEW 0x10000000
|
||||
#define WINDOW_ORDER_STATE_DELETED 0x20000000
|
||||
#define WINDOW_ORDER_FIELD_OWNER 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_STYLE 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_SHOW 0x00000010
|
||||
#define WINDOW_ORDER_FIELD_TITLE 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET 0x00004000
|
||||
#define WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE 0x00010000
|
||||
#define WINDOW_ORDER_FIELD_RP_CONTENT 0x00020000
|
||||
#define WINDOW_ORDER_FIELD_ROOT_PARENT 0x00040000
|
||||
#define WINDOW_ORDER_FIELD_WND_OFFSET 0x00000800
|
||||
#define WINDOW_ORDER_FIELD_WND_CLIENT_DELTA 0x00008000
|
||||
#define WINDOW_ORDER_FIELD_WND_SIZE 0x00000400
|
||||
#define WINDOW_ORDER_FIELD_WND_RECTS 0x00000100
|
||||
#define WINDOW_ORDER_FIELD_VIS_OFFSET 0x00001000
|
||||
#define WINDOW_ORDER_FIELD_VISIBILITY 0x00000200
|
||||
#define WINDOW_ORDER_FIELD_ICON_BIG 0x00002000
|
||||
#define WINDOW_ORDER_ICON 0x40000000
|
||||
#define WINDOW_ORDER_CACHED_ICON 0x80000000
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_VERSION 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_TIP 0x00000001
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_NOTIFY_STATE 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_NONE 0x00000001
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_HOOKED 0x00000002
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ARC_COMPLETED 0x00000004
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ARC_BEGAN 0x00000008
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ZORDER 0x00000010
|
||||
#define WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND 0x00000020
|
||||
|
||||
struct rail_icon_info
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
int cmap_bytes;
|
||||
int mask_bytes;
|
||||
int data_bytes;
|
||||
char* mask;
|
||||
char* cmap;
|
||||
char* data;
|
||||
};
|
||||
|
||||
struct rail_window_rect
|
||||
{
|
||||
short left;
|
||||
short top;
|
||||
short right;
|
||||
short bottom;
|
||||
};
|
||||
|
||||
struct rail_notify_icon_infotip
|
||||
{
|
||||
int timeout;
|
||||
int flags;
|
||||
char* text;
|
||||
char* title;
|
||||
};
|
||||
|
||||
struct rail_window_state_order
|
||||
{
|
||||
int owner_window_id;
|
||||
int style;
|
||||
int extended_style;
|
||||
int show_state;
|
||||
char* title_info;
|
||||
int client_offset_x;
|
||||
int client_offset_y;
|
||||
int client_area_width;
|
||||
int client_area_height;
|
||||
int rp_content;
|
||||
int root_parent_handle;
|
||||
int window_offset_x;
|
||||
int window_offset_y;
|
||||
int window_client_delta_x;
|
||||
int window_client_delta_y;
|
||||
int window_width;
|
||||
int window_height;
|
||||
int num_window_rects;
|
||||
struct rail_window_rect* window_rects;
|
||||
int visible_offset_x;
|
||||
int visible_offset_y;
|
||||
int num_visibility_rects;
|
||||
struct rail_window_rect* visibility_rects;
|
||||
};
|
||||
|
||||
struct rail_notify_state_order
|
||||
{
|
||||
int version;
|
||||
char* tool_tip;
|
||||
struct rail_notify_icon_infotip infotip;
|
||||
int state;
|
||||
int icon_cache_entry;
|
||||
int icon_cache_id;
|
||||
struct rail_icon_info icon_info;
|
||||
};
|
||||
|
||||
struct rail_monitored_desktop_order
|
||||
{
|
||||
int active_window_id;
|
||||
int num_window_ids;
|
||||
int* window_ids;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=xrdp session manager
|
||||
After=syslog.target network.target
|
||||
StopWhenUnneeded=true
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/var/run/xrdp-sesman.pid
|
||||
EnvironmentFile=/etc/sysconfig/xrdp
|
||||
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
|
||||
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=xrdp daemon
|
||||
Requires=xrdp-sesman.service
|
||||
After=syslog.target network.target xrdp-sesman.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/var/run/xrdp.pid
|
||||
EnvironmentFile=/etc/sysconfig/xrdp
|
||||
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
|
||||
ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,625 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "libxrdp.h"
|
||||
#include "xrdp_rail.h"
|
||||
|
||||
/* [MS-RDPERP]: Remote Desktop Protocol:
|
||||
Remote Programs Virtual Channel Extension
|
||||
http://msdn.microsoft.com/en-us/library/cc242568(v=prot.10) */
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_delete(struct xrdp_orders* self, int window_id)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
|
||||
order_size = 11;
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
field_present_flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_STATE_DELETED;
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
/* flags can contain WINDOW_ORDER_STATE_NEW and/or
|
||||
WINDOW_ORDER_FIELD_ICON_BIG */
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_cached_icon(struct xrdp_orders* self,
|
||||
int window_id, int cache_entry,
|
||||
int cache_id, int flags)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
|
||||
order_size = 14;
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
field_present_flags = flags | WINDOW_ORDER_TYPE_WINDOW |
|
||||
WINDOW_ORDER_CACHED_ICON;
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
/* CacheEntry (2 bytes) */
|
||||
out_uint16_le(self->out_s, cache_entry);
|
||||
/* CacheId (1 byte) */
|
||||
out_uint8(self->out_s, cache_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
static int APP_CC
|
||||
xrdp_orders_send_ts_icon(struct stream* s, int cache_entry, int cache_id,
|
||||
struct rail_icon_info* icon_info)
|
||||
{
|
||||
int use_cmap;
|
||||
|
||||
use_cmap = 0;
|
||||
if ((icon_info->bpp == 1) || (icon_info->bpp == 2) || (icon_info->bpp == 4))
|
||||
{
|
||||
use_cmap = 1;
|
||||
}
|
||||
|
||||
/* TS_ICON_INFO */
|
||||
out_uint16_le(s, cache_entry);
|
||||
out_uint8(s, cache_id);
|
||||
out_uint8(s, icon_info->bpp);
|
||||
out_uint16_le(s, icon_info->width);
|
||||
out_uint16_le(s, icon_info->height);
|
||||
if (use_cmap)
|
||||
{
|
||||
out_uint16_le(s, icon_info->cmap_bytes);
|
||||
}
|
||||
out_uint16_le(s, icon_info->mask_bytes);
|
||||
out_uint16_le(s, icon_info->data_bytes);
|
||||
out_uint8p(s, icon_info->mask, icon_info->mask_bytes);
|
||||
if (use_cmap)
|
||||
{
|
||||
out_uint8p(s, icon_info->cmap, icon_info->cmap_bytes);
|
||||
}
|
||||
out_uint8p(s, icon_info->data, icon_info->data_bytes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
/* flags can contain WINDOW_ORDER_STATE_NEW and/or
|
||||
WINDOW_ORDER_FIELD_ICON_BIG */
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_icon(struct xrdp_orders* self,
|
||||
int window_id, int cache_entry, int cache_id,
|
||||
struct rail_icon_info* icon_info,
|
||||
int flags)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
int use_cmap;
|
||||
|
||||
use_cmap = 0;
|
||||
if ((icon_info->bpp == 1) || (icon_info->bpp == 2) || (icon_info->bpp == 4))
|
||||
{
|
||||
use_cmap = 1;
|
||||
}
|
||||
order_size = 23 + icon_info->mask_bytes + icon_info->data_bytes;
|
||||
if (use_cmap)
|
||||
{
|
||||
order_size += icon_info->cmap_bytes + 2;
|
||||
}
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
field_present_flags = flags | WINDOW_ORDER_TYPE_WINDOW |
|
||||
WINDOW_ORDER_ICON;
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
|
||||
xrdp_orders_send_ts_icon(self->out_s, cache_entry, cache_id, icon_info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
static int APP_CC
|
||||
xrdp_orders_send_as_unicode(struct stream* s, const char* text)
|
||||
{
|
||||
int str_chars;
|
||||
int index;
|
||||
int i32;
|
||||
twchar wdst[256];
|
||||
|
||||
str_chars = g_mbstowcs(wdst, text, 255);
|
||||
if (str_chars > 0)
|
||||
{
|
||||
i32 = str_chars * 2;
|
||||
out_uint16_le(s, i32);
|
||||
for (index = 0; index < str_chars; index++)
|
||||
{
|
||||
i32 = wdst[index];
|
||||
out_uint16_le(s, i32);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
out_uint16_le(s, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
/* flags can contain WINDOW_ORDER_STATE_NEW */
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_new_update(struct xrdp_orders* self, int window_id,
|
||||
struct rail_window_state_order* window_state,
|
||||
int flags)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
int num_chars;
|
||||
int index;
|
||||
|
||||
order_size = 11;
|
||||
field_present_flags = flags | WINDOW_ORDER_TYPE_WINDOW;
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_OWNER)
|
||||
{
|
||||
/* ownerWindowId (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_STYLE)
|
||||
{
|
||||
/* style (4 bytes) */
|
||||
order_size += 4;
|
||||
/* extendedStyle (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_SHOW)
|
||||
{
|
||||
/* showState (1 byte) */
|
||||
order_size += 1;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_TITLE)
|
||||
{
|
||||
/* titleInfo */
|
||||
num_chars = g_mbstowcs(0, window_state->title_info, 0);
|
||||
order_size += 2 * num_chars + 2;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
||||
{
|
||||
/* clientOffsetX (4 bytes) */
|
||||
order_size += 4;
|
||||
/* clientOffsetY (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
||||
{
|
||||
/* clientAreaWidth (4 bytes) */
|
||||
order_size += 4;
|
||||
/* clientAreaHeight (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
||||
{
|
||||
/* RPContent (1 byte) */
|
||||
order_size += 1;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
||||
{
|
||||
/* rootParentHandle (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
||||
{
|
||||
/* windowOffsetX (4 bytes) */
|
||||
order_size += 4;
|
||||
/* windowOffsetY (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
||||
{
|
||||
/* windowClientDeltaX (4 bytes) */
|
||||
order_size += 4;
|
||||
/* windowClientDeltaY (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_SIZE)
|
||||
{
|
||||
/* windowWidth (4 bytes) */
|
||||
order_size += 4;
|
||||
/* windowHeight (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_RECTS)
|
||||
{
|
||||
/* numWindowRects (2 bytes) */
|
||||
order_size += 2;
|
||||
order_size += 8 * window_state->num_window_rects;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
||||
{
|
||||
/* visibleOffsetX (4 bytes) */
|
||||
order_size += 4;
|
||||
/* visibleOffsetY (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_VISIBILITY)
|
||||
{
|
||||
/* numVisibilityRects (2 bytes) */
|
||||
order_size += 2;
|
||||
order_size += 8 * window_state->num_visibility_rects;
|
||||
}
|
||||
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_OWNER)
|
||||
{
|
||||
/* ownerWindowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->owner_window_id);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_STYLE)
|
||||
{
|
||||
/* style (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->style);
|
||||
/* extendedStyle (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->extended_style);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_SHOW)
|
||||
{
|
||||
/* showState (1 byte) */
|
||||
out_uint8(self->out_s, window_state->show_state);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_TITLE)
|
||||
{
|
||||
/* titleInfo */
|
||||
xrdp_orders_send_as_unicode(self->out_s, window_state->title_info);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
||||
{
|
||||
/* clientOffsetX (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->client_offset_x);
|
||||
/* clientOffsetY (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->client_offset_y);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
||||
{
|
||||
/* clientAreaWidth (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->client_area_width);
|
||||
/* clientAreaHeight (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->client_area_height);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
||||
{
|
||||
/* RPContent (1 byte) */
|
||||
out_uint8(self->out_s, window_state->rp_content);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
||||
{
|
||||
/* rootParentHandle (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->root_parent_handle);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
||||
{
|
||||
/* windowOffsetX (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_offset_x);
|
||||
/* windowOffsetY (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_offset_y);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
||||
{
|
||||
/* windowClientDeltaX (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_client_delta_x);
|
||||
/* windowClientDeltaY (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_client_delta_y);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_SIZE)
|
||||
{
|
||||
/* windowWidth (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_width);
|
||||
/* windowHeight (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->window_height);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_WND_RECTS)
|
||||
{
|
||||
/* numWindowRects (2 bytes) */
|
||||
out_uint16_le(self->out_s, window_state->num_window_rects);
|
||||
for (index = 0; index < window_state->num_window_rects; index++)
|
||||
{
|
||||
out_uint16_le(self->out_s, window_state->window_rects[index].left);
|
||||
out_uint16_le(self->out_s, window_state->window_rects[index].top);
|
||||
out_uint16_le(self->out_s, window_state->window_rects[index].right);
|
||||
out_uint16_le(self->out_s, window_state->window_rects[index].bottom);
|
||||
}
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
||||
{
|
||||
/* visibleOffsetX (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->visible_offset_x);
|
||||
/* visibleOffsetY (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_state->visible_offset_y);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_VISIBILITY)
|
||||
{
|
||||
/* numVisibilityRects (2 bytes) */
|
||||
out_uint16_le(self->out_s, window_state->num_visibility_rects);
|
||||
for (index = 0; index < window_state->num_visibility_rects; index++)
|
||||
{
|
||||
out_uint16_le(self->out_s, window_state->visibility_rects[index].left);
|
||||
out_uint16_le(self->out_s, window_state->visibility_rects[index].top);
|
||||
out_uint16_le(self->out_s, window_state->visibility_rects[index].right);
|
||||
out_uint16_le(self->out_s, window_state->visibility_rects[index].bottom);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
int APP_CC
|
||||
xrdp_orders_send_notify_delete(struct xrdp_orders* self, int window_id,
|
||||
int notify_id)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
|
||||
order_size = 15;
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
field_present_flags = WINDOW_ORDER_TYPE_NOTIFY | WINDOW_ORDER_STATE_DELETED;
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
/* notifyIconId (4 bytes) */
|
||||
out_uint32_le(self->out_s, notify_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
/* flags can contain WINDOW_ORDER_STATE_NEW */
|
||||
int APP_CC
|
||||
xrdp_orders_send_notify_new_update(struct xrdp_orders* self,
|
||||
int window_id, int notify_id,
|
||||
struct rail_notify_state_order* notify_state,
|
||||
int flags)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
int num_chars;
|
||||
int use_cmap;
|
||||
|
||||
order_size = 15;
|
||||
field_present_flags = flags | WINDOW_ORDER_TYPE_NOTIFY;
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
||||
{
|
||||
/* Version (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
|
||||
{
|
||||
/* ToolTip (variable) UNICODE_STRING */
|
||||
num_chars = g_mbstowcs(0, notify_state->tool_tip, 0);
|
||||
order_size += 2 * num_chars + 2;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
||||
{
|
||||
/* InfoTip (variable) TS_NOTIFY_ICON_INFOTIP */
|
||||
/* UNICODE_STRING */
|
||||
num_chars = g_mbstowcs(0, notify_state->infotip.title, 0);
|
||||
order_size += 2 * num_chars + 2;
|
||||
/* UNICODE_STRING */
|
||||
num_chars = g_mbstowcs(0, notify_state->infotip.text, 0);
|
||||
order_size += 2 * num_chars + 2;
|
||||
/* Timeout (4 bytes) */
|
||||
/* InfoFlags (4 bytes) */
|
||||
order_size += 8;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_STATE)
|
||||
{
|
||||
/* State (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_ICON)
|
||||
{
|
||||
/* Icon (variable) */
|
||||
use_cmap = 0;
|
||||
if ((notify_state->icon_info.bpp == 1) || (notify_state->icon_info.bpp == 2) ||
|
||||
(notify_state->icon_info.bpp == 4))
|
||||
{
|
||||
use_cmap = 1;
|
||||
}
|
||||
order_size += 12 + notify_state->icon_info.mask_bytes +
|
||||
notify_state->icon_info.data_bytes;
|
||||
if (use_cmap)
|
||||
{
|
||||
order_size += notify_state->icon_info.cmap_bytes + 2;
|
||||
}
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_CACHED_ICON)
|
||||
{
|
||||
/* CachedIcon (3 bytes) */
|
||||
order_size += 3;
|
||||
}
|
||||
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
/* windowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, window_id);
|
||||
/* notifyIconId (4 bytes) */
|
||||
out_uint32_le(self->out_s, notify_id);
|
||||
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
||||
{
|
||||
/* Version (4 bytes) */
|
||||
out_uint32_le(self->out_s, notify_state->version);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
|
||||
{
|
||||
/* ToolTip (variable) UNICODE_STRING */
|
||||
xrdp_orders_send_as_unicode(self->out_s, notify_state->tool_tip);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
||||
{
|
||||
/* InfoTip (variable) TS_NOTIFY_ICON_INFOTIP */
|
||||
out_uint32_le(self->out_s, notify_state->infotip.timeout);
|
||||
out_uint32_le(self->out_s, notify_state->infotip.flags);
|
||||
xrdp_orders_send_as_unicode(self->out_s, notify_state->infotip.text);
|
||||
xrdp_orders_send_as_unicode(self->out_s, notify_state->infotip.title);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_NOTIFY_STATE)
|
||||
{
|
||||
/* State (4 bytes) */
|
||||
out_uint32_le(self->out_s, notify_state->state);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_ICON)
|
||||
{
|
||||
/* Icon (variable) */
|
||||
xrdp_orders_send_ts_icon(self->out_s, notify_state->icon_cache_entry,
|
||||
notify_state->icon_cache_id,
|
||||
¬ify_state->icon_info);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_CACHED_ICON)
|
||||
{
|
||||
/* CacheEntry (2 bytes) */
|
||||
out_uint16_le(self->out_s, notify_state->icon_cache_entry);
|
||||
/* CacheId (1 byte) */
|
||||
out_uint8(self->out_s, notify_state->icon_cache_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* RAIL */
|
||||
/* returns error */
|
||||
/* used for both Non-Monitored Desktop and Actively Monitored Desktop */
|
||||
int APP_CC
|
||||
xrdp_orders_send_monitored_desktop(struct xrdp_orders* self,
|
||||
struct rail_monitored_desktop_order* mdo,
|
||||
int flags)
|
||||
{
|
||||
int order_size;
|
||||
int order_flags;
|
||||
int field_present_flags;
|
||||
int index;
|
||||
|
||||
order_size = 7;
|
||||
field_present_flags = flags | WINDOW_ORDER_TYPE_DESKTOP;
|
||||
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
|
||||
{
|
||||
/* ActiveWindowId (4 bytes) */
|
||||
order_size += 4;
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
||||
{
|
||||
/* NumWindowIds (1 byte) */
|
||||
order_size += 1;
|
||||
/* WindowIds (variable) */
|
||||
order_size += mdo->num_window_ids * 4;
|
||||
}
|
||||
|
||||
xrdp_orders_check(self, order_size);
|
||||
self->order_count++;
|
||||
order_flags = RDP_ORDER_SECONDARY;
|
||||
order_flags |= 0xb << 2; /* type TS_ALTSEC_WINDOW */
|
||||
out_uint8(self->out_s, order_flags);
|
||||
/* orderSize (2 bytes) */
|
||||
out_uint16_le(self->out_s, order_size);
|
||||
/* FieldsPresentFlags (4 bytes) */
|
||||
out_uint32_le(self->out_s, field_present_flags);
|
||||
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND)
|
||||
{
|
||||
/* ActiveWindowId (4 bytes) */
|
||||
out_uint32_le(self->out_s, mdo->active_window_id);
|
||||
}
|
||||
if (field_present_flags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
||||
{
|
||||
/* NumWindowIds (1 byte) */
|
||||
out_uint8(self->out_s, mdo->num_window_ids);
|
||||
/* WindowIds (variable) */
|
||||
for (index = 0; index < mdo->num_window_ids; index++)
|
||||
{
|
||||
out_uint32_le(self->out_s, mdo->window_ids[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(_XRDP_ORDERS_RAIL_H)
|
||||
#define _XRDP_ORDERS_RAIL_H
|
||||
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_delete(struct xrdp_orders* self, int window_id);
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_cached_icon(struct xrdp_orders* self,
|
||||
int window_id, int cache_entry,
|
||||
int cache_id, int flags);
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_icon(struct xrdp_orders* self,
|
||||
int window_id, int cache_entry, int cache_id,
|
||||
struct rail_icon_info* icon_info,
|
||||
int flags);
|
||||
int APP_CC
|
||||
xrdp_orders_send_window_new_update(struct xrdp_orders* self, int window_id,
|
||||
struct rail_window_state_order* window_state,
|
||||
int flags);
|
||||
int APP_CC
|
||||
xrdp_orders_send_notify_delete(struct xrdp_orders* self, int window_id,
|
||||
int notify_id);
|
||||
int APP_CC
|
||||
xrdp_orders_send_notify_new_update(struct xrdp_orders* self,
|
||||
int window_id, int notify_id,
|
||||
struct rail_notify_state_order* notify_state,
|
||||
int flags);
|
||||
int APP_CC
|
||||
xrdp_orders_send_monitored_desktop(struct xrdp_orders* self,
|
||||
struct rail_monitored_desktop_order* mdo,
|
||||
int flags);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,677 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
window manager info
|
||||
http://www.freedesktop.org/wiki/Specifications/wm-spec
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "chansrv.h"
|
||||
#include "rail.h"
|
||||
#include "xcommon.h"
|
||||
#include "log.h"
|
||||
#include "os_calls.h"
|
||||
#include "thread_calls.h"
|
||||
|
||||
extern int g_rail_chan_id; /* in chansrv.c */
|
||||
extern int g_display_num; /* in chansrv.c */
|
||||
extern char* g_exec_name; /* in chansrv.c */
|
||||
extern tbus g_exec_event; /* in chansrv.c */
|
||||
extern tbus g_exec_mutex; /* in chansrv.c */
|
||||
extern tbus g_exec_sem; /* in chansrv.c */
|
||||
|
||||
extern Display* g_display; /* in xcommon.c */
|
||||
extern Screen* g_screen; /* in xcommon.c */
|
||||
extern Window g_root_window; /* in xcommon.c */
|
||||
extern Atom g_wm_delete_window_atom; /* in xcommon.c */
|
||||
extern Atom g_wm_protocols_atom; /* in xcommon.c */
|
||||
|
||||
int g_rail_up = 0;
|
||||
|
||||
/* for rail_is_another_wm_running */
|
||||
static int g_rail_running = 1;
|
||||
|
||||
/* Indicates a Client Execute PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_EXEC 0x0001
|
||||
/* Indicates a Client Activate PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_ACTIVATE 0x0002
|
||||
/* Indicates a Client System Parameters Update PDU from client
|
||||
to server or a Server System Parameters Update PDU
|
||||
from server to client. */
|
||||
#define TS_RAIL_ORDER_SYSPARAM 0x0003
|
||||
/* Indicates a Client System Command PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_SYSCOMMAND 0x0004
|
||||
/* Indicates a bi-directional Handshake PDU. */
|
||||
#define TS_RAIL_ORDER_HANDSHAKE 0x0005
|
||||
/* Indicates a Client Notify Event PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_NOTIFY_EVENT 0x0006
|
||||
/* Indicates a Client Window Move PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_WINDOWMOVE 0x0008
|
||||
/* Indicates a Server Move/Size Start PDU and a Server Move/Size
|
||||
End PDU from server to client. */
|
||||
#define TS_RAIL_ORDER_LOCALMOVESIZE 0x0009
|
||||
/* Indicates a Server Min Max Info PDU from server to client. */
|
||||
#define TS_RAIL_ORDER_MINMAXINFO 0x000a
|
||||
/* Indicates a Client Information PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_CLIENTSTATUS 0x000b
|
||||
/* Indicates a Client System Menu PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_SYSMENU 0x000c
|
||||
/* Indicates a Server Language Bar Information PDU from server to
|
||||
client, or a Client Language Bar Information PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_LANGBARINFO 0x000d
|
||||
/* Indicates a Server Execute Result PDU from server to client. */
|
||||
#define TS_RAIL_ORDER_EXEC_RESULT 0x0080
|
||||
/* Indicates a Client Get Application ID PDU from client to server. */
|
||||
#define TS_RAIL_ORDER_GET_APPID_REQ 0x000E
|
||||
/* Indicates a Server Get Application ID Response PDU from
|
||||
server to client. */
|
||||
#define TS_RAIL_ORDER_GET_APPID_RESP 0x000F
|
||||
|
||||
/* Resize the window. */
|
||||
#define SC_SIZE 0xF000
|
||||
/* Move the window. */
|
||||
#define SC_MOVE 0xF010
|
||||
/* Minimize the window. */
|
||||
#define SC_MINIMIZE 0xF020
|
||||
/* Maximize the window. */
|
||||
#define SC_MAXIMIZE 0xF030
|
||||
/* Close the window. */
|
||||
#define SC_CLOSE 0xF060
|
||||
/* The ALT + SPACE key combination was pressed; display
|
||||
the window's system menu. */
|
||||
#define SC_KEYMENU 0xF100
|
||||
/* Restore the window to its original shape and size. */
|
||||
#define SC_RESTORE 0xF120
|
||||
/* Perform the default action of the window's system menu. */
|
||||
#define SC_DEFAULT 0xF160
|
||||
|
||||
/******************************************************************************/
|
||||
static int APP_CC
|
||||
is_window_valid_child_of_root(unsigned int window_id)
|
||||
{
|
||||
int found;
|
||||
unsigned int i;
|
||||
unsigned int nchild;
|
||||
Window r;
|
||||
Window p;
|
||||
Window* children;
|
||||
|
||||
found = 0;
|
||||
XQueryTree(g_display, g_root_window, &r, &p, &children, &nchild);
|
||||
for (i = 0; i < nchild; i++)
|
||||
{
|
||||
if (window_id == children[i])
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
XFree(children);
|
||||
return found;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_send_init(void)
|
||||
{
|
||||
struct stream* s;
|
||||
int bytes;
|
||||
char* size_ptr;
|
||||
|
||||
LOG(10, ("chansrv::rail_send_init:"));
|
||||
make_stream(s);
|
||||
init_stream(s, 8182);
|
||||
out_uint16_le(s, TS_RAIL_ORDER_HANDSHAKE);
|
||||
size_ptr = s->p;
|
||||
out_uint16_le(s, 0); /* size, set later */
|
||||
out_uint32_le(s, 1); /* build number */
|
||||
s_mark_end(s);
|
||||
bytes = (int)((s->end - s->data) - 4);
|
||||
size_ptr[0] = bytes;
|
||||
size_ptr[1] = bytes >> 8;
|
||||
bytes = (int)(s->end - s->data);
|
||||
send_channel_data(g_rail_chan_id, s->data, bytes);
|
||||
free_stream(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int DEFAULT_CC
|
||||
anotherWMRunning(Display* display, XErrorEvent* xe)
|
||||
{
|
||||
g_rail_running = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int APP_CC
|
||||
rail_is_another_wm_running(void)
|
||||
{
|
||||
XErrorHandler old;
|
||||
|
||||
g_rail_running = 1;
|
||||
old = XSetErrorHandler((XErrorHandler)anotherWMRunning);
|
||||
XSelectInput(g_display, g_root_window,
|
||||
PropertyChangeMask | StructureNotifyMask |
|
||||
SubstructureRedirectMask | ButtonPressMask |
|
||||
SubstructureNotifyMask | FocusChangeMask |
|
||||
EnterWindowMask | LeaveWindowMask);
|
||||
XSync(g_display, 0);
|
||||
XSetErrorHandler((XErrorHandler)old);
|
||||
g_rail_up = g_rail_running;
|
||||
if (!g_rail_up)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
rail_init(void)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_init:"));
|
||||
xcommon_init();
|
||||
if (rail_is_another_wm_running())
|
||||
{
|
||||
log_message(LOG_LEVEL_ERROR, "rail_init: another window manager "
|
||||
"is running");
|
||||
}
|
||||
rail_send_init();
|
||||
g_rail_up = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
rail_deinit(void)
|
||||
{
|
||||
if (g_rail_up)
|
||||
{
|
||||
/* no longer window manager */
|
||||
XSelectInput(g_display, g_root_window, 0);
|
||||
g_rail_up = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static char* APP_CC
|
||||
read_uni(struct stream* s, int num_chars)
|
||||
{
|
||||
twchar* rchrs;
|
||||
char* rv;
|
||||
int index;
|
||||
int lchars;
|
||||
|
||||
rchrs = 0;
|
||||
rv = 0;
|
||||
if (num_chars > 0)
|
||||
{
|
||||
rchrs = (twchar*)g_malloc((num_chars + 1) * sizeof(twchar), 0);
|
||||
for (index = 0; index < num_chars; index++)
|
||||
{
|
||||
in_uint16_le(s, rchrs[index]);
|
||||
}
|
||||
rchrs[num_chars] = 0;
|
||||
lchars = g_wcstombs(0, rchrs, 0);
|
||||
if (lchars > 0)
|
||||
{
|
||||
rv = (char*)g_malloc((lchars + 1) * 4, 0);
|
||||
g_wcstombs(rv, rchrs, lchars);
|
||||
rv[lchars] = 0;
|
||||
}
|
||||
}
|
||||
g_free(rchrs);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_exec(struct stream* s, int size)
|
||||
{
|
||||
int pid;
|
||||
int flags;
|
||||
int ExeOrFileLength;
|
||||
int WorkingDirLength;
|
||||
int ArgumentsLen;
|
||||
char* ExeOrFile;
|
||||
char* WorkingDir;
|
||||
char* Arguments;
|
||||
|
||||
LOG(0, ("chansrv::rail_process_exec:"));
|
||||
in_uint16_le(s, flags);
|
||||
in_uint16_le(s, ExeOrFileLength);
|
||||
in_uint16_le(s, WorkingDirLength);
|
||||
in_uint16_le(s, ArgumentsLen);
|
||||
ExeOrFile = read_uni(s, ExeOrFileLength);
|
||||
WorkingDir = read_uni(s, WorkingDirLength);
|
||||
Arguments = read_uni(s, ArgumentsLen);
|
||||
LOG(10, (" flags 0x%8.8x ExeOrFileLength %d WorkingDirLength %d "
|
||||
"ArgumentsLen %d ExeOrFile [%s] WorkingDir [%s] "
|
||||
"Arguments [%s]", flags, ExeOrFileLength, WorkingDirLength,
|
||||
ArgumentsLen, ExeOrFile, WorkingDir, Arguments));
|
||||
if (g_strlen(ExeOrFile) > 0)
|
||||
{
|
||||
LOG(10, ("rail_process_exec: pre"));
|
||||
/* ask main thread to fork */
|
||||
tc_mutex_lock(g_exec_mutex);
|
||||
g_exec_name = ExeOrFile;
|
||||
g_set_wait_obj(g_exec_event);
|
||||
tc_sem_dec(g_exec_sem);
|
||||
tc_mutex_unlock(g_exec_mutex);
|
||||
LOG(10, ("rail_process_exec: post"));
|
||||
}
|
||||
g_free(ExeOrFile);
|
||||
g_free(WorkingDir);
|
||||
g_free(Arguments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_activate(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int enabled;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_activate:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint8(s, enabled);
|
||||
LOG(10, (" window_id 0x%8.8x enabled %d", window_id, enabled));
|
||||
if (enabled)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id));
|
||||
XRaiseWindow(g_display, window_id);
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XSetInputFocus 0x%8.8x", window_id));
|
||||
XSetInputFocus(g_display, window_id, RevertToParent, CurrentTime);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_system_param(struct stream* s, int size)
|
||||
{
|
||||
int system_param;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_system_param:"));
|
||||
in_uint32_le(s, system_param);
|
||||
LOG(10, (" system_param 0x%8.8x", system_param));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int APP_CC
|
||||
rail_close_window(int window_id)
|
||||
{
|
||||
XEvent ce;
|
||||
|
||||
LOG(0, ("chansrv::rail_close_window:"));
|
||||
g_memset(&ce, 0, sizeof(ce));
|
||||
ce.xclient.type = ClientMessage;
|
||||
ce.xclient.message_type = g_wm_protocols_atom;
|
||||
ce.xclient.display = g_display;
|
||||
ce.xclient.window = window_id;
|
||||
ce.xclient.format = 32;
|
||||
ce.xclient.data.l[0] = g_wm_delete_window_atom;
|
||||
ce.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(g_display, window_id, False, NoEventMask, &ce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_system_command(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int command;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_system_command:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, command);
|
||||
switch (command)
|
||||
{
|
||||
case SC_SIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_SIZE", window_id));
|
||||
break;
|
||||
case SC_MOVE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MOVE", window_id));
|
||||
break;
|
||||
case SC_MINIMIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MINIMIZE", window_id));
|
||||
break;
|
||||
case SC_MAXIMIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MAXIMIZE", window_id));
|
||||
break;
|
||||
case SC_CLOSE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_CLOSE", window_id));
|
||||
rail_close_window(window_id);
|
||||
break;
|
||||
case SC_KEYMENU:
|
||||
LOG(10, (" window_id 0x%8.8x SC_KEYMENU", window_id));
|
||||
break;
|
||||
case SC_RESTORE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_RESTORE", window_id));
|
||||
break;
|
||||
case SC_DEFAULT:
|
||||
LOG(10, (" window_id 0x%8.8x SC_DEFAULT", window_id));
|
||||
break;
|
||||
default:
|
||||
LOG(10, (" window_id 0x%8.8x unknown command command %d",
|
||||
window_id, command));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_handshake(struct stream* s, int size)
|
||||
{
|
||||
int build_number;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_handshake:"));
|
||||
in_uint32_le(s, build_number);
|
||||
LOG(10, (" build_number 0x%8.8x", build_number));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_notify_event(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int notify_id;
|
||||
int message;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_notify_event:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint32_le(s, notify_id);
|
||||
in_uint32_le(s, message);
|
||||
LOG(10, (" window_id 0x%8.8x notify_id 0x%8.8x message 0x%8.8x",
|
||||
window_id, notify_id, message));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_window_move(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_window_move:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, left);
|
||||
in_uint16_le(s, top);
|
||||
in_uint16_le(s, right);
|
||||
in_uint16_le(s, bottom);
|
||||
LOG(10, (" window_id 0x%8.8x left %d top %d right %d bottom %d width %d height %d",
|
||||
window_id, left, top, right, bottom, right - left, bottom - top));
|
||||
XMoveResizeWindow(g_display, window_id, left, top, right - left, bottom - top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_local_move_size(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int is_move_size_start;
|
||||
int move_size_type;
|
||||
int pos_x;
|
||||
int pos_y;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_local_move_size:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, is_move_size_start);
|
||||
in_uint16_le(s, move_size_type);
|
||||
in_uint16_le(s, pos_x);
|
||||
in_uint16_le(s, pos_y);
|
||||
LOG(10, (" window_id 0x%8.8x is_move_size_start %d move_size_type %d "
|
||||
"pos_x %d pos_y %d", window_id, is_move_size_start, move_size_type,
|
||||
pos_x, pos_y));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* server to client only */
|
||||
static int APP_CC
|
||||
rail_process_min_max_info(struct stream* s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_min_max_info:"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_client_status(struct stream* s, int size)
|
||||
{
|
||||
int flags;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_client_status:"));
|
||||
in_uint32_le(s, flags);
|
||||
LOG(10, (" flags 0x%8.8x", flags));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_sys_menu(struct stream* s, int size)
|
||||
{
|
||||
int window_id;
|
||||
int left;
|
||||
int top;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_sys_menu:"));
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, left);
|
||||
in_uint16_le(s, top);
|
||||
LOG(10, (" window_id 0x%8.8x left %d top %d", window_id, left, top));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_lang_bar_info(struct stream* s, int size)
|
||||
{
|
||||
int language_bar_status;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_lang_bar_info:"));
|
||||
in_uint32_le(s, language_bar_status);
|
||||
LOG(10, (" language_bar_status 0x%8.8x", language_bar_status));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_appid_req(struct stream* s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_appid_req:"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
rail_process_appid_resp(struct stream* s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_appid_resp:"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* server to client only */
|
||||
static int APP_CC
|
||||
rail_process_exec_result(struct stream* s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_exec_result:"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* data in from client ( client -> xrdp -> chansrv ) */
|
||||
int APP_CC
|
||||
rail_data_in(struct stream* s, int chan_id, int chan_flags, int length,
|
||||
int total_length)
|
||||
{
|
||||
int code;
|
||||
int size;
|
||||
|
||||
LOG(10, ("chansrv::rail_data_in:"));
|
||||
in_uint8(s, code);
|
||||
in_uint8s(s, 1);
|
||||
in_uint16_le(s, size);
|
||||
switch (code)
|
||||
{
|
||||
case TS_RAIL_ORDER_EXEC: /* 1 */
|
||||
rail_process_exec(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_ACTIVATE: /* 2 */
|
||||
rail_process_activate(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_SYSPARAM: /* 3 */
|
||||
rail_process_system_param(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_SYSCOMMAND: /* 4 */
|
||||
rail_process_system_command(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_HANDSHAKE: /* 5 */
|
||||
rail_process_handshake(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_NOTIFY_EVENT: /* 6 */
|
||||
rail_process_notify_event(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_WINDOWMOVE: /* 8 */
|
||||
rail_process_window_move(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_LOCALMOVESIZE: /* 9 */
|
||||
rail_process_local_move_size(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_MINMAXINFO: /* 10 */
|
||||
rail_process_min_max_info(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_CLIENTSTATUS: /* 11 */
|
||||
rail_process_client_status(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_SYSMENU: /* 12 */
|
||||
rail_process_sys_menu(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_LANGBARINFO: /* 13 */
|
||||
rail_process_lang_bar_info(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_GET_APPID_REQ: /* 14 */
|
||||
rail_process_appid_req(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_GET_APPID_RESP: /* 15 */
|
||||
rail_process_appid_resp(s, size);
|
||||
break;
|
||||
case TS_RAIL_ORDER_EXEC_RESULT: /* 128 */
|
||||
rail_process_exec_result(s, size);
|
||||
break;
|
||||
default:
|
||||
LOG(10, ("rail_data_in: unknown code %d size %d", code, size));
|
||||
break;
|
||||
}
|
||||
XFlush(g_display);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns 0, event handled, 1 unhandled */
|
||||
int APP_CC
|
||||
rail_xevent(void* xevent)
|
||||
{
|
||||
XEvent* lxevent;
|
||||
XWindowChanges xwc;
|
||||
int rv;
|
||||
int nchildren_return = 0;
|
||||
Window root_return;
|
||||
Window parent_return;
|
||||
Window *children_return;
|
||||
Window wreturn;
|
||||
int revert_to;
|
||||
XWindowAttributes wnd_attributes;
|
||||
|
||||
LOG(10, ("chansrv::rail_xevent:"));
|
||||
if (!g_rail_up)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
rv = 1;
|
||||
lxevent = (XEvent*)xevent;
|
||||
switch (lxevent->type)
|
||||
{
|
||||
case ConfigureRequest:
|
||||
LOG(10, (" got ConfigureRequest window_id 0x%8.8x", lxevent->xconfigurerequest.window));
|
||||
g_memset(&xwc, 0, sizeof(xwc));
|
||||
xwc.x = lxevent->xconfigurerequest.x;
|
||||
xwc.y = lxevent->xconfigurerequest.y;
|
||||
xwc.width = lxevent->xconfigurerequest.width;
|
||||
xwc.height = lxevent->xconfigurerequest.height;
|
||||
xwc.border_width = lxevent->xconfigurerequest.border_width;
|
||||
xwc.sibling = lxevent->xconfigurerequest.above;
|
||||
xwc.stack_mode = lxevent->xconfigurerequest.detail;
|
||||
XConfigureWindow(g_display,
|
||||
lxevent->xconfigurerequest.window,
|
||||
lxevent->xconfigurerequest.value_mask,
|
||||
&xwc);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case MapRequest:
|
||||
LOG(10, (" got MapRequest"));
|
||||
XMapWindow(g_display, lxevent->xmaprequest.window);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
LOG(10, (" got MapNotify"));
|
||||
break;
|
||||
|
||||
case UnmapNotify:
|
||||
LOG(10, (" got UnmapNotify"));
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
LOG(10, (" got ConfigureNotify"));
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
LOG(10, (" got FocusIn"));
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
LOG(10, (" got ButtonPress"));
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
LOG(10, (" got EnterNotify"));
|
||||
break;
|
||||
|
||||
case LeaveNotify:
|
||||
LOG(10, (" got LeaveNotify"));
|
||||
break;
|
||||
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _RAIL_H_
|
||||
#define _RAIL_H_
|
||||
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
|
||||
int APP_CC
|
||||
rail_init(void);
|
||||
int APP_CC
|
||||
rail_deinit(void);
|
||||
int APP_CC
|
||||
rail_data_in(struct stream* s, int chan_id, int chan_flags,
|
||||
int length, int total_length);
|
||||
int APP_CC
|
||||
rail_xevent(void* xevent);
|
||||
|
||||
#endif
|
@ -1,20 +1,70 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2009-2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(SOUND_H)
|
||||
#define SOUND_H
|
||||
#ifndef _SOUND_H_
|
||||
#define _SOUND_H_
|
||||
|
||||
#if defined(XRDP_SIMPLESOUND)
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/error.h>
|
||||
#endif
|
||||
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
#include "os_calls.h"
|
||||
#include "chansrv.h"
|
||||
#include "trans.h"
|
||||
|
||||
#define _DEBUG_RDPSND
|
||||
|
||||
#ifdef DEBUG_RDPSND
|
||||
#include <stdio.h>
|
||||
#define print_got_here() printf("****** got here: %s : %s : %d\n", \
|
||||
__FILE__, __func__, __LINE__);
|
||||
#else
|
||||
#define print_got_here()
|
||||
#endif
|
||||
|
||||
#define AUDIO_BUF_SIZE 2048
|
||||
|
||||
#define SNDC_CLOSE 0x01
|
||||
#define SNDC_WAVE 0x02
|
||||
#define SNDC_SETVOLUME 0x03
|
||||
#define SNDC_SETPITCH 0x04
|
||||
#define SNDC_WAVECONFIRM 0x05
|
||||
#define SNDC_TRAINING 0x06
|
||||
#define SNDC_FORMATS 0x07
|
||||
#define SNDC_CRYPTKEY 0x08
|
||||
#define SNDC_WAVEENCRYPT 0x09
|
||||
#define SNDC_UDPWAVE 0x0A
|
||||
#define SNDC_UDPWAVELAST 0x0B
|
||||
#define SNDC_QUALITYMODE 0x0C
|
||||
|
||||
int APP_CC
|
||||
sound_init(void);
|
||||
int APP_CC
|
||||
sound_deinit(void);
|
||||
int APP_CC
|
||||
sound_data_in(struct stream* s, int chan_id, int chan_flags, int length,
|
||||
int total_length);
|
||||
int APP_CC
|
||||
sound_get_wait_objs(tbus* objs, int* count, int* timeout);
|
||||
int APP_CC
|
||||
sound_check_wait_objs(void);
|
||||
int APP_CC
|
||||
sound_data_in(struct stream* s, int chan_id, int chan_flags,
|
||||
int length, int total_length);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,187 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
#include "os_calls.h"
|
||||
#include "chansrv.h"
|
||||
#include "log.h"
|
||||
#include "clipboard.h"
|
||||
#include "rail.h"
|
||||
|
||||
extern int g_clip_up; /* in clipboard.c */
|
||||
extern int g_waiting_for_data_response; /* in clipboard.c */
|
||||
extern int g_waiting_for_data_response_time; /* in clipboard.c */
|
||||
|
||||
extern int g_rail_up; /* in rail.c */
|
||||
|
||||
Display* g_display = 0;
|
||||
int g_x_socket = 0;
|
||||
tbus g_x_wait_obj = 0;
|
||||
Screen* g_screen = 0;
|
||||
int g_screen_num = 0;
|
||||
Window g_root_window = 0;
|
||||
Atom g_wm_delete_window_atom = 0;
|
||||
Atom g_wm_protocols_atom = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
static int DEFAULT_CC
|
||||
xcommon_error_handler(Display* dis, XErrorEvent* xer)
|
||||
{
|
||||
char text[256];
|
||||
|
||||
XGetErrorText(dis, xer->error_code, text, 255);
|
||||
LOGM((LOG_LEVEL_ERROR, "X error [%s](%d) opcodes %d/%d "
|
||||
"resource 0x%lx", text, xer->error_code,
|
||||
xer->request_code, xer->minor_code, xer->resourceid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* The X server had an internal error. This is the last function called.
|
||||
Do any cleanup that needs to be done on exit, like removing temporary files.
|
||||
Don't worry about memory leaks */
|
||||
static int DEFAULT_CC
|
||||
xcommon_fatal_handler(Display* dis)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns time in miliseconds
|
||||
this is like g_time2 in os_calls, but not miliseconds since machine was
|
||||
up, something else
|
||||
this is a time value similar to what the xserver uses */
|
||||
int APP_CC
|
||||
xcommon_get_local_time(void)
|
||||
{
|
||||
return g_time3();
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* this should be called first */
|
||||
int APP_CC
|
||||
xcommon_init(void)
|
||||
{
|
||||
if (g_display != 0)
|
||||
{
|
||||
LOG(10, ("xcommon_init: xcommon_init already called"));
|
||||
return 0;
|
||||
}
|
||||
g_display = XOpenDisplay(0);
|
||||
if (g_display == 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_init: error, XOpenDisplay failed"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOG(0, ("xcommon_init: connected to display ok"));
|
||||
|
||||
/* setting the error handlers can cause problem when shutting down
|
||||
chansrv on some xlibs */
|
||||
XSetErrorHandler(xcommon_error_handler);
|
||||
//XSetIOErrorHandler(xcommon_fatal_handler);
|
||||
|
||||
g_x_socket = XConnectionNumber(g_display);
|
||||
if (g_x_socket == 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_init: XConnectionNumber failed"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_x_wait_obj = g_create_wait_obj_from_socket(g_x_socket, 0);
|
||||
g_screen_num = DefaultScreen(g_display);
|
||||
g_screen = ScreenOfDisplay(g_display, g_screen_num);
|
||||
|
||||
g_root_window = RootWindowOfScreen(g_screen);
|
||||
|
||||
g_wm_delete_window_atom = XInternAtom(g_display, "WM_DELETE_WINDOW", 0);
|
||||
g_wm_protocols_atom = XInternAtom(g_display, "WM_PROTOCOLS", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error
|
||||
this is called to get any wait objects for the main loop
|
||||
timeout can be nil */
|
||||
int APP_CC
|
||||
xcommon_get_wait_objs(tbus* objs, int* count, int* timeout)
|
||||
{
|
||||
int lcount;
|
||||
|
||||
if (((!g_clip_up) && (!g_rail_up)) || (objs == 0) || (count == 0))
|
||||
{
|
||||
LOG(10, ("xcommon_get_wait_objs: nothing to do"));
|
||||
return 0;
|
||||
}
|
||||
lcount = *count;
|
||||
objs[lcount] = g_x_wait_obj;
|
||||
lcount++;
|
||||
*count = lcount;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
xcommon_check_wait_objs(void)
|
||||
{
|
||||
XEvent xevent;
|
||||
int time_diff;
|
||||
int clip_rv;
|
||||
int rail_rv;
|
||||
|
||||
if ((!g_clip_up) && (!g_rail_up))
|
||||
{
|
||||
LOG(10, ("xcommon_check_wait_objs: nothing to do"));
|
||||
return 0;
|
||||
}
|
||||
if (g_is_wait_obj_set(g_x_wait_obj))
|
||||
{
|
||||
if (XPending(g_display) < 1)
|
||||
{
|
||||
/* something is wrong, should not get here */
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_check_wait_objs: sck closed"));
|
||||
return 0;
|
||||
}
|
||||
if (g_waiting_for_data_response)
|
||||
{
|
||||
time_diff = xcommon_get_local_time() -
|
||||
g_waiting_for_data_response_time;
|
||||
if (time_diff > 10000)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_check_wait_objs: warning, "
|
||||
"waiting for data response too long"));
|
||||
}
|
||||
}
|
||||
while (XPending(g_display) > 0)
|
||||
{
|
||||
g_memset(&xevent, 0, sizeof(xevent));
|
||||
XNextEvent(g_display, &xevent);
|
||||
|
||||
clip_rv = clipboard_xevent(&xevent);
|
||||
rail_rv = rail_xevent(&xevent);
|
||||
if ((clip_rv == 1) && (rail_rv == 1))
|
||||
{
|
||||
LOG(10, ("xcommon_check_wait_objs unknown xevent type %d", xevent.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if !defined(XCOMMON_H)
|
||||
#define XCOMMON_H
|
||||
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
|
||||
int APP_CC
|
||||
xcommon_get_local_time(void);
|
||||
int APP_CC
|
||||
xcommon_init(void);
|
||||
int APP_CC
|
||||
xcommon_get_wait_objs(tbus* objs, int* count, int* timeout);
|
||||
int APP_CC
|
||||
xcommon_check_wait_objs(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,35 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
Display* g_display = 0;
|
||||
int g_x_socket = 0;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
fd_set rfds;
|
||||
int i1;
|
||||
XEvent xevent;
|
||||
|
||||
g_display = XOpenDisplay(0);
|
||||
if (g_display == 0)
|
||||
{
|
||||
printf("XOpenDisplay failed\n");
|
||||
return 0;
|
||||
}
|
||||
g_x_socket = XConnectionNumber(g_display);
|
||||
while (1)
|
||||
{
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(g_x_socket, &rfds);
|
||||
i1 = select(g_x_socket + 1, &rfds, 0, 0, 0);
|
||||
if (i1 < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
XNextEvent(g_display, &xevent);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,549 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_can_do_pix_to_pix; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static RegionPtr
|
||||
rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||
int srcx, int srcy, int w, int h, int dstx, int dsty)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
RegionPtr rv;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static RegionPtr
|
||||
rdpCopyAreaWndToWnd(WindowPtr pSrcWnd, WindowPtr pDstWnd, GCPtr pGC,
|
||||
int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty)
|
||||
{
|
||||
int cd;
|
||||
int lsrcx;
|
||||
int lsrcy;
|
||||
int ldstx;
|
||||
int ldsty;
|
||||
int num_clips;
|
||||
int dx;
|
||||
int dy;
|
||||
int j;
|
||||
BoxRec box;
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
|
||||
LLOGLN(10, ("rdpCopyAreaWndToWnd:"));
|
||||
|
||||
rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable),
|
||||
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
|
||||
lsrcx = pSrcWnd->drawable.x + srcx;
|
||||
lsrcy = pSrcWnd->drawable.y + srcy;
|
||||
ldstx = pDstWnd->drawable.x + dstx;
|
||||
ldsty = pDstWnd->drawable.y + dsty;
|
||||
if (cd == 1)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
dx = dstx - srcx;
|
||||
dy = dsty - srcy;
|
||||
if ((dy < 0) || ((dy == 0) && (dx < 0)))
|
||||
{
|
||||
for (j = 0; j < num_clips; j++)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
}
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static RegionPtr
|
||||
rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd,
|
||||
PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
|
||||
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty)
|
||||
{
|
||||
int cd;
|
||||
int lsrcx;
|
||||
int lsrcy;
|
||||
int ldstx;
|
||||
int ldsty;
|
||||
int num_clips;
|
||||
int dx;
|
||||
int dy;
|
||||
int j;
|
||||
BoxRec box;
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
|
||||
LLOGLN(10, ("rdpCopyAreaWndToPixmap:"));
|
||||
|
||||
rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstPixmap->drawable),
|
||||
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
|
||||
lsrcx = pSrcWnd->drawable.x + srcx;
|
||||
lsrcy = pSrcWnd->drawable.y + srcy;
|
||||
ldstx = pDstPixmap->drawable.x + dstx;
|
||||
ldsty = pDstPixmap->drawable.y + dsty;
|
||||
if (cd == 1)
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
rdpup_begin_update();
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
rdpup_end_update();
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
rdpup_begin_update();
|
||||
dx = dstx - srcx;
|
||||
dy = dsty - srcy;
|
||||
if ((dy < 0) || ((dy == 0) && (dx < 0)))
|
||||
{
|
||||
for (j = 0; j < num_clips; j++)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy);
|
||||
}
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* draw from an off screen pixmap to a visible window */
|
||||
static RegionPtr
|
||||
rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
|
||||
WindowPtr pDstWnd, GCPtr pGC,
|
||||
int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty)
|
||||
{
|
||||
int lsrcx;
|
||||
int lsrcy;
|
||||
int ldstx;
|
||||
int ldsty;
|
||||
int cd;
|
||||
int j;
|
||||
int num_clips;
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
BoxRec box;
|
||||
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToWnd:"));
|
||||
|
||||
rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstWnd->drawable),
|
||||
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC);
|
||||
ldstx = pDstWnd->drawable.x + dstx;
|
||||
ldsty = pDstWnd->drawable.y + dsty;
|
||||
lsrcx = pSrcPixmap->drawable.x + srcx;
|
||||
lsrcy = pSrcPixmap->drawable.y + srcy;
|
||||
if (cd == 1)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: num_clips %d", num_clips));
|
||||
for (j = 0; j < num_clips; j++)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d", w, h));
|
||||
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* draw from an off screen pixmap to an off screen pixmap */
|
||||
static RegionPtr
|
||||
rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
|
||||
PixmapPtr pDstPixmap, rdpPixmapRec* pDstPriv,
|
||||
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty)
|
||||
{
|
||||
int lsrcx;
|
||||
int lsrcy;
|
||||
int ldstx;
|
||||
int ldsty;
|
||||
int cd;
|
||||
int j;
|
||||
int num_clips;
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
BoxRec box;
|
||||
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap:"));
|
||||
|
||||
rv = rdpCopyAreaOrg(&(pSrcPixmap->drawable), &(pDstPixmap->drawable),
|
||||
pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: cd %d", cd));
|
||||
ldstx = pDstPixmap->drawable.x + dstx;
|
||||
ldsty = pDstPixmap->drawable.y + dsty;
|
||||
lsrcx = pSrcPixmap->drawable.x + srcx;
|
||||
lsrcy = pSrcPixmap->drawable.y + srcy;
|
||||
if (cd == 1)
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
rdpup_begin_update();
|
||||
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
|
||||
LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
|
||||
rdpup_end_update();
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
rdpup_begin_update();
|
||||
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: num_clips %d", num_clips));
|
||||
for (j = 0; j < num_clips; j++)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
|
||||
LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
RegionPtr
|
||||
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||
int srcx, int srcy, int w, int h, int dstx, int dsty)
|
||||
{
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
RegionRec box_reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int can_do_screen_blt;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
struct image_data id;
|
||||
BoxRec box;
|
||||
BoxPtr pbox;
|
||||
PixmapPtr pSrcPixmap;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pSrcPriv;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
WindowPtr pDstWnd;
|
||||
WindowPtr pSrcWnd;
|
||||
|
||||
LLOGLN(10, ("rdpCopyArea:"));
|
||||
|
||||
if (pSrc->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pSrcWnd = (WindowPtr)pSrc;
|
||||
if (pSrcWnd->viewable)
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
can_do_screen_blt = pGC->alu == GXcopy;
|
||||
if (can_do_screen_blt)
|
||||
{
|
||||
return rdpCopyAreaWndToWnd(pSrcWnd, pDstWnd, pGC,
|
||||
srcx, srcy, w, h, dstx, dsty);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
can_do_screen_blt = pGC->alu == GXcopy;
|
||||
if (can_do_screen_blt)
|
||||
{
|
||||
rdpup_check_dirty(pDstPixmap, pDstPriv);
|
||||
return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
|
||||
srcx, srcy, w, h, dstx, dsty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pSrc->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pSrcPixmap = (PixmapPtr)pSrc;
|
||||
pSrcPriv = GETPIXPRIV(pSrcPixmap);
|
||||
if (XRDP_IS_OS(pSrcPriv))
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
|
||||
return rdpCopyAreaPixmapToWnd(pSrcPixmap, pSrcPriv, pDstWnd, pGC,
|
||||
srcx, srcy, w, h, dstx, dsty);
|
||||
}
|
||||
}
|
||||
else if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
if (g_can_do_pix_to_pix)
|
||||
{
|
||||
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
|
||||
rdpup_check_dirty(pDstPixmap, pDstPriv);
|
||||
return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
|
||||
pDstPixmap, pDstPriv,
|
||||
pGC, srcx, srcy, w, h,
|
||||
dstx, dsty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpCopyArea: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(&box_reg, &box, 0);
|
||||
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
|
||||
RegionUninit(&box_reg);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(&box_reg, &box, 0);
|
||||
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips < 10)
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pbox = RegionExtents(&clip_reg);
|
||||
rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
}
|
||||
RegionUninit(&box_reg);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPCOPYAREA_H
|
||||
#define __RDPCOPYAREA_H
|
||||
|
||||
RegionPtr
|
||||
rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
|
||||
int srcx, int srcy, int w, int h, int dstx, int dsty);
|
||||
|
||||
#endif
|
@ -0,0 +1,216 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
RegionPtr
|
||||
rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst,
|
||||
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty, unsigned long bitPlane)
|
||||
{
|
||||
RegionPtr rv;
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy,
|
||||
w, h, dstx, dsty, bitPlane);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
RegionPtr
|
||||
rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
|
||||
GCPtr pGC, int srcx, int srcy, int w, int h,
|
||||
int dstx, int dsty, unsigned long bitPlane)
|
||||
{
|
||||
RegionPtr rv;
|
||||
RegionRec clip_reg;
|
||||
RegionRec box_reg;
|
||||
RegionRec reg1;
|
||||
RegionRec reg2;
|
||||
int cd;
|
||||
int num_clips;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
BoxPtr pbox;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpCopyPlane:"));
|
||||
|
||||
/* do original call */
|
||||
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
|
||||
dstx, dsty, bitPlane);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionInit(®2, NullBox, 0);
|
||||
RegionCopy(®2, &clip_reg);
|
||||
RegionIntersect(®1, ®1, ®2);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
RegionUninit(®2);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
box.x1 = pDst->x + dstx;
|
||||
box.y1 = pDst->y + dsty;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(&box_reg, &box, 0);
|
||||
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips < 10)
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pbox = RegionExtents(&clip_reg);
|
||||
rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1,
|
||||
pbox->y2 - pbox->y1);
|
||||
}
|
||||
RegionUninit(&box_reg);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPCOPYPLANE_H
|
||||
#define __RDPCOPYPLANE_H
|
||||
|
||||
RegionPtr
|
||||
rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
|
||||
GCPtr pGC, int srcx, int srcy, int width, int height,
|
||||
int dstx, int dsty, unsigned long bitPlane);
|
||||
|
||||
#endif
|
@ -0,0 +1,220 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int shape, int mode, int count,
|
||||
DDXPointPtr pPts)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int shape, int mode, int count,
|
||||
DDXPointPtr pPts)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionRec box_reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int maxx;
|
||||
int maxy;
|
||||
int minx;
|
||||
int miny;
|
||||
int i;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpFillPolygon:"));
|
||||
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = 0;
|
||||
box.y2 = 0;
|
||||
if (count > 0)
|
||||
{
|
||||
maxx = pPts[0].x;
|
||||
maxy = pPts[0].y;
|
||||
minx = maxx;
|
||||
miny = maxy;
|
||||
for (i = 1; i < count; i++)
|
||||
{
|
||||
if (pPts[i].x > maxx)
|
||||
{
|
||||
maxx = pPts[i].x;
|
||||
}
|
||||
if (pPts[i].x < minx)
|
||||
{
|
||||
minx = pPts[i].x;
|
||||
}
|
||||
if (pPts[i].y > maxy)
|
||||
{
|
||||
maxy = pPts[i].y;
|
||||
}
|
||||
if (pPts[i].y < miny)
|
||||
{
|
||||
miny = pPts[i].y;
|
||||
}
|
||||
}
|
||||
box.x1 = pDrawable->x + minx;
|
||||
box.y1 = pDrawable->y + miny;
|
||||
box.x2 = pDrawable->x + maxx + 1;
|
||||
box.y2 = pDrawable->y + maxy + 1;
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(&box_reg, &box, 0);
|
||||
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(&box_reg);
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPFILLPOLYGON_H
|
||||
#define __RDPFILLPOLYGON_H
|
||||
|
||||
void
|
||||
rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int shape, int mode, int count,
|
||||
DDXPointPtr pPts);
|
||||
|
||||
#endif
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static void
|
||||
rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit,
|
||||
DDXPointPtr pptInit, int* pwidthInit, int fSorted)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
|
||||
DDXPointPtr pptInit, int* pwidthInit, int fSorted)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
int cd;
|
||||
int got_id;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
|
||||
LLOGLN(10, ("rdpFillSpans: todo"));
|
||||
|
||||
/* do original call */
|
||||
rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
|
||||
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!got_id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPFILLSPANS_H
|
||||
#define __RDPFILLSPANS_H
|
||||
|
||||
void
|
||||
rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
|
||||
DDXPointPtr pptInit, int* pwidthInit, int fSorted);
|
||||
|
||||
#endif
|
@ -0,0 +1,192 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpImageGlyphBlt:"));
|
||||
|
||||
if (nglyph != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpImageGlyphBlt: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (nglyph == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPIMAGEGLYPHBLT_H
|
||||
#define __RDPIMAGEGLYPHBLT_H
|
||||
|
||||
void
|
||||
rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase);
|
||||
|
||||
#endif
|
@ -0,0 +1,191 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpImageText16:"));
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpImageText16: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (count == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPIMAGETEXT16_H
|
||||
#define __RDPIMAGETEXT16_H
|
||||
|
||||
void
|
||||
rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars);
|
||||
|
||||
#endif
|
@ -0,0 +1,191 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpImageText8:"));
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpImageText8: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (count == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPIMAGETEXT8_H
|
||||
#define __RDPIMAGETEXT8_H
|
||||
|
||||
void
|
||||
rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars);
|
||||
|
||||
#endif
|
@ -0,0 +1,215 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionPtr tmpRegion;
|
||||
int cd;
|
||||
int lw;
|
||||
int extra;
|
||||
int i;
|
||||
int num_clips;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
xRectangle* rects;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyArc:"));
|
||||
|
||||
rects = 0;
|
||||
if (narcs > 0)
|
||||
{
|
||||
rects = (xRectangle*)g_malloc(narcs * sizeof(xRectangle), 0);
|
||||
lw = pGC->lineWidth;
|
||||
if (lw == 0)
|
||||
{
|
||||
lw = 1;
|
||||
}
|
||||
extra = lw / 2;
|
||||
for (i = 0; i < narcs; i++)
|
||||
{
|
||||
rects[i].x = (parcs[i].x - extra) + pDrawable->x;
|
||||
rects[i].y = (parcs[i].y - extra) + pDrawable->y;
|
||||
rects[i].width = parcs[i].width + lw;
|
||||
rects[i].height = parcs[i].height + lw;
|
||||
}
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyArc: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
g_free(rects);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (rects != 0)
|
||||
{
|
||||
tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
|
||||
num_clips = REGION_NUM_RECTS(tmpRegion);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (i = num_clips - 1; i >= 0; i--)
|
||||
{
|
||||
box = REGION_RECTS(tmpRegion)[i];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionDestroy(tmpRegion);
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
if (rects != 0)
|
||||
{
|
||||
tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
|
||||
RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
|
||||
num_clips = REGION_NUM_RECTS(tmpRegion);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (i = num_clips - 1; i >= 0; i--)
|
||||
{
|
||||
box = REGION_RECTS(tmpRegion)[i];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionDestroy(tmpRegion);
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
g_free(rects);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYARC_H
|
||||
#define __RDPPOLYARC_H
|
||||
|
||||
void
|
||||
rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
|
||||
|
||||
#endif
|
@ -0,0 +1,215 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionPtr tmpRegion;
|
||||
int cd;
|
||||
int lw;
|
||||
int extra;
|
||||
int i;
|
||||
int num_clips;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
xRectangle* rects;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyFillArc:"));
|
||||
|
||||
rects = 0;
|
||||
if (narcs > 0)
|
||||
{
|
||||
rects = (xRectangle*)g_malloc(narcs * sizeof(xRectangle), 0);
|
||||
lw = pGC->lineWidth;
|
||||
if (lw == 0)
|
||||
{
|
||||
lw = 1;
|
||||
}
|
||||
extra = lw / 2;
|
||||
for (i = 0; i < narcs; i++)
|
||||
{
|
||||
rects[i].x = (parcs[i].x - extra) + pDrawable->x;
|
||||
rects[i].y = (parcs[i].y - extra) + pDrawable->y;
|
||||
rects[i].width = parcs[i].width + lw;
|
||||
rects[i].height = parcs[i].height + lw;
|
||||
}
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyFillArc: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
g_free(rects);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (rects != 0)
|
||||
{
|
||||
tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
|
||||
num_clips = REGION_NUM_RECTS(tmpRegion);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (i = num_clips - 1; i >= 0; i--)
|
||||
{
|
||||
box = REGION_RECTS(tmpRegion)[i];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionDestroy(tmpRegion);
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
if (rects != 0)
|
||||
{
|
||||
tmpRegion = RegionFromRects(narcs, rects, CT_NONE);
|
||||
RegionIntersect(tmpRegion, tmpRegion, &clip_reg);
|
||||
num_clips = REGION_NUM_RECTS(tmpRegion);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (i = num_clips - 1; i >= 0; i--)
|
||||
{
|
||||
box = REGION_RECTS(tmpRegion)[i];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionDestroy(tmpRegion);
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
g_free(rects);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYFILLARC_H
|
||||
#define __RDPPOLYFILLARC_H
|
||||
|
||||
void
|
||||
rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs);
|
||||
|
||||
#endif
|
@ -0,0 +1,255 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static void
|
||||
rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||
xRectangle* prectInit)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||
xRectangle* prectInit)
|
||||
{
|
||||
int j;
|
||||
int cd;
|
||||
int num_clips;
|
||||
RegionRec clip_reg;
|
||||
RegionPtr fill_reg;
|
||||
BoxRec box;
|
||||
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyFillRect:"));
|
||||
|
||||
/* make a copy of rects */
|
||||
fill_reg = RegionFromRects(nrectFill, prectInit, CT_NONE);
|
||||
|
||||
/* do original call */
|
||||
rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_FILL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
RegionDestroy(fill_reg);
|
||||
return;
|
||||
}
|
||||
RegionTranslate(fill_reg, pDrawable->x, pDrawable->y);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1) /* no clip */
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
if (pGC->fillStyle == 0 && /* solid fill */
|
||||
(pGC->alu == GXclear ||
|
||||
pGC->alu == GXset ||
|
||||
pGC->alu == GXinvert ||
|
||||
pGC->alu == GXnoop ||
|
||||
pGC->alu == GXand ||
|
||||
pGC->alu == GXcopy /*||
|
||||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||
{
|
||||
draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL);
|
||||
}
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
if (pGC->fillStyle == 0 && /* solid fill */
|
||||
(pGC->alu == GXclear ||
|
||||
pGC->alu == GXset ||
|
||||
pGC->alu == GXinvert ||
|
||||
pGC->alu == GXnoop ||
|
||||
pGC->alu == GXand ||
|
||||
pGC->alu == GXcopy /*||
|
||||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||
{
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(fill_reg)[j];
|
||||
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
}
|
||||
else /* non solid fill */
|
||||
{
|
||||
for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(fill_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2) /* clip */
|
||||
{
|
||||
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
if (pGC->fillStyle == 0 && /* solid fill */
|
||||
(pGC->alu == GXclear ||
|
||||
pGC->alu == GXset ||
|
||||
pGC->alu == GXinvert ||
|
||||
pGC->alu == GXnoop ||
|
||||
pGC->alu == GXand ||
|
||||
pGC->alu == GXcopy /*||
|
||||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||
{
|
||||
draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL);
|
||||
}
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
if (pGC->fillStyle == 0 && /* solid fill */
|
||||
(pGC->alu == GXclear ||
|
||||
pGC->alu == GXset ||
|
||||
pGC->alu == GXinvert ||
|
||||
pGC->alu == GXnoop ||
|
||||
pGC->alu == GXand ||
|
||||
pGC->alu == GXcopy /*||
|
||||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
|
||||
{
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
}
|
||||
else /* non solid fill */
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
RegionDestroy(fill_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYFILLRECT_H
|
||||
#define __RDPPOLYFILLRECT_H
|
||||
|
||||
void
|
||||
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
|
||||
xRectangle* prectInit);
|
||||
|
||||
#endif
|
@ -0,0 +1,193 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyGlyphBlt:"));
|
||||
|
||||
if (nglyph != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyGlyphBlt: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (nglyph == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
|
||||
box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYGLYPHBLT_H
|
||||
#define __RDPPOLYGLYPHBLT_H
|
||||
|
||||
void
|
||||
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, unsigned int nglyph,
|
||||
CharInfoPtr* ppci, pointer pglyphBase);
|
||||
|
||||
#endif
|
@ -0,0 +1,269 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr in_pts)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr in_pts)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionRec reg1;
|
||||
RegionRec reg2;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int x;
|
||||
int y;
|
||||
int i;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
BoxRec total_box;
|
||||
DDXPointPtr pts;
|
||||
DDXPointRec stack_pts[32];
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyPoint:"));
|
||||
LLOGLN(10, ("rdpPolyPoint: npt %d", npt));
|
||||
|
||||
if (npt > 32)
|
||||
{
|
||||
pts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pts = stack_pts;
|
||||
}
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
pts[i].x = pDrawable->x + in_pts[i].x;
|
||||
pts[i].y = pDrawable->y + in_pts[i].y;
|
||||
if (i == 0)
|
||||
{
|
||||
total_box.x1 = pts[0].x;
|
||||
total_box.y1 = pts[0].y;
|
||||
total_box.x2 = pts[0].x;
|
||||
total_box.y2 = pts[0].y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pts[i].x < total_box.x1)
|
||||
{
|
||||
total_box.x1 = pts[i].x;
|
||||
}
|
||||
if (pts[i].y < total_box.y1)
|
||||
{
|
||||
total_box.y1 = pts[i].y;
|
||||
}
|
||||
if (pts[i].x > total_box.x2)
|
||||
{
|
||||
total_box.x2 = pts[i].x;
|
||||
}
|
||||
if (pts[i].y > total_box.y2)
|
||||
{
|
||||
total_box.y2 = pts[i].y;
|
||||
}
|
||||
}
|
||||
/* todo, use this total_box */
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (npt > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, NullBox, 0);
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
box.x1 = pts[i].x;
|
||||
box.y1 = pts[i].y;
|
||||
box.x2 = box.x1 + 1;
|
||||
box.y2 = box.y1 + 1;
|
||||
RegionInit(®2, &box, 0);
|
||||
RegionUnion(®1, ®1, ®2);
|
||||
RegionUninit(®2);
|
||||
}
|
||||
draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
x = pts[i].x;
|
||||
y = pts[i].y;
|
||||
rdpup_fill_rect(x, y, 1, 1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (npt > 0 && num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, NullBox, 0);
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
box.x1 = pts[i].x;
|
||||
box.y1 = pts[i].y;
|
||||
box.x2 = box.x1 + 1;
|
||||
box.y2 = box.y1 + 1;
|
||||
RegionInit(®2, &box, 0);
|
||||
RegionUnion(®1, ®1, ®2);
|
||||
RegionUninit(®2);
|
||||
}
|
||||
RegionIntersect(®1, ®1, &clip_reg);
|
||||
draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
x = pts[i].x;
|
||||
y = pts[i].y;
|
||||
rdpup_fill_rect(x, y, 1, 1);
|
||||
}
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (pts != stack_pts)
|
||||
{
|
||||
g_free(pts);
|
||||
}
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYPOINT_H
|
||||
#define __RDPPOLYPOINT_H
|
||||
|
||||
void
|
||||
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr in_pts);
|
||||
|
||||
#endif
|
@ -0,0 +1,285 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static void
|
||||
rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||
xRectangle* rects)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */
|
||||
void
|
||||
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||
xRectangle* rects)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionPtr fill_reg;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int lw;
|
||||
int i;
|
||||
int j;
|
||||
int up;
|
||||
int down;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
xRectangle* regRects;
|
||||
xRectangle* r;
|
||||
xRectangle* rect1;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyRectangle:"));
|
||||
|
||||
/* make a copy of rects */
|
||||
rect1 = (xRectangle*)g_malloc(sizeof(xRectangle) * nrects, 0);
|
||||
for (i = 0; i < nrects; i++)
|
||||
{
|
||||
rect1[i] = rects[i];
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyRectangle: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
g_free(rect1);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
regRects = 0;
|
||||
if ((cd != 0) && (nrects > 0))
|
||||
{
|
||||
regRects = (xRectangle*)g_malloc(nrects * 4 * sizeof(xRectangle), 0);
|
||||
lw = pGC->lineWidth;
|
||||
if (lw < 1)
|
||||
{
|
||||
lw = 1;
|
||||
}
|
||||
up = lw / 2;
|
||||
down = 1 + (lw - 1) / 2;
|
||||
for (i = 0; i < nrects; i++)
|
||||
{
|
||||
r = regRects + i * 4;
|
||||
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||
r->y = (rect1[i].y + pDrawable->y) - up;
|
||||
r->width = rect1[i].width + up + down;
|
||||
r->height = lw;
|
||||
r++;
|
||||
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||
r->y = (rect1[i].y + pDrawable->y) + down;
|
||||
r->width = lw;
|
||||
r->height = MAX(rect1[i].height - (up + down), 0);
|
||||
r++;
|
||||
r->x = ((rect1[i].x + rect1[i].width) + pDrawable->x) - up;
|
||||
r->y = (rect1[i].y + pDrawable->y) + down;
|
||||
r->width = lw;
|
||||
r->height = MAX(rect1[i].height - (up + down), 0);
|
||||
r++;
|
||||
r->x = (rect1[i].x + pDrawable->x) - up;
|
||||
r->y = ((rect1[i].y + rect1[i].height) + pDrawable->y) - up;
|
||||
r->width = rect1[i].width + up + down;
|
||||
r->height = lw;
|
||||
}
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (regRects != 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
|
||||
if (pGC->lineStyle == LineSolid)
|
||||
{
|
||||
draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type);
|
||||
}
|
||||
RegionDestroy(fill_reg);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
if (pGC->lineStyle == LineSolid)
|
||||
{
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
for (i = 0; i < nrects * 4; i++)
|
||||
{
|
||||
r = regRects + i;
|
||||
rdpup_fill_rect(r->x, r->y, r->width, r->height);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nrects * 4; i++)
|
||||
{
|
||||
r = regRects + i;
|
||||
rdpup_send_area(&id, r->x, r->y, r->width, r->height);
|
||||
}
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
if (regRects != 0)
|
||||
{
|
||||
fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
|
||||
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
if (pGC->lineStyle == LineSolid)
|
||||
{
|
||||
draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu);
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
|
||||
}
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
if (pGC->lineStyle == LineSolid)
|
||||
{
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionDestroy(fill_reg);
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
g_free(regRects);
|
||||
g_free(rect1);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYRECTANGLE_H
|
||||
#define __RDPPOLYRECTANGLE_H
|
||||
|
||||
void
|
||||
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
|
||||
xRectangle* rects);
|
||||
|
||||
#endif
|
@ -0,0 +1,212 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
int cd;
|
||||
int i;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
xSegment* segs;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolySegment:"));
|
||||
LLOGLN(10, (" nseg %d", nseg));
|
||||
|
||||
segs = 0;
|
||||
if (nseg) /* get the rects */
|
||||
{
|
||||
segs = (xSegment*)g_malloc(nseg * sizeof(xSegment), 0);
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
segs[i].x1 = pSegs[i].x1 + pDrawable->x;
|
||||
segs[i].y1 = pSegs[i].y1 + pDrawable->y;
|
||||
segs[i].x2 = pSegs[i].x2 + pDrawable->x;
|
||||
segs[i].y2 = pSegs[i].y2 + pDrawable->y;
|
||||
}
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolySegment: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
g_free(segs);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
LLOGLN(10, ("rdpPolySegment: cd %d", cd));
|
||||
if (cd == 1) /* no clip */
|
||||
{
|
||||
if (segs != 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionUninit(&clip_reg);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
RegionAroundSegs(&clip_reg, segs, nseg);
|
||||
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu, pGC->lineWidth, segs, nseg, 1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
rdpup_set_pen(0, pGC->lineWidth);
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cd == 2) /* clip */
|
||||
{
|
||||
if (segs != 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu, pGC->lineWidth, segs, nseg, 1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
rdpup_set_pen(0, pGC->lineWidth);
|
||||
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||
LLOGLN(10, (" %d %d %d %d", segs[i].x1, segs[i].y1,
|
||||
segs[i].x2, segs[i].y2));
|
||||
}
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_set_opcode(GXcopy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free(segs);
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYSEGMENT_H
|
||||
#define __RDPPOLYSEGMENT_H
|
||||
|
||||
void
|
||||
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs);
|
||||
|
||||
#endif
|
@ -0,0 +1,193 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars)
|
||||
{
|
||||
int rv;
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int rv;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyText16:"));
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyText16: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (count == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYTEXT16_H
|
||||
#define __RDPPOLYTEXT16_H
|
||||
|
||||
int
|
||||
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, unsigned short* chars);
|
||||
|
||||
#endif
|
@ -0,0 +1,193 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars)
|
||||
{
|
||||
int rv;
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars)
|
||||
{
|
||||
RegionRec reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int rv;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolyText8:"));
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
|
||||
}
|
||||
|
||||
/* do original call */
|
||||
rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolyText8: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
RegionInit(®, NullBox, 0);
|
||||
if (count == 0)
|
||||
{
|
||||
cd = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd = rdp_get_clip(®, pDrawable, pGC);
|
||||
}
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionIntersect(®, ®, ®1);
|
||||
num_clips = REGION_NUM_RECTS(®);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(®)[j];
|
||||
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(®1);
|
||||
}
|
||||
RegionUninit(®);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
return rv;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYTEXT8_H
|
||||
#define __RDPPOLYTEXT8_H
|
||||
|
||||
int
|
||||
rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y, int count, char* chars);
|
||||
|
||||
#endif
|
@ -0,0 +1,254 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static void
|
||||
rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr pptInit)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr pptInit)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int i;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
xSegment* segs;
|
||||
int nseg;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPolylines:"));
|
||||
LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode,
|
||||
pDrawable->x, pDrawable->y));
|
||||
#if 0
|
||||
LLOGLN(0, (" points"));
|
||||
for (i = 0; i < npt; i++)
|
||||
{
|
||||
LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y));
|
||||
}
|
||||
#endif
|
||||
/* convert lines to line segments */
|
||||
nseg = npt - 1;
|
||||
segs = 0;
|
||||
if (npt > 1)
|
||||
{
|
||||
segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 0);
|
||||
segs[0].x1 = pptInit[0].x + pDrawable->x;
|
||||
segs[0].y1 = pptInit[0].y + pDrawable->y;
|
||||
if (mode == CoordModeOrigin)
|
||||
{
|
||||
segs[0].x2 = pptInit[1].x + pDrawable->x;
|
||||
segs[0].y2 = pptInit[1].y + pDrawable->y;
|
||||
for (i = 2; i < npt; i++)
|
||||
{
|
||||
segs[i - 1].x1 = segs[i - 2].x2;
|
||||
segs[i - 1].y1 = segs[i - 2].y2;
|
||||
segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
|
||||
segs[i - 1].y2 = pptInit[i].y + pDrawable->y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
segs[0].x2 = segs[0].x1 + pptInit[1].x;
|
||||
segs[0].y2 = segs[0].y1 + pptInit[1].y;
|
||||
for (i = 2; i < npt; i++)
|
||||
{
|
||||
segs[i - 1].x1 = segs[i - 2].x2;
|
||||
segs[i - 1].y1 = segs[i - 2].y2;
|
||||
segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x;
|
||||
segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt));
|
||||
}
|
||||
#if 0
|
||||
LLOGLN(0, (" segments"));
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1,
|
||||
segs[i].x2, segs[i].y2));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* do original call */
|
||||
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPolylines: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLL;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
g_free(segs);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (segs != 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionUninit(&clip_reg);
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
RegionAroundSegs(&clip_reg, segs, nseg);
|
||||
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu, pGC->lineWidth, segs, nseg, 0);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
rdpup_set_pen(0, pGC->lineWidth);
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||
}
|
||||
rdpup_set_opcode(GXcopy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (nseg != 0 && num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
|
||||
pGC->alu, pGC->lineWidth, segs, nseg, 0);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_set_fgcolor(pGC->fgPixel);
|
||||
rdpup_set_opcode(pGC->alu);
|
||||
rdpup_set_pen(0, pGC->lineWidth);
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
for (i = 0; i < nseg; i++)
|
||||
{
|
||||
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
|
||||
}
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_set_opcode(GXcopy);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free(segs);
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPOLYLINES_H
|
||||
#define __RDPPOLYLINES_H
|
||||
|
||||
void
|
||||
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
|
||||
int npt, DDXPointPtr pptInit);
|
||||
|
||||
#endif
|
@ -0,0 +1,189 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
|
||||
int w, int h, int x, int y)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
|
||||
int w, int h, int x, int y)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
RegionRec box_reg;
|
||||
RegionRec reg1;
|
||||
int num_clips;
|
||||
int cd;
|
||||
int j;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpPushPixels:"));
|
||||
|
||||
/* do original call */
|
||||
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPutImage: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&box, 0, sizeof(box));
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + x;
|
||||
box.y1 = pDst->y + y;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(0, pDst->x + x, pDst->y + y, w, h);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
box.x1 = pDst->x + x;
|
||||
box.y1 = pDst->y + y;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(&box_reg, &box, 0);
|
||||
RegionIntersect(&clip_reg, &clip_reg, &box_reg);
|
||||
num_clips = REGION_NUM_RECTS(&clip_reg);
|
||||
if (num_clips > 0)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = num_clips - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
|
||||
}
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(&box_reg);
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPUSHPIXELS_H
|
||||
#define __RDPPUSHPIXELS_H
|
||||
|
||||
void
|
||||
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
|
||||
int w, int h, int x, int y);
|
||||
|
||||
#endif
|
@ -0,0 +1,188 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
static void
|
||||
rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||
int w, int h, int leftPad, int format, char* pBits)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad,
|
||||
format, pBits);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||
int w, int h, int leftPad, int format, char* pBits)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
int cd;
|
||||
int j;
|
||||
int reset_surface;
|
||||
int post_process;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
BoxRec box;
|
||||
struct image_data id;
|
||||
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
RegionRec reg1;
|
||||
RegionRec reg2;
|
||||
|
||||
LLOGLN(10, ("rdpPutImage:"));
|
||||
LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id)));
|
||||
|
||||
/* do original call */
|
||||
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDst->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDst;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpPutImage: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDst->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDst;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDst, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + x;
|
||||
box.y1 = pDst->y + y;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
box.x1 = pDst->x + x;
|
||||
box.y1 = pDst->y + y;
|
||||
box.x2 = box.x1 + w;
|
||||
box.y2 = box.y1 + h;
|
||||
RegionInit(®1, &box, 0);
|
||||
RegionInit(®2, NullBox, 0);
|
||||
RegionCopy(®2, &clip_reg);
|
||||
RegionIntersect(®1, ®1, ®2);
|
||||
draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type);
|
||||
RegionUninit(®1);
|
||||
RegionUninit(®2);
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
rdpup_begin_update();
|
||||
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
|
||||
{
|
||||
box = REGION_RECTS(&clip_reg)[j];
|
||||
rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1));
|
||||
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h);
|
||||
}
|
||||
rdpup_reset_clip();
|
||||
rdpup_end_update();
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPPUTIMAGE_H
|
||||
#define __RDPPUTIMAGE_H
|
||||
|
||||
void
|
||||
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
|
||||
int w, int h, int leftPad, int format, char* pBits);
|
||||
|
||||
#endif
|
@ -0,0 +1,151 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#include "rdp.h"
|
||||
#include "rdpdraw.h"
|
||||
|
||||
#define LDEBUG 0
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
|
||||
|
||||
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
|
||||
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
|
||||
extern int g_Bpp; /* from rdpmain.c */
|
||||
extern ScreenPtr g_pScreen; /* from rdpmain.c */
|
||||
extern Bool g_wrapPixmap; /* from rdpmain.c */
|
||||
extern int g_do_dirty_os; /* in rdpmain.c */
|
||||
|
||||
extern GCOps g_rdpGCOps; /* from rdpdraw.c */
|
||||
|
||||
extern int g_con_number; /* in rdpup.c */
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
|
||||
DDXPointPtr ppt, int* pwidth, int nspans, int fSorted)
|
||||
{
|
||||
rdpGCPtr priv;
|
||||
GCFuncs* oldFuncs;
|
||||
|
||||
GC_OP_PROLOGUE(pGC);
|
||||
pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
|
||||
GC_OP_EPILOGUE(pGC);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
|
||||
DDXPointPtr ppt, int* pwidth, int nspans, int fSorted)
|
||||
{
|
||||
RegionRec clip_reg;
|
||||
int cd;
|
||||
int got_id;
|
||||
int dirty_type;
|
||||
int post_process;
|
||||
int reset_surface;
|
||||
struct image_data id;
|
||||
WindowPtr pDstWnd;
|
||||
PixmapPtr pDstPixmap;
|
||||
rdpPixmapRec* pDstPriv;
|
||||
rdpPixmapRec* pDirtyPriv;
|
||||
|
||||
LLOGLN(10, ("rdpSetSpans: todo"));
|
||||
|
||||
/* do original call */
|
||||
rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
|
||||
|
||||
dirty_type = 0;
|
||||
pDirtyPriv = 0;
|
||||
post_process = 0;
|
||||
reset_surface = 0;
|
||||
got_id = 0;
|
||||
if (pDrawable->type == DRAWABLE_PIXMAP)
|
||||
{
|
||||
pDstPixmap = (PixmapPtr)pDrawable;
|
||||
pDstPriv = GETPIXPRIV(pDstPixmap);
|
||||
if (XRDP_IS_OS(pDstPriv))
|
||||
{
|
||||
post_process = 1;
|
||||
if (g_do_dirty_os)
|
||||
{
|
||||
LLOGLN(10, ("rdpSetSpans: gettig dirty"));
|
||||
pDstPriv->is_dirty = 1;
|
||||
pDirtyPriv = pDstPriv;
|
||||
dirty_type = RDI_IMGLY;
|
||||
}
|
||||
else
|
||||
{
|
||||
rdpup_switch_os_surface(pDstPriv->rdpindex);
|
||||
reset_surface = 1;
|
||||
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
pDstWnd = (WindowPtr)pDrawable;
|
||||
if (pDstWnd->viewable)
|
||||
{
|
||||
post_process = 1;
|
||||
rdpup_get_screen_image_rect(&id);
|
||||
got_id = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!post_process)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RegionInit(&clip_reg, NullBox, 0);
|
||||
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
|
||||
if (cd == 1)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
}
|
||||
}
|
||||
else if (cd == 2)
|
||||
{
|
||||
if (dirty_type != 0)
|
||||
{
|
||||
}
|
||||
else if (got_id)
|
||||
{
|
||||
}
|
||||
}
|
||||
RegionUninit(&clip_reg);
|
||||
if (reset_surface)
|
||||
{
|
||||
rdpup_switch_os_surface(-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPSETSPANS_H
|
||||
#define __RDPSETSPANS_H
|
||||
|
||||
void
|
||||
rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
|
||||
DDXPointPtr ppt, int* pwidth, int nspans, int fSorted);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright 2005-2012 Jay Sorg
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RDPDRAW_H
|
||||
#define __RDPDRAW_H
|
||||
|
||||
/******************************************************************************/
|
||||
#define GC_OP_PROLOGUE(_pGC) \
|
||||
{ \
|
||||
priv = (rdpGCPtr)dixGetPrivateAddr(&(pGC->devPrivates), &g_rdpGCIndex); \
|
||||
oldFuncs = _pGC->funcs; \
|
||||
(_pGC)->funcs = priv->funcs; \
|
||||
(_pGC)->ops = priv->ops; \
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
#define GC_OP_EPILOGUE(_pGC) \
|
||||
{ \
|
||||
priv->ops = (_pGC)->ops; \
|
||||
(_pGC)->funcs = oldFuncs; \
|
||||
(_pGC)->ops = &g_rdpGCOps; \
|
||||
}
|
||||
|
||||
int
|
||||
rdp_get_clip(RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC);
|
||||
void
|
||||
GetTextBoundingBox(DrawablePtr pDrawable, FontPtr font, int x, int y,
|
||||
int n, BoxPtr pbox);
|
||||
|
||||
#endif
|
@ -0,0 +1,24 @@
|
||||
EXTRA_DIST = xrdpapi.h
|
||||
|
||||
EXTRA_DEFINES =
|
||||
EXTRA_INCLUDES =
|
||||
EXTRA_LIBS =
|
||||
EXTRA_FLAGS =
|
||||
|
||||
AM_CFLAGS = \
|
||||
$(EXTRA_DEFINES)
|
||||
|
||||
INCLUDES = \
|
||||
$(EXTRA_INCLUDES)
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libxrdpapi.la
|
||||
|
||||
libxrdpapi_la_SOURCES = \
|
||||
xrdpapi.c
|
||||
|
||||
libxrdpapi_la_LDFLAGS = \
|
||||
$(EXTRA_FLAGS)
|
||||
|
||||
libxrdpapi_la_LIBADD = \
|
||||
$(EXTRA_LIBS)
|
@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
// xrdp_chan_test.cpp : Basic test for virtual channel use.
|
||||
|
||||
// These headers are required for the windows terminal services calls.
|
||||
#include "xrdpapi.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define DSIZE (1024 * 4)
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
// Initialize the data for send/receive
|
||||
void* hFile;
|
||||
char* data;
|
||||
char* data1;
|
||||
data = (char*)malloc(DSIZE);
|
||||
data1 = (char*)malloc(DSIZE);
|
||||
int ret;
|
||||
void* vcFileHandlePtr = NULL;
|
||||
memset(data, 0xca, DSIZE);
|
||||
memset(data1, 0, DSIZE);
|
||||
unsigned int written = 0;
|
||||
|
||||
// Open the skel channel in current session
|
||||
|
||||
//void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "skel", 0);
|
||||
void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
ret = WTSVirtualChannelQuery(channel, WTSVirtualFileHandle, vcFileHandlePtr, &written);
|
||||
|
||||
// Write the data to the channel
|
||||
ret = WTSVirtualChannelWrite(channel, data, DSIZE, &written);
|
||||
if (!ret)
|
||||
{
|
||||
|
||||
long err = errno;
|
||||
printf("error 1 0x%8.8x\n", err);
|
||||
usleep(100000);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Sent bytes!\n");
|
||||
}
|
||||
if (written != DSIZE)
|
||||
{
|
||||
long err = errno;
|
||||
printf("error 2 0x%8.8x\n", err);
|
||||
usleep(100000);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Read bytes!\n");
|
||||
}
|
||||
ret = WTSVirtualChannelRead(channel, 100, data1, DSIZE, &written);
|
||||
if (!ret)
|
||||
{
|
||||
long err = errno;
|
||||
printf("error 3 0x%8.8x\n", err);
|
||||
usleep(100000);
|
||||
return 1;
|
||||
}
|
||||
if (written != DSIZE)
|
||||
{
|
||||
long err = errno;
|
||||
printf("error 4 0x%8.8x\n", err);
|
||||
usleep(100000);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Read bytes!\n");
|
||||
}
|
||||
ret = WTSVirtualChannelClose(channel);
|
||||
if (memcmp(data, data1, DSIZE) == 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("error data no match\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Done!\n");
|
||||
|
||||
usleep(100000);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,383 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Thomas Goddard 2012
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* do not use os_calls in here */
|
||||
|
||||
#define LOG_LEVEL 1
|
||||
#define LLOG(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
|
||||
#define LLOGLN(_level, _args) \
|
||||
do { if (_level < LOG_LEVEL) { printf _args ; printf("\n"); } } while (0)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include "xrdpapi.h"
|
||||
|
||||
struct wts_obj
|
||||
{
|
||||
int fd;
|
||||
int status;
|
||||
char name[8];
|
||||
char dname[128];
|
||||
int display_num;
|
||||
int flags;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
get_display_num_from_display(char* display_text)
|
||||
{
|
||||
int index;
|
||||
int mode;
|
||||
int host_index;
|
||||
int disp_index;
|
||||
int scre_index;
|
||||
char host[256];
|
||||
char disp[256];
|
||||
char scre[256];
|
||||
|
||||
index = 0;
|
||||
host_index = 0;
|
||||
disp_index = 0;
|
||||
scre_index = 0;
|
||||
mode = 0;
|
||||
while (display_text[index] != 0)
|
||||
{
|
||||
if (display_text[index] == ':')
|
||||
{
|
||||
mode = 1;
|
||||
}
|
||||
else if (display_text[index] == '.')
|
||||
{
|
||||
mode = 2;
|
||||
}
|
||||
else if (mode == 0)
|
||||
{
|
||||
host[host_index] = display_text[index];
|
||||
host_index++;
|
||||
}
|
||||
else if (mode == 1)
|
||||
{
|
||||
disp[disp_index] = display_text[index];
|
||||
disp_index++;
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
scre[scre_index] = display_text[index];
|
||||
scre_index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
host[host_index] = 0;
|
||||
disp[disp_index] = 0;
|
||||
scre[scre_index] = 0;
|
||||
return atoi(disp);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void*
|
||||
WTSVirtualChannelOpen(void* hServer, unsigned int SessionId,
|
||||
const char* pVirtualName)
|
||||
{
|
||||
if (hServer != WTS_CURRENT_SERVER_HANDLE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return WTSVirtualChannelOpenEx(SessionId, pVirtualName, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
can_send(int sck, int millis)
|
||||
{
|
||||
struct timeval time;
|
||||
fd_set wfds;
|
||||
int select_rv;
|
||||
|
||||
FD_ZERO(&wfds);
|
||||
FD_SET(sck, &wfds);
|
||||
time.tv_sec = millis / 1000;
|
||||
time.tv_usec = (millis * 1000) % 1000000;
|
||||
select_rv = select(sck + 1, 0, &wfds, 0, &time);
|
||||
if (select_rv > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
can_recv(int sck, int millis)
|
||||
{
|
||||
struct timeval time;
|
||||
fd_set rfds;
|
||||
int select_rv;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(sck, &rfds);
|
||||
time.tv_sec = millis / 1000;
|
||||
time.tv_usec = (millis * 1000) % 1000000;
|
||||
select_rv = select(sck + 1, &rfds, 0, 0, &time);
|
||||
if (select_rv > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
send_init(struct wts_obj* wts)
|
||||
{
|
||||
char initmsg[64];
|
||||
|
||||
memset(initmsg, 0, 64);
|
||||
strncpy(initmsg, wts->name, 8);
|
||||
initmsg[16] = (wts->flags >> 0) & 0xff;
|
||||
initmsg[17] = (wts->flags >> 8) & 0xff;
|
||||
initmsg[18] = (wts->flags >> 16) & 0xff;
|
||||
initmsg[19] = (wts->flags >> 24) & 0xff;
|
||||
LLOGLN(10, ("send_init: sending %s", initmsg));
|
||||
if (!can_send(wts->fd, 500))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (send(wts->fd, initmsg, 64, 0) != 64)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
LLOGLN(10, ("send_init: send ok!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void*
|
||||
WTSVirtualChannelOpenEx(unsigned int SessionId,
|
||||
const char* pVirtualName,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct wts_obj* wts;
|
||||
char* display_text;
|
||||
struct sockaddr_un s;
|
||||
int bytes;
|
||||
unsigned long llong;
|
||||
|
||||
if (SessionId != WTS_CURRENT_SESSION)
|
||||
{
|
||||
LLOGLN(0, ("WTSVirtualChannelOpenEx: SessionId bad"));
|
||||
return 0;
|
||||
}
|
||||
wts = (struct wts_obj*)malloc(sizeof(struct wts_obj));
|
||||
memset(wts, 0, sizeof(struct wts_obj));
|
||||
wts->fd = -1;
|
||||
wts->flags = flags;
|
||||
display_text = getenv("DISPLAY");
|
||||
if (display_text != 0)
|
||||
{
|
||||
wts->display_num = get_display_num_from_display(display_text);
|
||||
}
|
||||
if (wts->display_num > 0)
|
||||
{
|
||||
wts->fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
/* set non blocking */
|
||||
llong = fcntl(wts->fd, F_GETFL);
|
||||
llong = llong | O_NONBLOCK;
|
||||
fcntl(wts->fd, F_SETFL, llong);
|
||||
/* connect to session chansrv */
|
||||
memset(&s, 0, sizeof(struct sockaddr_un));
|
||||
s.sun_family = AF_UNIX;
|
||||
bytes = sizeof(s.sun_path);
|
||||
snprintf(s.sun_path, bytes - 1, "/tmp/.xrdp/xrdpapi_%d", wts->display_num);
|
||||
s.sun_path[bytes - 1] = 0;
|
||||
bytes = sizeof(struct sockaddr_un);
|
||||
if (connect(wts->fd, (struct sockaddr*)&s, bytes) == 0)
|
||||
{
|
||||
LLOGLN(10, ("WTSVirtualChannelOpenEx: connected ok, name %s", pVirtualName));
|
||||
strncpy(wts->name, pVirtualName, 8);
|
||||
/* wait for connection to complete and send init */
|
||||
if (send_init(wts) == 0)
|
||||
{
|
||||
/* all ok */
|
||||
wts->status = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LLOGLN(0, ("WTSVirtualChannelOpenEx: display is 0"));
|
||||
}
|
||||
return wts;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
WTSVirtualChannelWrite(void* hChannelHandle, const char* Buffer,
|
||||
unsigned int Length, unsigned int* pBytesWritten)
|
||||
{
|
||||
struct wts_obj* wts;
|
||||
int error;
|
||||
int lerrno;
|
||||
|
||||
wts = (struct wts_obj*)hChannelHandle;
|
||||
if (wts == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (wts->status != 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (can_send(wts->fd, 0))
|
||||
{
|
||||
error = send(wts->fd, Buffer, Length, 0);
|
||||
if (error == -1)
|
||||
{
|
||||
lerrno = errno;
|
||||
if ((lerrno == EWOULDBLOCK) || (lerrno == EAGAIN) ||
|
||||
(lerrno == EINPROGRESS))
|
||||
{
|
||||
*pBytesWritten = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (error == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (error > 0)
|
||||
{
|
||||
*pBytesWritten = error;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
*pBytesWritten = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
WTSVirtualChannelRead(void* hChannelHandle, unsigned int TimeOut,
|
||||
char* Buffer, unsigned int BufferSize,
|
||||
unsigned int* pBytesRead)
|
||||
{
|
||||
struct wts_obj* wts;
|
||||
int error;
|
||||
int lerrno;
|
||||
|
||||
wts = (struct wts_obj*)hChannelHandle;
|
||||
if (wts == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (wts->status != 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (can_recv(wts->fd, TimeOut))
|
||||
{
|
||||
error = recv(wts->fd, Buffer, BufferSize, 0);
|
||||
if (error == -1)
|
||||
{
|
||||
lerrno = errno;
|
||||
if ((lerrno == EWOULDBLOCK) || (lerrno == EAGAIN) ||
|
||||
(lerrno == EINPROGRESS))
|
||||
{
|
||||
*pBytesRead = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (error == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (error > 0)
|
||||
{
|
||||
*pBytesRead = error;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
*pBytesRead = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
WTSVirtualChannelClose(void* hChannelHandle)
|
||||
{
|
||||
struct wts_obj* wts;
|
||||
|
||||
wts = (struct wts_obj*)hChannelHandle;
|
||||
if (wts == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (wts->fd != -1)
|
||||
{
|
||||
close(wts->fd);
|
||||
}
|
||||
free(wts);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
|
||||
void** ppBuffer, unsigned int* pBytesReturned)
|
||||
{
|
||||
struct wts_obj* wts;
|
||||
|
||||
wts = (struct wts_obj*)hChannelHandle;
|
||||
if (wts == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (wts->status != 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (WtsVirtualClass == WTSVirtualFileHandle)
|
||||
{
|
||||
*pBytesReturned = 4;
|
||||
*ppBuffer = malloc(4);
|
||||
memcpy(*ppBuffer, &(wts->fd), 4);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
WTSFreeMemory(void* pMemory)
|
||||
{
|
||||
if (pMemory != 0)
|
||||
{
|
||||
free(pMemory);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Thomas Goddard 2012
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
xrdpapi header, do not use os_calls.h, arch.h or any xrdp internal headers
|
||||
this file is included in 3rd party apps
|
||||
*/
|
||||
|
||||
#if !defined(XRDPAPI_H_)
|
||||
#define XRDPAPI_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WTS_CURRENT_SERVER_HANDLE 0
|
||||
#define WTS_CURRENT_SESSION 0xffffffff
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC 0x00000001
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW 0x00000000
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED 0x00000002
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH 0x00000004
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL 0x00000006
|
||||
#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_COMPRESS 0x00000008
|
||||
|
||||
typedef enum _WTS_VIRTUAL_CLASS
|
||||
{
|
||||
WTSVirtualClientData,
|
||||
WTSVirtualFileHandle
|
||||
} WTS_VIRTUAL_CLASS;
|
||||
|
||||
/*
|
||||
Reference:
|
||||
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464(v=vs.85).aspx
|
||||
*/
|
||||
void*
|
||||
WTSVirtualChannelOpen(void* hServer, unsigned int SessionId,
|
||||
const char* pVirtualName);
|
||||
void*
|
||||
WTSVirtualChannelOpenEx(unsigned int SessionId,
|
||||
const char* pVirtualName,
|
||||
unsigned int flags);
|
||||
int
|
||||
WTSVirtualChannelWrite(void* hChannelHandle, const char* Buffer,
|
||||
unsigned int Length, unsigned int* pBytesWritten);
|
||||
int
|
||||
WTSVirtualChannelRead(void* hChannelHandle, unsigned int TimeOut,
|
||||
char* Buffer, unsigned int BufferSize,
|
||||
unsigned int* pBytesRead);
|
||||
int
|
||||
WTSVirtualChannelClose(void* hChannelHandle);
|
||||
int
|
||||
WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
|
||||
void** ppBuffer, unsigned int* pBytesReturned);
|
||||
void
|
||||
WTSFreeMemory(void* pMemory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* XRDPAPI_H_ */
|
Loading…
Reference in new issue