libxputty 0.1
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
xputty-mswin.h File Reference

compatibility definitions (Linux, MSWindows): This file contains definitions and structs used to provide Xlib compatibility definitions for MSWindows. More...

Go to the source code of this file.

Data Structures

struct  XEvent
 

Typedefs

typedef unsigned long int XID
 
typedef unsigned long int Atom
 
typedef XID Display
 
typedef HWND Window
 
typedef XID Pixmap
 
typedef XID KeySym
 
typedef void * XIC
 
typedef void * XIM
 
typedef XEvent XButtonEvent
 
typedef XEvent XKeyEvent
 
typedef XEvent XMotionEvent
 

Functions

char * convert_cp (DWORD cp_from, DWORD cp_to, char *s_from)
 

Detailed Description

compatibility definitions (Linux, MSWindows): This file contains definitions and structs used to provide Xlib compatibility definitions for MSWindows.

Definition in file xputty-mswin.h.

Typedef Documentation

◆ Atom

typedef unsigned long int Atom

Definition at line 50 of file xputty-mswin.h.

◆ Display

typedef XID Display

Definition at line 51 of file xputty-mswin.h.

◆ KeySym

typedef XID KeySym

Definition at line 54 of file xputty-mswin.h.

◆ Pixmap

typedef XID Pixmap

Definition at line 53 of file xputty-mswin.h.

◆ Window

typedef HWND Window

Definition at line 52 of file xputty-mswin.h.

◆ XButtonEvent

Definition at line 68 of file xputty-mswin.h.

◆ XIC

typedef void* XIC

Definition at line 55 of file xputty-mswin.h.

◆ XID

typedef unsigned long int XID

Definition at line 49 of file xputty-mswin.h.

◆ XIM

typedef void* XIM

Definition at line 56 of file xputty-mswin.h.

◆ XKeyEvent

typedef XEvent XKeyEvent

Definition at line 69 of file xputty-mswin.h.

◆ XMotionEvent

Definition at line 70 of file xputty-mswin.h.

Function Documentation

◆ convert_cp()

char * convert_cp ( DWORD  cp_from,
DWORD  cp_to,
char *  s_from 
)

Definition at line 71 of file xwidget-mswin.c.

71 {
72 char *s_to = NULL;
73 int flags = MB_PRECOMPOSED; // | MB_ERR_INVALID_CHARS;
74 // prepare conversion to WideChar (using cp_from) - get required space
75 size_t size = MultiByteToWideChar(cp_from, flags, s_from, -1, NULL, 0);
76 if (size) {
77 // convert Ansi to WideChar (pwc)
78 wchar_t *pwc= (wchar_t*)malloc(size*2);
79 size_t size_wc = MultiByteToWideChar(cp_from, flags, s_from, -1, pwc, size);
80 if (size_wc) {
81 // prepare conversion to cp_to - get required space
82 flags = 0;
83 size = WideCharToMultiByte(cp_to, flags, pwc, size_wc, NULL, 0, NULL, NULL);
84 if (size) {
85 // convert WideChar (pwc) to Ansi using cp_to
86 s_to = (char*)malloc(size+1);
87 memset(s_to, 0 , size+1);
88 size = WideCharToMultiByte(cp_to, flags, pwc, size_wc, s_to, size, NULL, NULL);
89 }
90 }
91 free(pwc);
92 }
93 // needs to be free()d by caller
94 return s_to;
95}

Referenced by locale_from_utf8(), and utf8_from_locale().