Commit Graph

59 Commits

Author SHA1 Message Date
Brecht Van Lommel
c43473e884 Cleanup: remove GHOST API to query tablet state from Window
It's not used by Blender anymore and it's unreliable since this state really
only makes sense associated with events in a particular order.

Ref D6675
2020-04-08 12:25:40 +02:00
Dalai Felinto
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
2e9d5ba211 GHOST: bundle tablet data with GHOST event
Previously the window manager would receive the GHOST event and then query the
latest tablet data from the window to go along with it. If multiple events were
queued, it would then use too new tablet data for handling older events.

Fixes T62565: tablet pressure not working on macOS with some devices
2020-01-21 12:24:01 +01:00
Julian Eisel
edffb0e9b1 UI: Register File Browser as Child/Dialog-Window for the OS
For many users, this will make the File Browser window behave more like
what they would expect. It addresses the issue of the File Browser
becoming hidden behind the main window by clicking anywhere in the
latter. It communicates the interruptive, but temporary nature of the
operation a bit better.
Further, on tiling window managers the File Browser now opens as
floating by default, like in other applications.

Note that this also makes sure the File Browser is always opened as
separate window, so it doesn't re-use the Preferences, or any other
temporary window anymore. This seems to have been a common annoyance.

More concretely, this makes the File Browser window behave as follows:
* Stays on top of its parent Blender window, but not on top of
  non-Blender windows.
* Minimizes with its parent window
* Can be moved independently
* Doesn't add an own item in task bars
* Doesn't block other Blender windows (we may want to have this though)
* Opens as floating window for tiling window managers (e.g. i3wm/Sway)

Further notes:
* When opening a file browser from the Preference window (or any
  temporary window), the main window, as the file browsers parent is
  moved on top of the Preferences, which makes it seem like the
  Preferences were closed. This is the general issue of bad secondary
  window handling as window activation changes. I made it so that the
  window is moved back once the file browser is closed.
  This behavior is confusing and would be nice to avoid. It's a separate
  issue though.
* On most window managers on Linux the temporary window can not be
  minimized and maximized, they disable that for dialog windows.
* On Windows and macOS, only minimizing is disabled, as there is no
  decent way yet to restore a window if it's not shown in the taskbar.

Reviewed By: Brecht van Lommel, Campbell Barton, William Reynish
Edits and macOS implementation by Brecht.

Differential Revision: https://developer.blender.org/D5810

Part of T69652.
2019-10-03 17:50:27 +02:00
6292cab193 GHOST: add GHOST_HasWindowCursorShape() to test if standard cursor exists
Ref D5197
2019-09-26 14:31:43 +02:00
087a489867 Cleanup: simplify GHOST cursor API, no functional changes 2019-06-16 19:58:26 +02:00
Tomoaki Kawada
62fe7e9a9d GPU: support default framebuffer with ID not equal to 0 2019-06-02 12:50:50 +02:00
Campbell Barton
e4ac8ab212 WM: support X/Y axis cursor wrapping
Operator flags to wrap on a single axis.

D4865 by @Gvgeo with updates.

Resolves T64585
2019-05-29 00:52:43 +10:00
Campbell Barton
5b1fcf8833 Cleanup: comments (long lines) in ghost 2019-05-01 20:32:38 +10:00
mano-wii
eda7e84aac GHOST: remove OpenGL depth buffer, remove code for other unused buffers
Viewport drawing has moved to offscreen buffers, and we no longer need to have
depth, stencil, aa samples, sRGB buffers as part of the window. So all that
code is removed now. The depth buffer was the only one still being allocated,
its removal save a bit of memory.

Code by Germano and Brecht.

Differential Revision: https://developer.blender.org/D4708
2019-04-25 14:29:26 +02:00
Campbell Barton
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Campbell Barton
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
Campbell Barton
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
Campbell Barton
4ef09cf937 Cleanup: remove author/date info from doxy headers 2019-02-02 11:58:24 +11:00
Campbell Barton
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton
af36dd4664 Cleanup: trailing newlines 2018-06-29 08:02:49 +02:00
Campbell Barton
58e8c71cbd Cleanup: strip ghost trailing space 2018-06-04 18:47:57 +02:00
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
Campbell Barton
d9046ccbd4 Cleanup: doxygen comments 2015-07-01 16:30:26 +10:00
Sergey Sharybin
90f645855a GHost: Code cleanup, prepare for strict C++ flags 2015-03-27 18:23:31 +05: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
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
630a31a900 fix for fullscreen on X11 (used by the BGE, not blender application),
changing the screen resolution wasn't still allowed for larger virtual desktops.

added an exclusive option to ghost so the fullscreen window is ignored by the window manager and we get all events. (common practice for games on X11).
2013-02-24 05:05:29 +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
Campbell Barton
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +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
47ec91e8d3 code clenup: comments and some style edits on ghost/osx (odd indentation) 2012-09-06 02:10:09 +00:00
Campbell Barton
a199ae5368 style cleanup: whitespace, also add '?' to save over popup since it wasnt totally clear it was a question (user pointed this out, they thought it was just notification and lost their work). 2012-07-31 23:06:12 +00:00
Campbell Barton
8b865c01cd style cleanup: comments 2012-06-30 22:49:33 +00:00
Campbell Barton
cc0784c1b9 optionally use guarded alloc for tiles compositor, also replace allocation functions with a macro. 2012-06-25 09:14:37 +00:00
Campbell Barton
112b1a0779 style cleanup: ghost headers 2012-05-19 09:23:08 +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
Nathan Letwory
b15161a2d3 doxygen: fixup and tag intern/ghost. 2011-02-25 11:28:33 +00:00
Nathan Letwory
3f96359d5a doxygen: make sure license blocks don't interfere. 2011-02-22 23:40:06 +00:00
Campbell Barton
3e7469cd01 Added WITH_CXX_GUARDEDALLOC support for GHOST, disabled by default. 2010-12-07 11:57:34 +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
Campbell Barton
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
Damien Plisson
e4882e3da2 Cocoa : correctly handle late events sent after window deactivate
Cocoa can still send events (tagged with the correct NSWindow handle) after having sent the window deactivate event.
This caused these events being discarded as there was no active window for GHOST_WindowManager.

Fix is to use this NSWindow handle to retrieve the target window and correctly push the event.

E.g. of effects of this bug: OSKey modifier stuck after having invoked Spotlight through its shortcut (Cmd + Space). This gave the impression the Blender window has not got focus back for the keyboard.

Ton, can you confirm if this fixes the "Cocoa window loses focus permanently on using Spotlight" issue you found ?
2010-01-28 19:18:36 +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
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
a2a04bab8a 2.5: fix for last commit, left in debug print. 2009-07-09 18:10:35 +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