Cleanup: remove STR_String usage from GHOST
This commit is contained in:
parent
b21a3e7702
commit
2580fa1602
|
@ -86,7 +86,6 @@ set(SRC
|
|||
|
||||
set(LIB
|
||||
bf_intern_glew_mx
|
||||
bf_intern_string
|
||||
${GLEW_LIBRARY}
|
||||
)
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#define __GHOST_IContext_H__
|
||||
|
||||
#include "GHOST_Types.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
/**
|
||||
* Interface for GHOST context.
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#ifndef __GHOST_ISYSTEM_H__
|
||||
#define __GHOST_ISYSTEM_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "GHOST_IContext.h"
|
||||
#include "GHOST_ITimerTask.h"
|
||||
#include "GHOST_IWindow.h"
|
||||
|
@ -240,7 +242,7 @@ class GHOST_ISystem {
|
|||
* \param parentWindow: Parent (embedder) window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
virtual GHOST_IWindow *createWindow(const STR_String &title,
|
||||
virtual GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
|
||||
#include "GHOST_Rect.h"
|
||||
#include "GHOST_Types.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
* Interface for GHOST windows.
|
||||
|
@ -81,13 +83,13 @@ class GHOST_IWindow {
|
|||
* Sets the title displayed in the title bar.
|
||||
* \param title The title to display in the title bar.
|
||||
*/
|
||||
virtual void setTitle(const STR_String &title) = 0;
|
||||
virtual void setTitle(const char *title) = 0;
|
||||
|
||||
/**
|
||||
* Returns the title displayed in the title bar.
|
||||
* \param title The title displayed in the title bar.
|
||||
*/
|
||||
virtual void getTitle(STR_String &title) const = 0;
|
||||
virtual std::string getTitle() const = 0;
|
||||
|
||||
/**
|
||||
* Returns the window rectangle dimensions.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
#include "GHOST_IEvent.h"
|
||||
|
@ -527,17 +528,15 @@ void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title)
|
|||
char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||
STR_String title;
|
||||
std::string title = window->getTitle();
|
||||
|
||||
window->getTitle(title);
|
||||
|
||||
char *ctitle = (char *)malloc(title.Length() + 1);
|
||||
char *ctitle = (char *)malloc(title.size() + 1);
|
||||
|
||||
if (ctitle == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(ctitle, title.Ptr());
|
||||
strcpy(ctitle, title.c_str());
|
||||
|
||||
return ctitle;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#ifndef __GHOST_EVENTKEY_H__
|
||||
#define __GHOST_EVENTKEY_H__
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "GHOST_Event.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
|
||||
#include "GHOST_IEventConsumer.h"
|
||||
|
||||
#include "STR_String.h"
|
||||
|
||||
/**
|
||||
* An Event consumer that prints all the events to standard out.
|
||||
* Really useful when debugging.
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "GHOST_EventKey.h"
|
||||
#include "GHOST_EventNDOF.h"
|
||||
#include "GHOST_WindowManager.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h> // for error/info reporting
|
||||
#include <string.h> // for memory functions
|
||||
|
|
|
@ -367,7 +367,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
|||
GHOST_ASSERT(m_displayManager,
|
||||
"GHOST_System::createFullScreenWindow(): invalid display manager");
|
||||
// GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
|
||||
*window = (GHOST_Window *)createWindow(STR_String(""),
|
||||
*window = (GHOST_Window *)createWindow("",
|
||||
0,
|
||||
0,
|
||||
settings.xPixels,
|
||||
|
|
|
@ -100,7 +100,7 @@ class GHOST_SystemCocoa : public GHOST_System {
|
|||
* \param parentWindow Parent (embedder) window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -698,7 +698,7 @@ void GHOST_SystemCocoa::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns3
|
|||
getMainDisplayDimensions(width, height);
|
||||
}
|
||||
|
||||
GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
|
||||
GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -106,7 +106,7 @@ class GHOST_SystemNULL : public GHOST_System {
|
|||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -49,7 +49,7 @@ GHOST_SystemSDL::~GHOST_SystemSDL()
|
|||
SDL_Quit();
|
||||
}
|
||||
|
||||
GHOST_IWindow *GHOST_SystemSDL::createWindow(const STR_String &title,
|
||||
GHOST_IWindow *GHOST_SystemSDL::createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -80,7 +80,7 @@ class GHOST_SystemSDL : public GHOST_System {
|
|||
private:
|
||||
GHOST_TSuccess init();
|
||||
|
||||
GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -282,7 +282,7 @@ void GHOST_SystemWin32::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns3
|
|||
height = ::GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
}
|
||||
|
||||
GHOST_IWindow *GHOST_SystemWin32::createWindow(const STR_String &title,
|
||||
GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -126,7 +126,7 @@ class GHOST_SystemWin32 : public GHOST_System {
|
|||
* \param parentWindow Parent window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -338,7 +338,7 @@ void GHOST_SystemX11::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32
|
|||
* \param parentWindow Parent window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IWindow *GHOST_SystemX11::createWindow(const STR_String &title,
|
||||
GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -137,7 +137,7 @@ class GHOST_SystemX11 : public GHOST_System {
|
|||
* \param parentWindow Parent (embedder) window
|
||||
* \return The new window (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IWindow *createWindow(const STR_String &title,
|
||||
GHOST_IWindow *createWindow(const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "GHOST_IWindow.h"
|
||||
|
||||
class STR_String;
|
||||
class GHOST_Context;
|
||||
|
||||
/**
|
||||
|
@ -61,8 +60,8 @@ class GHOST_Window : public GHOST_IWindow {
|
|||
* \section Interface inherited from GHOST_IWindow left for derived class
|
||||
* implementation.
|
||||
* virtual bool getValid() const = 0;
|
||||
* virtual void setTitle(const STR_String& title) = 0;
|
||||
* virtual void getTitle(STR_String& title) const = 0;
|
||||
* virtual void setTitle(const char * title) = 0;
|
||||
* virtual std::string getTitle() const = 0;
|
||||
* virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
|
||||
* virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
|
||||
* virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#endif // __APPLE__
|
||||
|
||||
#include "GHOST_Window.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
@class CAMetalLayer;
|
||||
@class CocoaMetalView;
|
||||
|
@ -58,7 +57,7 @@ class GHOST_WindowCocoa : public GHOST_Window {
|
|||
* \param stereoVisual Stereo visual for quad buffered stereo.
|
||||
*/
|
||||
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 bottom,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -92,13 +91,12 @@ class GHOST_WindowCocoa : public GHOST_Window {
|
|||
* Sets the title displayed in the title bar.
|
||||
* \param title The title to display in the title bar.
|
||||
*/
|
||||
void setTitle(const STR_String &title);
|
||||
|
||||
void setTitle(const char *title);
|
||||
/**
|
||||
* Returns the title displayed in the title bar.
|
||||
* \param title The title displayed in the title bar.
|
||||
*/
|
||||
void getTitle(STR_String &title) const;
|
||||
std::string getTitle() const;
|
||||
|
||||
/**
|
||||
* Returns the window rectangle dimensions.
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
/* clang-format on */
|
||||
|
||||
GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 bottom,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -482,7 +482,7 @@ void *GHOST_WindowCocoa::getOSWindow() const
|
|||
return (void *)m_window;
|
||||
}
|
||||
|
||||
void GHOST_WindowCocoa::setTitle(const STR_String &title)
|
||||
void GHOST_WindowCocoa::setTitle(const char *title)
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid");
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
@ -524,7 +524,7 @@ void GHOST_WindowCocoa::setTitle(const STR_String &title)
|
|||
[pool drain];
|
||||
}
|
||||
|
||||
void GHOST_WindowCocoa::getTitle(STR_String &title) const
|
||||
std::string GHOST_WindowCocoa::getTitle() const
|
||||
{
|
||||
GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getTitle(): window invalid");
|
||||
|
||||
|
@ -532,11 +532,14 @@ void GHOST_WindowCocoa::getTitle(STR_String &title) const
|
|||
|
||||
NSString *windowTitle = [m_window title];
|
||||
|
||||
std::string title;
|
||||
if (windowTitle != nil) {
|
||||
title = [windowTitle UTF8String];
|
||||
}
|
||||
|
||||
[pool drain];
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
void GHOST_WindowCocoa::getWindowBounds(GHOST_Rect &bounds) const
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
class STR_String;
|
||||
class GHOST_SystemNULL;
|
||||
|
||||
class GHOST_WindowNULL : public GHOST_Window {
|
||||
|
@ -37,7 +36,7 @@ class GHOST_WindowNULL : public GHOST_Window {
|
|||
}
|
||||
|
||||
GHOST_WindowNULL(GHOST_SystemNULL *system,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -83,12 +82,12 @@ class GHOST_WindowNULL : public GHOST_Window {
|
|||
{
|
||||
return true;
|
||||
}
|
||||
void setTitle(const STR_String &title)
|
||||
void setTitle(const char *title)
|
||||
{ /* nothing */
|
||||
}
|
||||
void getTitle(STR_String &title) const
|
||||
std::string getTitle() const
|
||||
{
|
||||
title = "untitled";
|
||||
return "untitled";
|
||||
}
|
||||
void getWindowBounds(GHOST_Rect &bounds) const
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -148,14 +148,14 @@ bool GHOST_WindowSDL::getValid() const
|
|||
return GHOST_Window::getValid() && m_valid_setup;
|
||||
}
|
||||
|
||||
void GHOST_WindowSDL::setTitle(const STR_String &title)
|
||||
void GHOST_WindowSDL::setTitle(const char *title)
|
||||
{
|
||||
SDL_SetWindowTitle(m_sdl_win, title.ReadPtr());
|
||||
SDL_SetWindowTitle(m_sdl_win, title);
|
||||
}
|
||||
|
||||
void GHOST_WindowSDL::getTitle(STR_String &title) const
|
||||
std::string GHOST_WindowSDL::getTitle() const
|
||||
{
|
||||
title = SDL_GetWindowTitle(m_sdl_win);
|
||||
return SDL_GetWindowTitle(m_sdl_win);
|
||||
}
|
||||
|
||||
void GHOST_WindowSDL::getWindowBounds(GHOST_Rect &bounds) const
|
||||
|
|
|
@ -35,7 +35,6 @@ extern "C" {
|
|||
# error "SDL 2.0 or newer is needed to build with Ghost"
|
||||
#endif
|
||||
|
||||
class STR_String;
|
||||
class GHOST_SystemSDL;
|
||||
|
||||
class GHOST_WindowSDL : public GHOST_Window {
|
||||
|
@ -49,7 +48,7 @@ class GHOST_WindowSDL : public GHOST_Window {
|
|||
|
||||
public:
|
||||
GHOST_WindowSDL(GHOST_SystemSDL *system,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -107,9 +106,9 @@ class GHOST_WindowSDL : public GHOST_Window {
|
|||
|
||||
GHOST_TSuccess setWindowCursorVisibility(bool visible);
|
||||
|
||||
void setTitle(const STR_String &title);
|
||||
void setTitle(const char *title);
|
||||
|
||||
void getTitle(STR_String &title) const;
|
||||
std::string getTitle() const;
|
||||
|
||||
GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
|||
}
|
||||
|
||||
GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -158,7 +158,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
|||
height = rect.bottom - rect.top;
|
||||
}
|
||||
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
m_hWnd = ::CreateWindowW(s_windowClassName, // pointer to registered class name
|
||||
title_16, // pointer to window name
|
||||
wintype, // window style
|
||||
|
@ -173,7 +173,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
|||
free(title_16);
|
||||
}
|
||||
else {
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
m_hWnd = ::CreateWindowW(s_windowClassName, // pointer to registered class name
|
||||
title_16, // pointer to window name
|
||||
WS_MAXIMIZE, // window style
|
||||
|
@ -430,19 +430,18 @@ HWND GHOST_WindowWin32::getHWND() const
|
|||
return m_hWnd;
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::setTitle(const STR_String &title)
|
||||
void GHOST_WindowWin32::setTitle(const char *title)
|
||||
{
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
::SetWindowTextW(m_hWnd, (wchar_t *)title_16);
|
||||
free(title_16);
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::getTitle(STR_String &title) const
|
||||
std::string GHOST_WindowWin32::getTitle() const
|
||||
{
|
||||
char buf[s_maxTitleLength]; /*CHANGE + never used yet*/
|
||||
::GetWindowText(m_hWnd, buf, s_maxTitleLength);
|
||||
STR_String temp(buf);
|
||||
title = buf;
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::getWindowBounds(GHOST_Rect &bounds) const
|
||||
|
|
|
@ -259,7 +259,7 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
|||
* \param parentWindowHwnd
|
||||
*/
|
||||
GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -294,13 +294,13 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
|||
* Sets the title displayed in the title bar.
|
||||
* \param title The title to display in the title bar.
|
||||
*/
|
||||
void setTitle(const STR_String &title);
|
||||
void setTitle(const char *title);
|
||||
|
||||
/**
|
||||
* Returns the title displayed in the title bar.
|
||||
* \param title The title displayed in the title bar.
|
||||
* \return The title displayed in the title bar.
|
||||
*/
|
||||
void getTitle(STR_String &title) const;
|
||||
std::string getTitle() const;
|
||||
|
||||
/**
|
||||
* Returns the window rectangle dimensions.
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "GHOST_IconX11.h"
|
||||
#include "GHOST_SystemX11.h"
|
||||
#include "GHOST_WindowX11.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
#ifdef WITH_XDND
|
||||
# include "GHOST_DropTargetX11.h"
|
||||
|
@ -61,6 +60,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
|
||||
|
@ -212,7 +212,7 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
|
|||
|
||||
GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
|
||||
Display *display,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -414,9 +414,9 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
|
|||
/* XClassHint, title */
|
||||
{
|
||||
XClassHint *xclasshint = XAllocClassHint();
|
||||
const int len = title.Length() + 1;
|
||||
const int len = strlen(title) + 1;
|
||||
char *wmclass = (char *)malloc(sizeof(char) * len);
|
||||
memcpy(wmclass, title.ReadPtr(), len * sizeof(char));
|
||||
memcpy(wmclass, title, len * sizeof(char));
|
||||
xclasshint->res_name = wmclass;
|
||||
xclasshint->res_class = wmclass;
|
||||
XSetClassHint(m_display, m_window, xclasshint);
|
||||
|
@ -617,7 +617,7 @@ bool GHOST_WindowX11::getValid() const
|
|||
return GHOST_Window::getValid() && m_valid_setup;
|
||||
}
|
||||
|
||||
void GHOST_WindowX11::setTitle(const STR_String &title)
|
||||
void GHOST_WindowX11::setTitle(const char *title)
|
||||
{
|
||||
Atom name = XInternAtom(m_display, "_NET_WM_NAME", 0);
|
||||
Atom utf8str = XInternAtom(m_display, "UTF8_STRING", 0);
|
||||
|
@ -627,8 +627,8 @@ void GHOST_WindowX11::setTitle(const STR_String &title)
|
|||
utf8str,
|
||||
8,
|
||||
PropModeReplace,
|
||||
(const unsigned char *)title.ReadPtr(),
|
||||
title.Length());
|
||||
(const unsigned char *)title,
|
||||
strlen(title));
|
||||
|
||||
/* This should convert to valid x11 string
|
||||
* and getTitle would need matching change */
|
||||
|
@ -637,13 +637,14 @@ void GHOST_WindowX11::setTitle(const STR_String &title)
|
|||
XFlush(m_display);
|
||||
}
|
||||
|
||||
void GHOST_WindowX11::getTitle(STR_String &title) const
|
||||
std::string GHOST_WindowX11::getTitle() const
|
||||
{
|
||||
char *name = NULL;
|
||||
|
||||
XFetchName(m_display, m_window, &name);
|
||||
title = name ? name : "untitled";
|
||||
std::string title = name ? name : "untitled";
|
||||
XFree(name);
|
||||
return title;
|
||||
}
|
||||
|
||||
void GHOST_WindowX11::getWindowBounds(GHOST_Rect &bounds) const
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
class STR_String;
|
||||
class GHOST_SystemX11;
|
||||
|
||||
#ifdef WITH_XDND
|
||||
|
@ -69,7 +68,7 @@ class GHOST_WindowX11 : public GHOST_Window {
|
|||
*/
|
||||
GHOST_WindowX11(GHOST_SystemX11 *system,
|
||||
Display *display,
|
||||
const STR_String &title,
|
||||
const char *title,
|
||||
GHOST_TInt32 left,
|
||||
GHOST_TInt32 top,
|
||||
GHOST_TUns32 width,
|
||||
|
@ -85,9 +84,9 @@ class GHOST_WindowX11 : public GHOST_Window {
|
|||
|
||||
bool getValid() const;
|
||||
|
||||
void setTitle(const STR_String &title);
|
||||
void setTitle(const char *title);
|
||||
|
||||
void getTitle(STR_String &title) const;
|
||||
std::string getTitle() const;
|
||||
|
||||
void getWindowBounds(GHOST_Rect &bounds) const;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
# ifdef WIN32
|
||||
|
@ -43,7 +44,6 @@
|
|||
#endif // defined(WIN32) || defined(__APPLE__)
|
||||
|
||||
#include "GHOST_Rect.h"
|
||||
#include "STR_String.h"
|
||||
|
||||
#include "GHOST_IEvent.h"
|
||||
#include "GHOST_IEventConsumer.h"
|
||||
|
@ -427,8 +427,7 @@ Application::Application(GHOST_ISystem *system)
|
|||
fApp = this;
|
||||
|
||||
// Create the main window
|
||||
STR_String title1("gears - main window");
|
||||
m_mainWindow = system->createWindow(title1,
|
||||
m_mainWindow = system->createWindow("gears - main window",
|
||||
10,
|
||||
64,
|
||||
320,
|
||||
|
@ -443,8 +442,7 @@ Application::Application(GHOST_ISystem *system)
|
|||
}
|
||||
|
||||
// Create a secondary window
|
||||
STR_String title2("gears - secondary window");
|
||||
m_secondaryWindow = system->createWindow(title2,
|
||||
m_secondaryWindow = system->createWindow("gears - secondary window",
|
||||
340,
|
||||
64,
|
||||
320,
|
||||
|
@ -598,8 +596,7 @@ bool Application::processEvent(GHOST_IEvent *event)
|
|||
|
||||
case GHOST_kKeyW:
|
||||
if (m_mainWindow) {
|
||||
STR_String title;
|
||||
m_mainWindow->getTitle(title);
|
||||
std::string title = m_mainWindow->getTitle();
|
||||
title += "-";
|
||||
m_mainWindow->setTitle(title);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue