Commit Graph

64 Commits

Author SHA1 Message Date
Wouter
fe3fb23697 Automatic DPI for all platforms, per monitor DPI for Windows.
For Windows 8.1 and X11 (Linux, BSD) now use the DPI specified by the operating
system, which previously only worked on macOS. For Windows this is handled per
monitor, for X11 this is based on Xft.dpi or xrandr --dpi. This should result
in appropriate font and button sizes by default in most cases.

The UI has been simplified to a single UI Scale factor relative to the automatic
DPI, instead of two DPI and Virtual Pixel Size settings. There is forward and
backwards compatibility for existing user preferences.

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D2539
2017-03-25 11:22:16 +01:00
Mike Erwin
b10d0058d7 NDOF: compile 3D mouse code only if WITH_INPUT_NDOF
When WITH_INPUT_NDOF is disabled, 3D mouse handling code is removed
from:

- GHOST (was mostly done, finished the job)
- window manager
- various editors
- RNA
- keymaps

The input tab of user prefs does not show 3D mouse settings. Key map
editor does not show NDOF mappings.

DNA does not change.

On my Mac the compiled binary is 42KB smaller after this change. It
runs fine WITH_INPUT_NDOF on or off.
2016-08-18 00:22:18 -04:00
Kévin Dietrich
3e35e32e9d Fix memory leak in GHOST Event Manager.
The events are allocated on the heap, then pushed on a stack. Before
being processed, they are popped from the stack, and deleted after
processing is done. When the manager is destroyed (e.g. application
closing), any remaining event in the stack is detroyed.

Issue is that when the "application closing" event is processed, it is
never freed, because the manager gets destroyed before the call to
`delete` is made and the event is not on the stack anymore.

Now events are left on the stack while they are processed, and only
popped and deleted after processing is done.

As a slight bonus refactor: use void as return type for dispatch events
functions, as no caller is checking the return value, and it is not
clear what it means (suggested by the reviewer).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D1695
2015-12-27 18:08:44 +01:00
Campbell Barton
d9046ccbd4 Cleanup: doxygen comments 2015-07-01 16:30:26 +10:00
Campbell Barton
45b2218341 User Prefs for NDOF dead-zone
D1344 with edits
2015-07-01 13:45:19 +10:00
Campbell Barton
d1f9fcaabc Cleanup: style 2015-04-13 22:08:51 +10:00
Antony Riakiotakis
b5b359b48f Warning messagebox for windows when an unsupported implementation of
OpenGL is detected:

Hoping to decrease the frequency of by far one of the most frequent bug
reports by windows users.

There is some reorganization of the GHOST API to allow easy addition of
further OpenGL options in the future. The change is not propagated too
deep to keep the size of the patch managable. We might reorganize things
here later.

For OpenGL we do two checks here:
One is a combination of GDI generic renderer or vendor microsoft
corporation and OpenGL version 1.1. This means the system does not
use GPU acceleration at all. We warn user to install a graphics
driver and of cases where this might happen (remote connection, using
blender through virtual machine)

The other one just checks if OpenGL version is less than 1.4 (we can
easily change that in the future of course) and warns that it is
deprecated.

Both cases will still let blender startup correctly but users should now
have a clear idea of the system being unsupported.

A user preference flag is provided to turn the warning off.

Now stop posting those bug reports without installing a driver first -
please?
2015-02-25 13:51:53 +01:00
Severin
e81d077c85 Input Method Editor (IME) support for text buttons
Original patch by @random (D765) with some minor work done by @campbell
and me.

At this place, I'd like call out a number of people who were involved and
deserve a big "Thank you!":
* At the first place @randon who developed and submitted the patch
* The Blendercn community which helped a lot with testing - espacially
* @yuzukyo, @leon_cheung and @kjym3
* @campbellbarton, @mont29 and @sergey for their help and advises during
* review
* @ton who realized the importance of this early on and asked me for
* reviewing

We are still not finished, as this is only the first part of the
implementaion, but there's more to come!
2014-12-07 00:58:17 +01:00
Jason Wilkins
8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00
Campbell Barton
88ee650263 Comments 2014-08-16 10:51:07 +10:00
Campbell Barton
d124bd1cd4 Spelling 2014-08-12 10:31:07 +10:00
Campbell Barton
6c0926e802 Code cleanup: use const for mouse location arg 2014-06-14 00:47:12 +10:00
Mitchell Stokes
29f8dfd37a BGE: Adding vsync control. Users can enable vsync, disable vsync, or use adaptive vsync via UI options in the render properties, or by using the new Python method bge.render.setVsync(). Win32 and X11 support are done via EXT_swap_control. Support for using EXT_swap_control on OS X still needs to be added to Ghost. 2013-07-29 22:31:32 +00:00
Campbell Barton
73f301c3a8 add ghost function getAllDisplayDimensions, GHOST_GetAllDisplayDimensions
This returns the desktop size, not just the size of the active monitor, useful since this constrains the mouse and we dont have to detect the active monitor (which isn't so straightforward with xlib).

carbon/cocoa are TODO, they still use getMainDisplayDimensions().
2013-01-31 10:42:26 +00:00
Ton Roosendaal
fa759d8ffd Mac HiDPI ("retina") handling:
OK - so you have this nice crisp screen, and still you want to add extra 
monitors to the laptop! That means Blender should switch back and forth to HiDPI 
modes, when you move a window to another monitor.

This code makes the pixelsize scale factor a window property, and handles
an event when a window moves to another monitor. It then changes the
native pixelsize nicely and refreshes entire UI.

You can also have one Blender window on high, and other on low resolution.

Stretching a Blender window from 1 monitor to the other works too, but that
is Apple magic handling it.
2013-01-12 17:07:49 +00:00
Ton Roosendaal
12b642062c Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability

Short list of main changes:

- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
  Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
  This allows keeping UI and data without actual saves, until you actually save.
  When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v). 
  Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards. 
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
  Old option is called "Save Startup File" the new one "Save User Settings".
  To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
  This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
Campbell Barton
7ef78723b7 code cleanup: doxy comment corrections and correct own typo animation player docs. 2012-11-26 00:59:11 +00:00
Campbell Barton
1541ee20c8 Improvement to own commit r50810.
Add an optional ghost argument to set the new mouse location when un-grabbing. - without this the mouse would flicker at the old location before moving to the new location - when using the color picker for eg.
2012-09-22 13:23:12 +00:00
Campbell Barton
9e742ffc2b style cleanup: also correct some doxy comments 2012-08-18 13:07:48 +00:00
Nicholas Rishel
19011d44cf Doxygen cleanup 2012-07-05 04:47:47 +00:00
Campbell Barton
8b865c01cd style cleanup: comments 2012-06-30 22:49:33 +00:00
Campbell Barton
112b1a0779 style cleanup: ghost headers 2012-05-19 09:23:08 +00:00
Alexander Kuznetsov
ed44ddd816 Patch by Psy-Fi + my minor changes
Adds conformation on exit for windows. Needs to be enabled in user perf.

Tried to edit blender.exe.manifest for more modern dialog look, but didn't work out.
2012-03-16 17:37:45 +00:00
Campbell Barton
47c373c7a9 style cleanup (mostly whitespace) 2012-02-27 10:35:39 +00:00
Campbell Barton
2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Campbell Barton
27074062ab Formatting edits <120 length lines 2011-12-24 02:32:08 +00:00
Campbell Barton
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
Mike Erwin
e75ff53452 migrated NDOF code from soc-2010-merwin, SpaceNavigator now works on Mac blender 2011-06-08 21:18:03 +00:00
Nathan Letwory
d197ec74e3 Fix [#26981] Command window is not opening in 2.57.0
Reported by Thomas Engel
Fix [#26938] Blender Zoom not working after startup (Windows)
  Reported by Ilija Boshkov

by applying patch [#26881] Fix for console disappearing in debug mode [Windows]
  Submitted by Alexander Kuznetsov (AlexK)

The patch moves console toggling code into GHOST and improves on the toggling behaviour.

The patch changes handling of WM_SYSCOMMAND so that alt-key toggling isn't a problem anymore.
2011-05-02 08:07:24 +00:00
Campbell Barton
02a7063a09 fix for blenderplayer crashing on exit.
the event consumer was being freed twice, once when going out of C++ scope, another when freeing the system.
2011-03-26 08:13:42 +00:00
Nathan Letwory
3f96359d5a doxygen: make sure license blocks don't interfere. 2011-02-22 23:40:06 +00:00
Nathan Letwory
f336b80d7f Starting work on doxygen cleanup. Many things still to be done. 2011-02-17 05:57:18 +00:00
Andrea Weikert
195cc9c6a6 ToDo: long outstanding patch to allow access to system paths in background mode
Thanks Damien Plisson for contributing the Carbon and Cocoa implementation
2011-01-05 14:00:14 +00:00
Campbell Barton
263830f000 Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,.
Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into.
2010-12-03 17:05:21 +00:00
Mike Erwin
ad623ddd82 merged 29285:30707 from trunk 2010-07-25 10:09:17 +00:00
Mike Erwin
b86a25efba removed some NDOF plugin-related code 2010-07-22 07:15:00 +00:00
Andrea Weikert
ca81aa704e Patch [#22339] File/installation paths changes
Patch Tracker: http://projects.blender.org/tracker/?func=detail&aid=22339&group_id=9&atid=127

This patch implements the proposal outlined here:
http://wiki.blender.org/index.php/Dev:2.5/Source/Installation/Proposal

Original patch by Matt Ebb.
Contributions by Nathan Letwory, Damien Plisson and Andrea Weikert

NOTE:
This is a work in progress commit, some work still needs to be done on the SCons and CMake files for this to work properly, but at least should compile and the files should be created in the right directory.

Commit discussed on IRC with Ton and Campbell.
2010-07-04 15:35:23 +00:00
Damien Plisson
3f326354b8 Progress indicator in the application icon
Displays a global progress indicator in the application icon reflecting the total progress of all running jobs.

Currently fully implemented on OSX (Cocoa).
On other OSes that do not allow to redraw the app icon, this can be implemented as a [x%] display in the app title, so to appear in the taskbar.

Thanks to Matt for the windowmanager wrapper.
2010-06-01 20:21:40 +00:00
Damien Plisson
fa6beb4302 System dependent standard directory retrieval functions update : return const strings (as coded in libc) instead of malloc'ed buffers
and plug them into wip BLI_bfile.c to replace the hardcoded paths
2010-02-27 17:03:46 +00:00
Guillermo S. Romero
80bb824929 System dependant functions (skeletons) to retrieve user and system base dirs.
Thus #defines in BLI_bfile.c can be dropped, as suggested by Damien Plisson.
Feel free to fill in the non Unix ones. For extra info see:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/ResourceFilePaths
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/EnvironmentVariables
2010-02-15 22:50:53 +00:00
Campbell Barton
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Damien Plisson
75f190bde8 OpenGL Anti-aliasing implementation for blender windows
Added GHOST_TUns16 numOfAASamples parameter to GHOST_CreateWindow to specify the number of AA samples (null if no AA wanted)
Implemented it in the cascade of GHOST classes.

Full implementation currently done for OSX/Cocoa, stubs for other OSes.
Moguri : it's ready for your win32 implementation !

Note that fallback to a non AA window (if gfx card doesn't support AA) is done inside GHOST OS specific layer, so that blender windowmanager still gets its window created properly.
2010-01-06 11:42:52 +00:00
Damien Plisson
169b0cbee9 Drag'n'drop : moved "setAcceptDragOperation" functions at window level
GHOST/Cocoa : changed strings encoding to isoLatin1 (was UTF-8)
2009-11-19 08:56:26 +00:00
Damien Plisson
af2e6c38e9 Drag & drop implementation at GHOST level (only OSX for now)
The dragging sequence is performed in four phases:
 
- Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started. Already gives the object data type, and the entering mouse location

- Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation stops, to give the updated mouse position.
Useful to highlight a potential destination, and update the status (through GHOST_setAcceptDragOperation) telling if the object can be dropped at the current cursor position.

- Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.

- Send the dropped data (GHOST_kEventDraggingDropDone)

- Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon). This can happen when the user drops an object on the application icon. (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)

Note that the event handler is responsible for freeing the received data.
And the mouse position is sent directly in blender client coordinates (y=0 at bottom)

The GHOST_setAcceptDragOperation(TRUE) call must be placed before the user drops the object for it to be accepted.

Current handled data types :
- Text string
- Array of filenames (full paths)
- Bitmap image (not implemented yet)
2009-11-10 12:56:46 +00:00
Campbell Barton
69c6a33ba1 wrap the mouse within the region while grabbing so on release the current view never changes and less likelyhood of loosing the cursor when running blender on 2+ screens. (assuming the 3d view isnt stretched over both) 2009-10-17 19:32:28 +00:00
Campbell Barton
91d89c1ff7 Adjustments to continuous grab
- Use an enum for grab modes rather then boolean options.
 -- GHOST_kGrabNormal: continuous grab userpref disabled
 -- GHOST_kGrabWrap: wrap the mouse at the screen bounds *
 -- GHOST_kGrabHide: hide the mouse while grabbing and restore the mouse where it was initially pressed *

GrabWrap is nice for transform and tools where you want some idea where the cursor is, previously I found both restoring the mouse at its original location and restoring at a clamped location was confusing with operators like transform, wrapping is not ideal but IMHO the best of a bad bunch of options.
GrabHide  is for numbuts, where restoring the mouse at the initial location isnt so confusing.
2009-10-17 14:08:01 +00:00
Campbell Barton
0c857a4f14 - made ungrab a second function - WM_cursor_ungrab
- ungrab can restore the position of the mouse clamped to the window bounds (much nicer for transform)
2009-10-07 21:19:35 +00:00
Campbell Barton
77476b294f Experimental option to allow moving the mouse outside the view, "Continuous Grab" in the user-prefs.
- Useful for dragging buttons to the far right when theyd otherwise hit the screen edge.
- Useful for transform though probably NOT what you want when using the transform manipulator (should make an option).
- When enabled, number buttons use this as well as a different conversion of mouse movement
  float numbuts: mouse 1px == 1-clickstep
  int numbuts: 2px == 1 (tried 1:1 but its too jitter prone)

details...
- access as an option to GHOST_SetCursorGrab(grab, warp)
- Currently all operators that grab use this, could be made an operator flag
- only Ghost/X11 supported currently
2009-10-07 07:11:10 +00:00
Damien Plisson
a344977147 Cocoa port :
- Window creation at preferred size
  Implement in Ghost the use of Cocoa functions to get the maximum visible rect (size and position) for the window contents (all screen excluding dock, top menu, and window title bar)
  Thus Apple specific code in window creation (wm_window.c & wm_apple.c) is no more needed => removed in case of Cocoa build

- Alert on exiting despite unsaved changes
  Add to GHOST method to maintain an all platforms (not apple specific anymore) status on unsaved changes
  Update GHOST_SystemCocoa to use this for asking or not user to confirm exit without saving changes
2009-10-05 12:55:16 +00:00
Brecht Van Lommel
b00409e72d 2.5: X11
* Pass on mouse location on window leave/enter too, fixing some
  issues with button highlights and tooltips.
* When a modal operator runs, grab the mouse cursor so that for
  example transform still works when you move your mouse outside
  of the window, previously it would just stop then. This is
  automatic now for all modal ops, perhaps not always needed?
* Fix for a trailing button highlight issue.
2009-07-09 16:05:01 +00:00