diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 02:58:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-22 02:58:08 +0400 |
commit | 9b515033071b40e982ef647ee225e8afc377e0c9 (patch) | |
tree | b8906cf9d21d2441c6dd0db1b518561def3f8f1a /intern/ghost | |
parent | 049dd8a0ffa94b0d02033877ec99172659b89d8c (diff) |
style cleanup
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_DisplayManagerX11.cpp | 28 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_DropTargetX11.cpp | 18 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemPathsX11.cpp | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 161 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowNULL.h | 4 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 84 |
7 files changed, 153 insertions, 152 deletions
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp index d719a4caa55..84e56799ee0 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp +++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp @@ -48,7 +48,7 @@ GHOST_DisplayManagerX11( GHOST_DisplayManager(), m_system(system) { - //nothing to do. + /* nothing to do. */ } GHOST_TSuccess @@ -87,7 +87,7 @@ getNumDisplaySettings( XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); #else - // We only have one X11 setting at the moment. + /* We only have one X11 setting at the moment. */ GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); numSettings = GHOST_TInt32(1); #endif @@ -144,8 +144,8 @@ getDisplaySetting( setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); #endif - // Don't think it's possible to get this value from X! - // So let's guess!! + /* Don't think it's possible to get this value from X! + * So let's guess!! */ setting.frequency = 60; return GHOST_kSuccess; @@ -171,11 +171,10 @@ setCurrentDisplaySetting( const GHOST_DisplaySetting& setting) { #ifdef WITH_X11_XF86VMODE - // - // Mode switching code ported from Quake 2: - // ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip - // See linux/gl_glx.c:GLimp_SetMode - // + /* Mode switching code ported from Quake 2: + * ftp:/* ftp.idsoftware.com/idstuff/source/q2source-3.21.zip */ + * See linux/gl_glx.c:GLimp_SetMode + */ int majorVersion, minorVersion; XF86VidModeModeInfo **vidmodes; Display *dpy = m_system->getXDisplay(); @@ -187,7 +186,7 @@ setCurrentDisplaySetting( scrnum = DefaultScreen(dpy); - // Get video mode list + /* Get video mode list */ majorVersion = minorVersion = 0; if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { fprintf(stderr, "Error: XF86VidMode extension missing!\n"); @@ -228,20 +227,21 @@ setCurrentDisplaySetting( actualWidth, actualHeight); # endif - // change to the mode + /* change to the mode */ XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); - // Move the viewport to top left + /* Move the viewport to top left */ XF86VidModeSetViewPort(dpy, scrnum, 0, 0); } - else + else { return GHOST_kFailure; + } XFlush(dpy); return GHOST_kSuccess; #else - // Just pretend the request was successful. + /* Just pretend the request was successful. */ return GHOST_kSuccess; #endif } diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp index c1cc55b332a..e2e15277a99 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.cpp +++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp @@ -144,23 +144,23 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char break; } - // We are now converting + /* We are now converting */ state = STATE_CONVERTING; break; case STATE_CONVERTING: bothDigits = true; - // Create a buffer to hold the hex. For example, if %20, this - // buffer would hold 20 (in ASCII) + /* Create a buffer to hold the hex. For example, if %20, this + * buffer would hold 20 (in ASCII) */ memset(tempNumBuf, 0, sizeof(tempNumBuf)); - // Conversion complete (i.e. don't convert again next iter) + /* Conversion complete (i.e. don't convert again next iter) */ state = STATE_SEARCH; strncpy(tempNumBuf, &encodedIn[i], 2); - // Ensure both characters are hexadecimal + /* Ensure both characters are hexadecimal */ for (j = 0; j < 2; ++j) { if (!isxdigit(tempNumBuf[j])) @@ -170,16 +170,16 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char if (!bothDigits) break; - // Convert two hexadecimal characters into one character + /* Convert two hexadecimal characters into one character */ sscanf(tempNumBuf, "%x", &asciiCharacter); - // Ensure we aren't going to overflow + /* Ensure we aren't going to overflow */ assert(strlen(decodedOut) < bufferSize); - // Concatenate this character onto the output + /* Concatenate this character onto the output */ strncat(decodedOut, (char *)&asciiCharacter, 1); - // Skip the next character + /* Skip the next character */ i++; break; } diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp index 83f7e87977c..35bebd588c3 100644 --- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp @@ -38,11 +38,11 @@ #include <sys/time.h> #include <unistd.h> -#include <stdio.h> // for fprintf only -#include <cstdlib> // for exit +#include <stdio.h> /* for fprintf only */ +#include <cstdlib> /* for exit */ -#include <pwd.h> // for get home without use getenv() -#include <limits.h> // for PATH_MAX +#include <pwd.h> /* for get home without use getenv() */ +#include <limits.h> /* for PATH_MAX */ #ifdef PREFIX static const char *static_path = PREFIX "/share"; diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 03a952fafb3..eccfc18eef9 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -32,7 +32,6 @@ * \ingroup GHOST */ - #include "GHOST_SystemX11.h" #include "GHOST_WindowX11.h" #include "GHOST_WindowManager.h" @@ -44,11 +43,11 @@ #include "GHOST_DisplayManagerX11.h" #include "GHOST_EventDragnDrop.h" #ifdef WITH_INPUT_NDOF -#include "GHOST_NDOFManagerX11.h" +# include "GHOST_NDOFManagerX11.h" #endif #ifdef WITH_XDND -#include "GHOST_DropTargetX11.h" +# include "GHOST_DropTargetX11.h" #endif #include "GHOST_Debug.h" @@ -61,20 +60,19 @@ #include <X11/XF86keysym.h> #endif -// For timing - +/* For timing */ #include <sys/time.h> #include <unistd.h> #include <iostream> #include <vector> -#include <stdio.h> // for fprintf only -#include <cstdlib> // for exit +#include <stdio.h> /* for fprintf only */ +#include <cstdlib> /* for exit */ static GHOST_TKey convertXKey(KeySym key); -//these are for copy and select copy +/* these are for copy and select copy */ static char *txt_cut_buffer = NULL; static char *txt_select_buffer = NULL; @@ -90,7 +88,7 @@ GHOST_SystemX11( if (!m_display) { std::cerr << "Unable to open a display" << std::endl; - abort(); //was return before, but this would just mean it will crash later + abort(); /* was return before, but this would just mean it will crash later */ } #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) @@ -128,13 +126,13 @@ GHOST_SystemX11( m_last_warp = 0; - // compute the initial time + /* compute the initial time */ timeval tv; if (gettimeofday(&tv, NULL) == -1) { GHOST_ASSERT(false, "Could not instantiate timer!"); } - // Taking care not to overflow the tv.tv_sec*1000 + /* Taking care not to overflow the tv.tv_sec*1000 */ m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000; @@ -190,7 +188,7 @@ getMilliSeconds() const GHOST_ASSERT(false, "Could not compute time!"); } - // Taking care not to overflow the tv.tv_sec*1000 + /* Taking care not to overflow the tv.tv_sec*1000 */ return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time; } @@ -254,16 +252,16 @@ createWindow( - window = new GHOST_WindowX11( - this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual - ); + window = new GHOST_WindowX11(this, m_display, title, + left, top, width, height, + state, parentWindow, type, stereoVisual); if (window) { - // Both are now handle in GHOST_WindowX11.cpp - // Focus and Delete atoms. + /* Both are now handle in GHOST_WindowX11.cpp + * Focus and Delete atoms. */ if (window->getValid()) { - // Store the pointer to the window + /* Store the pointer to the window */ m_windowManager->addWindow(window); m_windowManager->setActiveWindow(window); pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); @@ -313,10 +311,10 @@ findGhostWindow( if (xwind == 0) return NULL; - // It is not entirely safe to do this as the backptr may point - // to a window that has recently been removed. - // We should always check the window manager's list of windows - // and only process events on these windows. + /* It is not entirely safe to do this as the backptr may point + * to a window that has recently been removed. + * We should always check the window manager's list of windows + * and only process events on these windows. */ vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); @@ -411,8 +409,8 @@ GHOST_SystemX11:: processEvents( bool waitForEvent) { - // Get all the current events -- translate them into - // ghost events and call base class pushEvent() method. + /* Get all the current events -- translate them into + * ghost events and call base class pushEvent() method. */ bool anyProcessed = false; @@ -519,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe) XExposeEvent & xee = xe->xexpose; if (xee.count == 0) { - // Only generate a single expose event - // per read of the event queue. + /* Only generate a single expose event + * per read of the event queue. */ g_event = new GHOST_Event( @@ -761,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) break; } - // change of size, border, layer etc. + /* change of size, border, layer etc. */ case ConfigureNotify: { /* XConfigureEvent & xce = xe->xconfigure; */ @@ -780,12 +778,11 @@ GHOST_SystemX11::processEvent(XEvent *xe) { XFocusChangeEvent &xfe = xe->xfocus; - // TODO: make sure this is the correct place for activate/deactivate + /* TODO: make sure this is the correct place for activate/deactivate */ // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); - // May have to look at the type of event and filter some - // out. - + /* May have to look at the type of event and filter some out. */ + GHOST_TEventType gtype = (xfe.type == FocusIn) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; @@ -860,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) case DestroyNotify: ::exit(-1); - // We're not interested in the following things.(yet...) + /* We're not interested in the following things.(yet...) */ case NoExpose: case GraphicsExpose: break; @@ -945,8 +942,12 @@ GHOST_SystemX11::processEvent(XEvent *xe) nxe.xselection.target = xse->target; nxe.xselection.time = xse->time; - /*Check to see if the requestor is asking for String*/ - if (xse->target == utf8_string || xse->target == string || xse->target == compound_text || xse->target == c_string) { + /* Check to see if the requestor is asking for String */ + if (xse->target == utf8_string || + xse->target == string || + xse->target == compound_text || + xse->target == c_string) + { if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) { XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char *)txt_select_buffer, strlen(txt_select_buffer)); @@ -968,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe) XFlush(m_display); } else { - //Change property to None because we do not support anything but STRING + /* Change property to None because we do not support anything but STRING */ nxe.xselection.property = None; } - //Send the event to the client 0 0 == False, SelectionNotify + /* Send the event to the client 0 0 == False, SelectionNotify */ XSendEvent(m_display, xse->requestor, 0, 0, &nxe); XFlush(m_display); break; @@ -1023,14 +1024,14 @@ getModifierKeys( GHOST_ModifierKeys& keys) const { - // analyse the masks retuned from XQueryPointer. + /* analyse the masks retuned from XQueryPointer. */ memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector)); XQueryKeymap(m_display, (char *)m_keyboard_vector); - // now translate key symobols into keycodes and - // test with vector. + /* now translate key symobols into keycodes and + * test with vector. */ const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L); const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R); @@ -1041,16 +1042,16 @@ getModifierKeys( const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L); const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R); - // shift + /* shift */ keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0); - // control + /* control */ keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0); - // alt + /* alt */ keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0); - // super (windows) - only one GHOST-kModifierKeyOS, so mapping to either + /* super (windows) - only one GHOST-kModifierKeyOS, so mapping to either */ keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0); @@ -1123,9 +1124,9 @@ setCursorPosition( GHOST_TInt32 y ) { - // This is a brute force move in screen coordinates - // XWarpPointer does relative moves so first determine the - // current pointer position. + /* This is a brute force move in screen coordinates + * XWarpPointer does relative moves so first determine the + * current pointer position. */ int cx, cy; if (getCursorPosition(cx, cy) == GHOST_kFailure) { @@ -1336,15 +1337,15 @@ convertXKey(KeySym key) /* from xclip.c xcout() v0.11 */ -#define XCLIB_XCOUT_NONE 0 /* no context */ +#define XCLIB_XCOUT_NONE 0 /* no context */ #define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */ -#define XCLIB_XCOUT_INCR 2 /* in an incr loop */ +#define XCLIB_XCOUT_INCR 2 /* in an incr loop */ #define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */ #define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */ #define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */ #define XCLIB_XCOUT_FALLBACK_TEXT 6 -// Retrieves the contents of a selections. +/* Retrieves the contents of a selections. */ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, unsigned int *context) const @@ -1361,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, Window win = window->getXWindow(); switch (*context) { - // There is no context, do an XConvertSelection() + /* There is no context, do an XConvertSelection() */ case XCLIB_XCOUT_NONE: - // Initialise return length to 0 + /* Initialise return length to 0 */ if (*len > 0) { free(*txt); *len = 0; } - // Send a selection request + /* Send a selection request */ XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime); *context = XCLIB_XCOUT_SENTCONVSEL; return; @@ -1391,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, return; } - // find the size and format of the data in property + /* find the size and format of the data in property */ XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, &buffer); XFree(buffer); if (pty_type == m_incr) { - // start INCR mechanism by deleting property + /* start INCR mechanism by deleting property */ XDeleteProperty(m_display, win, m_xclip_out); XFlush(m_display); *context = XCLIB_XCOUT_INCR; return; } - // if it's not incr, and not format == 8, then there's - // nothing in the selection (that xclip understands, anyway) + /* if it's not incr, and not format == 8, then there's + * nothing in the selection (that xclip understands, anyway) */ if (pty_format != 8) { *context = XCLIB_XCOUT_NONE; @@ -1418,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, &buffer); - // finished with property, delete it + /* finished with property, delete it */ XDeleteProperty(m_display, win, m_xclip_out); - // copy the buffer to the pointer for returned data + /* copy the buffer to the pointer for returned data */ ltxt = (unsigned char *) malloc(pty_items); memcpy(ltxt, buffer, pty_items); - // set the length of the returned data + /* set the length of the returned data */ *len = pty_items; *txt = ltxt; - // free the buffer + /* free the buffer */ XFree(buffer); *context = XCLIB_XCOUT_NONE; - // complete contents of selection fetched, return 1 + /* complete contents of selection fetched, return 1 */ return; case XCLIB_XCOUT_INCR: - // To use the INCR method, we basically delete the - // property with the selection in it, wait for an - // event indicating that the property has been created, - // then read it, delete it, etc. + /* To use the INCR method, we basically delete the + * property with the selection in it, wait for an + * event indicating that the property has been created, + * then read it, delete it, etc. */ - // make sure that the event is relevant + /* make sure that the event is relevant */ if (evt.type != PropertyNotify) return; - // skip unless the property has a new value + /* skip unless the property has a new value */ if (evt.xproperty.state != PropertyNewValue) return; - // check size and format of the property + /* check size and format of the property */ XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, (unsigned char **) &buffer); if (pty_format != 8) { - // property does not contain text, delete it - // to tell the other X client that we have read - // it and to send the next property + /* property does not contain text, delete it + * to tell the other X client that we have read + * it and to send the next property */ XFree(buffer); XDeleteProperty(m_display, win, m_xclip_out); return; } if (pty_size == 0) { - // no more data, exit from loop + /* no more data, exit from loop */ XFree(buffer); XDeleteProperty(m_display, win, m_xclip_out); *context = XCLIB_XCOUT_NONE; - // this means that an INCR transfer is now - // complete, return 1 + /* this means that an INCR transfer is now + * complete, return 1 */ return; } XFree(buffer); - // if we have come this far, the propery contains - // text, we know the size. + /* if we have come this far, the propery contains + * text, we know the size. */ XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size, False, AnyPropertyType, &pty_type, &pty_format, &pty_items, &pty_size, (unsigned char **) &buffer); - // allocate memory to accommodate data in *txt + /* allocate memory to accommodate data in *txt */ if (*len == 0) { *len = pty_items; ltxt = (unsigned char *) malloc(*len); @@ -1494,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, ltxt = (unsigned char *) realloc(ltxt, *len); } - // add data to ltxt + /* add data to ltxt */ memcpy(<xt[*len - pty_items], buffer, pty_items); *txt = ltxt; XFree(buffer); - // delete property to get the next item + /* delete property to get the next item */ XDeleteProperty(m_display, win, m_xclip_out); XFlush(m_display); return; @@ -1514,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const Atom target = m_utf8_string; Window owner; - // from xclip.c doOut() v0.11 + /* from xclip.c doOut() v0.11 */ unsigned char *sel_buf; unsigned long sel_len = 0; XEvent evt; diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h index dcbb7d2b346..e3d092101b0 100644 --- a/intern/ghost/intern/GHOST_WindowNULL.h +++ b/intern/ghost/intern/GHOST_WindowNULL.h @@ -81,9 +81,9 @@ protected: GHOST_TSuccess activateDrawingContext( ) { return GHOST_kFailure; } ~GHOST_WindowNULL( ) { /* nothing */ } GHOST_TSuccess setWindowCursorVisibility( bool visible ) { return GHOST_kSuccess; } - GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } + GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; } - GHOST_TSuccess invalidate() { return GHOST_kSuccess; } + GHOST_TSuccess invalidate() { return GHOST_kSuccess; } GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index e3fe28e2e64..3a6e646de11 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1343,7 +1343,7 @@ static int EnumPixelFormats(HDC hdc) ::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); w = WeightPixelFormat(pfd); // be strict on stereo - if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { + if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { if (w > weight) { weight = w; iPixelFormat = i; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 80d5b5a4652..3dc10d17169 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -39,7 +39,7 @@ #include "GHOST_DropTargetX11.h" #endif -// For standard X11 cursors +/* For standard X11 cursors */ #include <X11/cursorfont.h> #include <X11/Xatom.h> @@ -53,8 +53,8 @@ #include <algorithm> #include <string> -// For obscure full screen mode stuuf -// lifted verbatim from blut. +/* For obscure full screen mode stuuf + * lifted verbatim from blut. */ typedef struct { long flags; @@ -95,7 +95,7 @@ typedef struct { f.write('\n') */ -// See the python script above to regenerate the 48x48 icon within blender +/* See the python script above to regenerate the 48x48 icon within blender */ #define BLENDER_ICON_WIDTH 48 #define BLENDER_ICON_HEIGHT 48 static unsigned char BLENDER_ICON_48x48x24[] = { @@ -178,13 +178,13 @@ GHOST_WindowX11( m_custom_cursor(None) { - // Set up the minimum atrributes that we require and see if - // X can find us a visual matching those requirements. + /* Set up the minimum atrributes that we require and see if + * X can find us a visual matching those requirements. */ int attributes[40], i, samples; Atom atoms[2]; int natom; - int glxVersionMajor, glxVersionMinor; // As in GLX major.minor + int glxVersionMajor, glxVersionMinor; /* As in GLX major.minor */ #ifdef WITH_X11_XINPUT /* initialize incase X11 fails to load */ @@ -251,11 +251,11 @@ GHOST_WindowX11( } } - // Create a bunch of attributes needed to create an X window. + /* Create a bunch of attributes needed to create an X window. */ - // First create a colormap for the window and visual. - // This seems pretty much a legacy feature as we are in rgba mode anyway. + /* First create a colormap for the window and visual. + * This seems pretty much a legacy feature as we are in rgba mode anyway. */ XSetWindowAttributes xattributes; memset(&xattributes, 0, sizeof(xattributes)); @@ -268,7 +268,7 @@ GHOST_WindowX11( xattributes.border_pixel = 0; - // Specify which events we are interested in hearing. + /* Specify which events we are interested in hearing. */ xattributes.event_mask = ExposureMask | StructureNotifyMask | @@ -277,7 +277,7 @@ GHOST_WindowX11( ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask | PropertyChangeMask; - // create the window! + /* create the window! */ ; if (parentWindow == 0) { @@ -287,7 +287,7 @@ GHOST_WindowX11( top, width, height, - 0, // no border. + 0, /* no border. */ m_visual->depth, InputOutput, m_visual->visual, @@ -311,12 +311,12 @@ GHOST_WindowX11( m_window = XCreateWindow(m_display, - parentWindow, // reparent against embedder + parentWindow, /* reparent against embedder */ left, top, width, height, - 0, // no border. + 0, /* no border. */ m_visual->depth, InputOutput, m_visual->visual, @@ -353,9 +353,9 @@ GHOST_WindowX11( m_post_init = False; m_post_state = GHOST_kWindowStateNormal; } - - // Create some hints for the window manager on how - // we want this window treated. + + /* Create some hints for the window manager on how + * we want this window treated. */ XSizeHints *xsizehints = XAllocSizeHints(); xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize; @@ -363,8 +363,8 @@ GHOST_WindowX11( xsizehints->y = top; xsizehints->width = width; xsizehints->height = height; - xsizehints->min_width = 320; // size hints, could be made apart of the ghost api - xsizehints->min_height = 240; // limits are also arbitrary, but should not allow 1x1 window + xsizehints->min_width = 320; /* size hints, could be made apart of the ghost api */ + xsizehints->min_height = 240; /* limits are also arbitrary, but should not allow 1x1 window */ xsizehints->max_width = 65535; xsizehints->max_height = 65535; XSetWMNormalHints(m_display, m_window, xsizehints); @@ -404,7 +404,7 @@ GHOST_WindowX11( m_xic = NULL; #endif - // Set the window icon + /* Set the window icon */ XWMHints *xwmhints = XAllocWMHints(); XImage *x_image, *mask_image; Pixmap icon_pixmap, mask_pixmap; @@ -442,7 +442,7 @@ GHOST_WindowX11( XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); - // Now the pixmap is ok to assign to the window as a hint + /* Now the pixmap is ok to assign to the window as a hint */ xwmhints->icon_pixmap = icon_pixmap; xwmhints->icon_mask = mask_pixmap; XFreeGC(display, gc_icon); @@ -455,7 +455,7 @@ GHOST_WindowX11( xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint; XSetWMHints(display, m_window, xwmhints); XFree(xwmhints); - // done setting the icon + /* done setting the icon */ setTitle(title); @@ -463,7 +463,7 @@ GHOST_WindowX11( initXInputDevices(); #endif - // now set up the rendering context. + /* now set up the rendering context. */ if (installDrawingContext(type) == GHOST_kSuccess) { m_valid_setup = true; GHOST_PRINT("Created window\n"); @@ -748,8 +748,8 @@ setTitle( (const unsigned char *) title.ReadPtr(), title.Length()); -// This should convert to valid x11 string -// and getTitle would need matching change + /* This should convert to valid x11 string + * and getTitle would need matching change */ XStoreName(m_display, m_window, title); XFlush(m_display); @@ -772,8 +772,8 @@ GHOST_WindowX11:: getWindowBounds( GHOST_Rect& bounds) const { - // Getting the window bounds under X11 is not - // really supported (nor should it be desired). + /* Getting the window bounds under X11 is not + * really supported (nor should it be desired). */ getClientBounds(bounds); } @@ -848,7 +848,7 @@ screenToClient( GHOST_TInt32& outX, GHOST_TInt32& outY) const { - // This is correct! + /* This is correct! */ int ax, ay; Window temp; @@ -1274,18 +1274,18 @@ GHOST_TSuccess GHOST_WindowX11:: invalidate() { - // So the idea of this function is to generate an expose event - // for the window. - // Unfortunately X does not handle expose events for you and - // it is the client's job to refresh the dirty part of the window. - // We need to queue up invalidate calls and generate GHOST events - // for them in the system. - - // We implement this by setting a boolean in this class to concatenate - // all such calls into a single event for this window. - - // At the same time we queue the dirty windows in the system class - // and generate events for them at the next processEvents call. + /* So the idea of this function is to generate an expose event + * for the window. + * Unfortunately X does not handle expose events for you and + * it is the client's job to refresh the dirty part of the window. + * We need to queue up invalidate calls and generate GHOST events + * for them in the system. + * + * We implement this by setting a boolean in this class to concatenate + * all such calls into a single event for this window. + * + * At the same time we queue the dirty windows in the system class + * and generate events for them at the next processEvents call. */ if (m_invalid_window == false) { m_system->addDirtyWindow(this); @@ -1384,7 +1384,7 @@ GHOST_WindowX11:: installDrawingContext( GHOST_TDrawingContextType type) { - // only support openGL for now. + /* only support openGL for now. */ GHOST_TSuccess success; switch (type) { case GHOST_kDrawingContextTypeOpenGL: |