Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix Windows clipboard handling #17706

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

stuartmorgan-g
Copy link
Contributor

Fixes several bugs in the clipboard code, and makes some structural
improvements:

  • Adds scoped wrappers for clipboard open/close and global lock/unlock,
    to prevent missing cleanup, fixing at least one case where the lock
    was not released.
  • Adds the relevant window handle to the clipboard calls, since the docs
    suggest that some operations won't work without one.
  • Adds a missing clear step to setting the clipboard data.
  • Switches from TEXT to UNICODETEXT to handle non-ASCII text correctly.
    • To enable that, adds UTF-16/-8 conversion utilities built on the
      Win32 APIs (rather than the deprecated std::codecvt functions, as
      have been previously used in the engine).
  • Fixes handling of getting data when the clipboard is empty, correctly
    returning null.
  • Passes more errors back through the method channel, with details, for
    easier debugging of future issues.

Fixes flutter/flutter#54226

Fixes several bugs in the clipboard code, and makes some structural
improvements:
- Adds scoped wrappers for clipboard open/close and global lock/unlock,
  to prevent missing cleanup, fixing at least one case where the lock
  was not released.
- Adds the relevant window handle to the clipboard calls, since the docs
  suggest that some operations won't work without one.
- Adds a missing clear step to setting the clipboard data.
- Switches from TEXT to UNICODETEXT to handle non-ASCII text correctly.
  - To enable that, adds UTF-16/-8 conversion utilities built on the
    Win32 APIs (rather than the deprecated std::codecvt functions, as
    have been previously used in the engine).
- Fixes handling of getting data when the clipboard is empty, correctly
  returning null.
- Passes more errors back through the method channel, with details, for
  easier debugging of future issues.

Fixes flutter/flutter#54226
@stuartmorgan-g stuartmorgan-g merged commit 7498dc2 into flutter:master Apr 15, 2020
@stuartmorgan-g stuartmorgan-g deleted the windows-clipboard-fix branch April 15, 2020 14:03
goderbauer pushed a commit to goderbauer/engine that referenced this pull request Apr 16, 2020
Fixes several bugs in the clipboard code, and makes some structural
improvements:
- Adds scoped wrappers for clipboard open/close and global lock/unlock,
  to prevent missing cleanup, fixing at least one case where the lock
  was not released.
- Adds the relevant window handle to the clipboard calls, since the docs
  suggest that some operations won't work without one.
- Adds a missing clear step to setting the clipboard data.
- Switches from TEXT to UNICODETEXT to handle non-ASCII text correctly.
  - To enable that, adds UTF-16/-8 conversion utilities built on the
    Win32 APIs (rather than the deprecated std::codecvt functions, as
    have been previously used in the engine).
- Fixes handling of getting data when the clipboard is empty, correctly
  returning null.
- Passes more errors back through the method channel, with details, for
  easier debugging of future issues.

Fixes flutter/flutter#54226
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clipboard does not work in Flutter Windows
3 participants