*** empty log message ***
git-svn-id: svn://10.65.10.50/trunk@11941 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0bee10929f
commit
eb544f8aef
@ -11,6 +11,7 @@
|
||||
#include <wx/fontenum.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/snglinst.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -216,53 +217,123 @@ int64_t OsLinux_GetDiskFreeSpace(const char * path)
|
||||
return nBytes;
|
||||
}
|
||||
|
||||
void OsLinux_SetCaptionStyle(wxWindow * w, bool set)
|
||||
#include "wx/settings.h"
|
||||
#include "X11/Xutil.h"
|
||||
|
||||
#ifndef MWM_DECOR_BORDER
|
||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
||||
#define MWM_HINTS_STATUS (1L << 3)
|
||||
#define MWM_DECOR_ALL (1L << 0)
|
||||
#define MWM_DECOR_BORDER (1L << 1)
|
||||
#define MWM_DECOR_RESIZEH (1L << 2)
|
||||
#define MWM_DECOR_TITLE (1L << 3)
|
||||
#define MWM_DECOR_MENU (1L << 4)
|
||||
#define MWM_DECOR_MINIMIZE (1L << 5)
|
||||
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
||||
#define MWM_FUNC_ALL (1L << 0)
|
||||
#define MWM_FUNC_RESIZE (1L << 1)
|
||||
#define MWM_FUNC_MOVE (1L << 2)
|
||||
#define MWM_FUNC_MINIMIZE (1L << 3)
|
||||
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
||||
#define MWM_FUNC_CLOSE (1L << 5)
|
||||
#define MWM_INPUT_MODELESS 0
|
||||
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
||||
#define MWM_INPUT_SYSTEM_MODAL 2
|
||||
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
||||
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
|
||||
#define MWM_TEAROFF_WINDOW (1L<<0)
|
||||
#endif
|
||||
|
||||
struct MwmHints {
|
||||
long flags;
|
||||
long functions;
|
||||
long decorations;
|
||||
long input_mode;
|
||||
};
|
||||
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
|
||||
// Set the window manager decorations according to the
|
||||
// given wxWindows style
|
||||
bool wxSetWMDecorations(Window w, long style)
|
||||
{
|
||||
// long decor = 0L;
|
||||
// const long style = w->GetWindowStyle();
|
||||
// if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
|
||||
// {
|
||||
// decor = 0L;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
/* decor = (long) GDK_DECOR_BORDER;
|
||||
if ((style & wxCAPTION) != 0)
|
||||
decor |= GDK_DECOR_TITLE;
|
||||
if ((style & wxSYSTEM_MENU) != 0)
|
||||
decor |= GDK_DECOR_MENU;
|
||||
if ((style & wxMINIMIZE_BOX) != 0)
|
||||
decor |= GDK_DECOR_MINIMIZE;
|
||||
if ((style & wxMAXIMIZE_BOX) != 0)
|
||||
decor |= GDK_DECOR_MAXIMIZE;
|
||||
if ((style & wxRESIZE_BORDER) != 0)
|
||||
decor |= GDK_DECOR_RESIZEH;
|
||||
if (set)
|
||||
decor |= GDK_DECOR_TITLE;
|
||||
else
|
||||
decor &= ~GDK_DECOR_TITLE;
|
||||
}
|
||||
gdk_window_set_decorations( ((GtkWidget *)w->GetHandle())->window, (GdkWMDecoration) decor); */
|
||||
Atom mwm_wm_hints = XInternAtom((Display * )wxGetDisplay(),"_MOTIF_WM_HINTS", False);
|
||||
if (mwm_wm_hints == 0)
|
||||
return FALSE;
|
||||
|
||||
MwmHints hints;
|
||||
hints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
||||
hints.decorations = 0;
|
||||
hints.functions = 0;
|
||||
|
||||
// if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
|
||||
if (style & wxNO_BORDER)
|
||||
{
|
||||
// leave zeros
|
||||
}
|
||||
else
|
||||
{
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
hints.functions = MWM_FUNC_MOVE | MWM_FUNC_CLOSE;
|
||||
if ((style & wxCAPTION) != 0)
|
||||
hints.decorations |= MWM_DECOR_TITLE;
|
||||
|
||||
if ((style & wxSYSTEM_MENU) != 0)
|
||||
{
|
||||
hints.decorations |= MWM_DECOR_MENU;
|
||||
}
|
||||
|
||||
if ((style & wxMINIMIZE_BOX) != 0)
|
||||
{
|
||||
hints.functions |= MWM_FUNC_MINIMIZE;
|
||||
hints.decorations |= MWM_DECOR_MINIMIZE;
|
||||
}
|
||||
|
||||
if ((style & wxMAXIMIZE_BOX) != 0)
|
||||
{
|
||||
hints.functions |= MWM_FUNC_MAXIMIZE;
|
||||
hints.decorations |= MWM_DECOR_MAXIMIZE;
|
||||
}
|
||||
|
||||
if ((style & wxRESIZE_BORDER) != 0)
|
||||
{
|
||||
hints.functions |= MWM_FUNC_RESIZE;
|
||||
hints.decorations |= MWM_DECOR_RESIZEH;
|
||||
}
|
||||
}
|
||||
XChangeProperty((Display *) wxGetDisplay(), w, mwm_wm_hints, mwm_wm_hints, 32, PropModeReplace,
|
||||
(unsigned char *) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
void OsLinux_SetCaptionStyle(wxWindow * w, long style)
|
||||
{
|
||||
wxSetWMDecorations(GDK_WINDOW_XID(w->m_widget->window), style);
|
||||
}
|
||||
|
||||
|
||||
int OsLinux_GetSessionId()
|
||||
{
|
||||
char s[80];
|
||||
|
||||
|
||||
strcpy(s, getenv("DISPLAY"));
|
||||
|
||||
char * p = strchr(s, ':');
|
||||
|
||||
|
||||
if (p == NULL)
|
||||
p = s;
|
||||
else
|
||||
p++;
|
||||
|
||||
|
||||
char * e = strchr(p, '.');
|
||||
|
||||
|
||||
if (e != NULL)
|
||||
*e = '\0';
|
||||
|
||||
|
||||
return atoi(p);
|
||||
}
|
||||
|
@ -20,6 +20,6 @@ bool OsLinux_SL_WriteBlock(unsigned short reg, unsigned short size, const unsign
|
||||
void OsLinux_GetFileSys(const char* path, char * dev, char * dir, char * type);
|
||||
bool OsLinux_IsNetworkDrive(const char * path);
|
||||
int64_t OsLinux_GetDiskFreeSpace(const char * path);
|
||||
void OsLinux_SetCaptionStyle(wxWindow * w, bool set);
|
||||
void OsLinux_SetCaptionStyle(wxWindow * w, long style);
|
||||
int OsLinux_GetSessionId();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user