0

I've got this cute little program (default Xcode Mac app, with this as the ViewController.swift):

import Cocoa

class ViewController: NSViewController {
    @IBOutlet var button: NSButton!

    @IBAction func clicked(_ sender: Any) {
        if button.contentFilters.isEmpty {
            button.contentFilters = [CIFilter(name: "CIGaussianBlur",
                                              parameters: ["inputRadius": 1])!]
        } else {
            button.contentFilters = []
        }
    }
}

The Main.storyboard has just one button, and it's hooked up to both the IBOutlet and IBAction here. When you click it, it turns blurry.

In Mojave's dark mode, though, toggling this also changes the entire style of the window. It becomes even darker, and less transparent.

Why? Is there a way to stop this? I want to continue to use contentFilters, but I don't want changing one little view to change the look of the whole window.

It seems that setting any non-empty contentFilters, on any NSView anywhere in the window, changes the whole window. I really have no idea what to try, or why this might be happening. I'm not even sure what words to use to describe what's happening to the window!

Is there any way to stop this from happening? Or at least turn it on permanently, so changing contentFilters doesn't mess up everything?

Stylin
  • 11
  • 2
  • Most probably a bug that you can report at https://bugreport.apple.com – Marek H Feb 16 '19 at 18:41
  • I've reported it, but (1) I'm not sure it is a bug, and (2) a fix in 10.15 won't help me for another year. – Stylin Feb 18 '19 at 15:24
  • Also have a look at "layerUsesCoreImageFilters" and try to set it YES. There is also some documentation comment. But it should be a bug. You can only find workarounds. – Marek H Feb 18 '19 at 16:54
  • The documentation for that property says it's automatic if you assign via `contentFilters`, and will throw an exception if it's NO but shouldn't be, so I fail to see how that could help me. – Stylin Feb 18 '19 at 20:29

0 Answers0