Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing glitch on custom titlebar click #2549

Closed
lumenian opened this issue Aug 29, 2021 · 9 comments · Fixed by #5966
Closed

Resizing glitch on custom titlebar click #2549

lumenian opened this issue Aug 29, 2021 · 9 comments · Fixed by #5966

Comments

@lumenian
Copy link

Describe the bug

On Windows clicking on an edge of a custom titlebar (data-tauri-drag-region region), when the resize cursor appears, triggers a resize animation and double clicking triggers a weird change of the window's position and size. After that the app gets unresponsive.

To Reproduce

  1. On Windows launch a Tauri app with "decorations": false and a custom titlebar made with data-tauri-drag-region attribute.
  2. Click once on the titlebar's outer edge - expect resize animation.
  3. Double click in the same manner - expect weird window's position and size change.
  4. After step 3 you can try blurring the window and focusing it again - expect to see a weird split of the window into two separate parts.
  5. Minimizing and then maximizing through a task bar seems to restore the app's responsiveness.

Screenshots

Steps 2 and 3 demonstration:

first

Platform and Versions:

Operating System - Windows, version 10.0.19043 X64
Webview2 - 92.0.902.84

Node.js environment
  Node.js - 14.15.0
  @tauri-apps/cli - 1.0.0-beta.10
  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 6.14.8
  yarn - 1.22.11

Rust environment
  rustc - 1.54.0
  cargo - 1.54.0

App directory structure
/.git
/.vscode
/dist
/node_modules
/src
/src-tauri

App
  tauri.rs - 1.0.0-beta.7
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../dist
  devPath - http://localhost:3000

Additional context

I couldn't reproduce the issue on Wry custom_titlebar example. A couple of people in Discord managed to reproduce the issue on Tauri.

@lumenian lumenian changed the title Resizing glitches on custom titlebar click Resizing glitch on custom titlebar click Aug 29, 2021
@fnky
Copy link

fnky commented Sep 26, 2021

Just wanted to chime in with a similar bug on macOS with similar configuration (decoration: false + data-tauri-drag-region attribute).

  1. The frameless window seems to extend beyond the viewport as seen in the video, by clicking outside the frame will focus the window.
  2. Minimizing and maximizing the window shows the native window frame for a split second.
Untitled-optim.mov

Note that the controls seen in the video are not native controls.

@BenJeau
Copy link

BenJeau commented Oct 22, 2021

Want to also pitch in a resizing mouse cursor glitch using decoration: false + data-tauri-drag-region attribute. I'm running Ubuntu 21.04 (using GTK as my desktop env) and it seems that the mouse icon does not properly change to the right one when hovering the sides - not entirely sure if this is a bug, but wanted to pitch in the anomaly that I saw.

tauri-borderless

@amrbashir
Copy link
Member

amrbashir commented Oct 22, 2021

@BenJeau for hovering it is fixed in the next release but once the drag starts, it will revert back.

@amrbashir
Copy link
Member

I can't reproduce this anymore, please upgrade to latest tauri and reopen if you still encounter the bug.

@aaronleopold
Copy link

I still have this issue on 1.0.0-rc.6, can provide video if needed but pretty much exactly as the others above.

@marc2332
Copy link
Member

It still happens on v1.1.1 (compiling on release or debug doesn't make a difference)

2022-09-17.11-20-22.mp4

@rikzun
Copy link

rikzun commented Feb 26, 2024

I have a similar problem

video.mp4

@Tmktahu
Copy link

Tmktahu commented Feb 27, 2024

I have a similar problem

I also am experiencing the same behavior. No clue how to approach fixing it. At the moment I'm hoping to somehow find a way to add some kind of resize-handle to a corner of the window.

@rikzun
Copy link

rikzun commented Feb 28, 2024

@Tmktahu I managed to fix it a lil

video.2.mp4
Code
export function Projects() {
    const ctx = useAppContext()

    function windowMove(e: MouseEvent, isMaximized: boolean) {
        const target = e.target as HTMLDivElement
        if (target.dataset.whdnl == null) return

        if (!isMaximized) {
            const size = (e.target as HTMLDivElement).getBoundingClientRect()
            if (e.pageX < size.left + 5 || e.pageX > size.right - 5) return
            if (e.pageY < size.top + 5 || e.pageY > size.bottom - 5) return
        }

        appWindow.startDragging()
    }

    return (
        <div class="projects-page" onMouseDown={(e) => windowMove(e, ctx.app.isMaximized)} data-whdnl>
            <div class="titlebar" data-whdnl>
                <TitlebarButtons />
            </div>
            <div class="top-container noselect" data-whdnl>
                <div class="title" data-whdnl>
                    CSV TRANSLATOR
                </div>
            </div>
            <div class="main-container noselect" data-whdnl>
                <div class="column" data-whdnl>
                    <div class="title" data-whdnl>
                        Recent
                    </div>
                </div>
                <div class="column" data-whdnl>
                    <div class="title" data-whdnl>
                        Get started
                    </div>
                </div>
            </div>
        </div>
    )
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants