Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for GTK+2 port #555

Merged
merged 20 commits into from
Apr 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9362760
Fixes a crash when exporting RDP profile to .rdp file. Fixes #412.
giox069 Dec 16, 2014
19d0da1
Clipboard fixes
giox069 Dec 21, 2014
5f83c1e
Merge pull request #415 from giox069/master
giox069 Dec 21, 2014
bbe4d1a
Fix null pointer use
giox069 Dec 22, 2014
4cbe672
Merge commit 'bbe4d1a5e31f7b3cb10514e95a8cabdd12afdf59'
repzilon Dec 25, 2014
0ca2a23
remmina: Actually install its headers.
rakuco Dec 31, 2014
0531ab2
Merge pull request #428 from rakuco/fix-header-installation
muflone Jan 2, 2015
decf1f3
Merge commit '0531ab2cb4a5b289049c20bb624e0b9fb6c67e9f'
repzilon Jan 4, 2015
8c2f156
Expose the arguments in the help text and parse --help and -h argumen…
muflone Dec 26, 2014
0ebb4b2
Wrapped line
muflone Dec 27, 2014
0914f0d
Added a check for GtkToggleToolButtons to position the popup menu under
muflone Dec 28, 2014
b1aaff5
Update es.po
antonio-guillen Feb 9, 2015
20b5116
Merge pull request #454 from agdg/patch-1
giox069 Feb 13, 2015
ff66a07
Merge commit '20b5116'
repzilon Feb 22, 2015
2b37718
Fix for notebook tab drag and drop, fixes issues #529 #478
giox069 Mar 25, 2015
4288ca7
Merge commit '2b377188973d08a19a9fa8dad563a1bae26179d3'
repzilon Apr 11, 2015
a9f1fbe
Tentatively correct widget positions of the RDP tab in Remmina settin…
repzilon Apr 11, 2015
17defef
Revert "Tentatively correct widget positions of the RDP tab in Remmin…
repzilon Apr 11, 2015
8a18d5a
Corrected RDP tab in preference in GTK+2
repzilon Apr 12, 2015
44fc821
Corrected some dialog layout on GTK+2
repzilon Apr 14, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,3 @@ if(GTK_FOUND)
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)

install(DIRECTORY include/remmina DESTINATION include/remmina FILES_MATCHING PATTERN "*.h")
155 changes: 131 additions & 24 deletions remmina-plugins/rdp/rdp_cliprdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* In addition, as a special exception, the copyright holders give
Expand All @@ -40,6 +40,75 @@
#include <freerdp/channels/channels.h>
#include <freerdp/client/cliprdr.h>

#pragma pack(push,1)
typedef unsigned int wDWORD;
typedef unsigned short wWORD;
typedef int wLONG;
typedef unsigned char wBYTE;
typedef wLONG FXPT2DOT30;
typedef struct tagCIEXYZ
{
FXPT2DOT30 ciexyzX;
FXPT2DOT30 ciexyzY;
FXPT2DOT30 ciexyzZ;
} CIEXYZ;

typedef struct tagICEXYZTRIPLE
{
CIEXYZ ciexyzRed;
CIEXYZ ciexyzGreen;
CIEXYZ ciexyzBlue;
} CIEXYZTRIPLE;
typedef struct
{
wDWORD bV5Size;
wLONG bV5Width;
wLONG bV5Height;
wWORD bV5Planes;
wWORD bV5BitCount;
wDWORD bV5Compression;
wDWORD bV5SizeImage;
wLONG bV5XPelsPerMeter;
wLONG bV5YPelsPerMeter;
wDWORD bV5ClrUsed;
wDWORD bV5ClrImportant;
wDWORD bV5RedMask;
wDWORD bV5GreenMask;
wDWORD bV5BlueMask;
wDWORD bV5AlphaMask;
wDWORD bV5CSType;
CIEXYZTRIPLE bV5Endpoints;
wDWORD bV5GammaRed;
wDWORD bV5GammaGreen;
wDWORD bV5GammaBlue;
wDWORD bV5Intent;
wDWORD bV5ProfileData;
wDWORD bV5ProfileSize;
wDWORD bV5Reserved;
} BITMAPV5HEADER;
typedef struct tagRGBQUAD
{
wBYTE rgbBlue;
wBYTE rgbGreen;
wBYTE rgbRed;
wBYTE rgbReserved;
} RGBQUAD;
typedef struct tagBITMAPINFOHEADER
{
wDWORD biSize;
wLONG biWidth;
wLONG biHeight;
wWORD biPlanes;
wWORD biBitCount;
wDWORD biCompression;
wDWORD biSizeImage;
wLONG biXPelsPerMeter;
wLONG biYPelsPerMeter;
wDWORD biClrUsed;
wDWORD biClrImportant;
} BITMAPINFOHEADER;
#pragma pack(pop)


UINT32 remmina_rdp_cliprdr_get_format_from_gdkatom(GdkAtom atom)
{
Expand Down Expand Up @@ -186,11 +255,14 @@ void remmina_rdp_cliprdr_process_format_list(RemminaProtocolWidget* gp, RDP_CB_F
GdkAtom atom = gdk_atom_intern("image/jpeg", TRUE);
gtk_target_list_add(list, atom, 0, CB_FORMAT_JPEG);
}
/* it seems that in freerdp 1.1 PNG images are not correctly
* received from server. So just disable it.
if (event->formats[i] == CB_FORMAT_PNG)
{
GdkAtom atom = gdk_atom_intern("image/png", TRUE);
gtk_target_list_add(list, atom, 0, CB_FORMAT_PNG);
}
*/
}

ui = g_new0(RemminaPluginRdpUiObject, 1);
Expand Down Expand Up @@ -228,33 +300,46 @@ void remmina_rdp_cliprdr_process_data_response(RemminaProtocolWidget* gp, RDP_CB
{
case CB_FORMAT_UNICODETEXT:
{
size = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)data, size / 2, (CHAR**)&data, 0, NULL, NULL);
crlf2lf(data, &size);
output = data;
size = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)data, size / 2, (CHAR**)&output, 0, NULL, NULL);
crlf2lf(output, &size);
break;
}

case CB_FORMAT_TEXT:
case CB_FORMAT_HTML:
{
crlf2lf(data, &size);
output = data;
output = (gpointer)calloc(1, size + 1);
if (output) {
memcpy(output, data, size);
crlf2lf(output, &size);
}
break;
}

case CB_FORMAT_DIB:
{
wStream* s;
UINT16 bpp;
UINT32 offset;
UINT32 ncolors;

s = Stream_New(data, size);
Stream_Seek(s, 14);
Stream_Read_UINT16(s, bpp);
Stream_Read_UINT32(s, ncolors);
offset = 14 + 40 + (bpp <= 8 ? (ncolors == 0 ? (1 << bpp) : ncolors) * 4 : 0);
Stream_Free(s, TRUE);
GError *perr;
BITMAPINFOHEADER* pbi;
BITMAPV5HEADER* pbi5;

pbi = (BITMAPINFOHEADER*)data;

// offset calculation inspired by http://downloads.poolelan.com/MSDN/MSDNLibrary6/Disk1/Samples/VC/OS/WindowsXP/GetImage/BitmapUtil.cpp
offset = 14 + pbi->biSize;
if (pbi->biClrUsed != 0)
offset += sizeof(RGBQUAD) * pbi->biClrUsed;
else if (pbi->biBitCount <= 8)
offset += sizeof(RGBQUAD) * (1 << pbi->biBitCount);
if (pbi->biSize == sizeof(BITMAPINFOHEADER)) {
if (pbi->biCompression == 3) // BI_BITFIELDS is 3
offset += 12;
} else if (pbi->biSize >= sizeof(BITMAPV5HEADER)) {
pbi5 = (BITMAPV5HEADER*)pbi;
if (pbi5->bV5ProfileData <= offset)
offset += pbi5->bV5ProfileSize;
}

s = Stream_New(NULL, 14 + size);
Stream_Write_UINT8(s, 'B');
Expand All @@ -263,15 +348,23 @@ void remmina_rdp_cliprdr_process_data_response(RemminaProtocolWidget* gp, RDP_CB
Stream_Write_UINT32(s, 0);
Stream_Write_UINT32(s, offset);
Stream_Write(s, data, size);

data = Stream_Buffer(s);
size = Stream_Length(s);

pixbuf = gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(pixbuf, data, size, NULL);
gdk_pixbuf_loader_close(pixbuf, NULL);
Stream_Free(s, TRUE);
output = g_object_ref(gdk_pixbuf_loader_get_pixbuf(pixbuf));
perr = NULL;

if ( !gdk_pixbuf_loader_write(pixbuf, data, size, &perr) ) {
remmina_plugin_service->log_printf("[RDP] rdp_cliprdr: gdk_pixbuf_loader_write() returned error %s\n", perr->message);
}
else
{
if ( !gdk_pixbuf_loader_close(pixbuf, &perr) ) {
remmina_plugin_service->log_printf("[RDP] rdp_cliprdr: gdk_pixbuf_loader_close() returned error %s\n", perr->message);
perr = NULL;
}
Stream_Free(s, TRUE);
output = g_object_ref(gdk_pixbuf_loader_get_pixbuf(pixbuf));
}
g_object_unref(pixbuf);
break;
}
Expand All @@ -288,7 +381,11 @@ void remmina_rdp_cliprdr_process_data_response(RemminaProtocolWidget* gp, RDP_CB
}
}
}
g_async_queue_push(rfi->clipboard_queue, output);

if (rfi->clipboard_queue) {
g_async_queue_push(rfi->clipboard_queue, output);
}

}

void remmina_rdp_channel_cliprdr_process(RemminaProtocolWidget* gp, wMessage* event)
Expand Down Expand Up @@ -319,6 +416,10 @@ void remmina_rdp_cliprdr_request_data(GtkClipboard *clipboard, GtkSelectionData
gpointer data;
RDP_CB_DATA_REQUEST_EVENT* event;
rfContext* rfi = GET_DATA(gp);
GAsyncQueue* q;

if (rfi->clipboard_queue != NULL)
return;

target = gtk_selection_data_get_target(selection_data);
rfi->format = remmina_rdp_cliprdr_get_format_from_gdkatom(target);
Expand All @@ -330,7 +431,7 @@ void remmina_rdp_cliprdr_request_data(GtkClipboard *clipboard, GtkSelectionData
event->format = rfi->format;
freerdp_channels_send_event(rfi->instance->context->channels, (wMessage*) event);

data = g_async_queue_timeout_pop(rfi->clipboard_queue, 1000000);
data = g_async_queue_timeout_pop(rfi->clipboard_queue, 2000000);
if (data != NULL)
{
if (info == CB_FORMAT_PNG || info == CB_FORMAT_DIB || info == CB_FORMAT_JPEG)
Expand All @@ -341,8 +442,14 @@ void remmina_rdp_cliprdr_request_data(GtkClipboard *clipboard, GtkSelectionData
else
{
gtk_selection_data_set_text(selection_data, data, -1);
free(data);
}
}

q = rfi->clipboard_queue;
rfi->clipboard_queue = NULL;
g_async_queue_unref(q);

}

void remmina_rdp_cliprdr_empty_clipboard(GtkClipboard *clipboard, RemminaProtocolWidget* gp)
Expand Down Expand Up @@ -384,7 +491,7 @@ int remmina_rdp_cliprdr_send_format_list(RemminaProtocolWidget* gp, RemminaPlugi
}
else
event->num_formats = 0;


return freerdp_channels_send_event(rfi->instance->context->channels, (wMessage*) event);
}
Expand Down
23 changes: 13 additions & 10 deletions remmina-plugins/rdp/rdp_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,19 @@ gboolean remmina_rdp_file_export_channel(RemminaFile* remminafile, FILE* fp)
const gchar* cs;

fprintf(fp, "screen mode id:i:2\r\n");
s = g_strdup(remmina_plugin_service->file_get_string(remminafile, "resolution"));

p = strchr(s, 'x');

if (p)
cs = remmina_plugin_service->file_get_string(remminafile, "resolution");
if (cs)
{
*p++ = '\0';
fprintf(fp, "desktopwidth:i:%s\r\n", s);
fprintf(fp, "desktopheight:i:%s\r\n", p);
s = g_strdup(cs);
p = strchr(s, 'x');
if (p)
{
*p++ = '\0';
fprintf(fp, "desktopwidth:i:%s\r\n", s);
fprintf(fp, "desktopheight:i:%s\r\n", p);
}
g_free(s);
}
g_free(s);

fprintf(fp, "session bpp:i:%i\r\n", remmina_plugin_service->file_get_int(remminafile, "colordepth", 8));
//fprintf(fp, "winposstr:s:0,1,123,34,931,661\r\n");
Expand All @@ -278,7 +280,8 @@ gboolean remmina_rdp_file_export_channel(RemminaFile* remminafile, FILE* fp)
fprintf(fp, "disable themes:i:0\r\n");
fprintf(fp, "disable cursor setting:i:0\r\n");
fprintf(fp, "bitmapcachepersistenable:i:1\r\n");
fprintf(fp, "full address:s:%s\r\n", remmina_plugin_service->file_get_string(remminafile, "server"));
cs = remmina_plugin_service->file_get_string(remminafile, "server");
fprintf(fp, "full address:s:%s\r\n", cs ? cs : "" );
if (g_strcmp0(remmina_plugin_service->file_get_string(remminafile, "sound"), "local") == 0)
fprintf(fp, "audiomode:i:0\r\n");
else if (g_strcmp0(remmina_plugin_service->file_get_string(remminafile, "sound"), "remote") == 0)
Expand Down
Loading