FreeRDP/client/Windows/wf_interface.h
Benoit LeBlanc 0b9112b091 Added System menu for "Smart Sizing". Small fixes
Fixed an issue where the scrollbars were not disappearing when
maximizing window.
2013-04-30 11:15:04 -04:00

188 lines
4.5 KiB
C

/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Windows Client
*
* Copyright 2009-2011 Jay Sorg
* Copyright 2010-2011 Vic Lee
* Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 __WF_INTERFACE_H
#define __WF_INTERFACE_H
#include <winpr/windows.h>
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
#include <freerdp/gdi/dc.h>
#include <freerdp/gdi/region.h>
#include <freerdp/cache/cache.h>
#include <freerdp/codec/color.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/channels.h>
#include <freerdp/codec/rfx.h>
#include <freerdp/codec/nsc.h>
#include <freerdp/client/file.h>
#include "wf_event.h"
#ifdef __cplusplus
extern "C" {
#endif
// Callback type codes. Move elsewhere?
#define CALLBACK_TYPE_PARAM_CHANGE 0x01
#define CALLBACK_TYPE_CONNECTED 0x02
#define CALLBACK_TYPE_DISCONNECTED 0x03
// System menu constants
#define SYSCOMMAND_ID_SMARTSIZING 1000
struct wf_bitmap
{
rdpBitmap _bitmap;
HDC hdc;
HBITMAP bitmap;
HBITMAP org_bitmap;
BYTE* pdata;
};
typedef struct wf_bitmap wfBitmap;
struct wf_pointer
{
rdpPointer pointer;
HCURSOR cursor;
};
typedef struct wf_pointer wfPointer;
typedef struct wf_info wfInfo;
struct wf_context
{
rdpContext _p;
wfInfo* wfi;
};
typedef struct wf_context wfContext;
typedef void (CALLBACK * callbackFunc)(wfInfo* wfi, int callback_type, DWORD param1, DWORD param2);
struct wf_info
{
rdpClient* client;
int width;
int height;
int offset_x;
int offset_y;
int fs_toggle;
int fullscreen;
int percentscreen;
char window_title[64];
int client_x;
int client_y;
int client_width;
int client_height;
HANDLE thread;
HANDLE keyboardThread;
HICON icon;
HWND hWndParent;
HINSTANCE hInstance;
WNDCLASSEX wndClass;
LPCTSTR wndClassName;
HCURSOR hDefaultCursor;
HWND hwnd;
POINT diff;
HGDI_DC hdc;
UINT16 srcBpp;
UINT16 dstBpp;
freerdp* instance;
wfBitmap* primary;
wfBitmap* drawing;
HCLRCONV clrconv;
HCURSOR cursor;
HBRUSH brush;
HBRUSH org_brush;
RECT update_rect;
RECT scale_update_rect;
wfBitmap* tile;
DWORD mainThreadId;
DWORD keyboardThreadId;
RFX_CONTEXT* rfx_context;
NSC_CONTEXT* nsc_context;
BOOL sw_gdi;
callbackFunc client_callback_func;
rdpFile* connectionRdpFile;
// Keep track of window size and position, disable when in fullscreen mode.
BOOL disablewindowtracking;
// These variables are required for horizontal scrolling.
BOOL updating_scrollbars;
BOOL xScrollVisible;
int xMinScroll; // minimum horizontal scroll value
int xCurrentScroll; // current horizontal scroll value
int xMaxScroll; // maximum horizontal scroll value
// These variables are required for vertical scrolling.
BOOL yScrollVisible;
int yMinScroll; // minimum vertical scroll value
int yCurrentScroll; // current vertical scroll value
int yMaxScroll; // maximum vertical scroll value
};
/**
* Client Interface
*/
#define cfInfo wfInfo
void wf_on_param_change(freerdp* instance, int id);
void wf_size_scrollbars(wfInfo* wfi, int client_width, int client_height);
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(wfInfo* cfi);
FREERDP_API int freerdp_client_stop(wfInfo* cfi);
FREERDP_API int freerdp_client_focus_in(wfInfo* cfi);
FREERDP_API int freerdp_client_focus_out(wfInfo* cfi);
FREERDP_API int freerdp_client_set_window_size(wfInfo* cfi, int width, int height);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API int freerdp_client_free(wfInfo* cfi);
FREERDP_API int freerdp_client_set_client_callback_function(wfInfo* cfi, callbackFunc callbackFunc);
FREERDP_API rdpSettings* freerdp_client_get_settings(wfInfo* wfi);
FREERDP_API int freerdp_client_load_settings_from_rdp_file(wfInfo* cfi, char* filename);
FREERDP_API int freerdp_client_save_settings_to_rdp_file(wfInfo* cfi, char* filename);
#ifdef __cplusplus
}
#endif
#endif