File: wm_move_resize_handler.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (64 lines) | stat: -rw-r--r-- 2,674 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_PLATFORM_WINDOW_WM_WM_MOVE_RESIZE_HANDLER_H_
#define UI_PLATFORM_WINDOW_WM_WM_MOVE_RESIZE_HANDLER_H_

#include "base/component_export.h"

namespace gfx {
class Point;
}  // namespace gfx

namespace ui {

class PlatformWindow;

class COMPONENT_EXPORT(WM) WmMoveResizeHandler {
 public:
  // A system window manager starts interactive drag or resize of a window based
  // on the |hittest| value. The |hittest| value identifies in which direction
  // the window should be resized or whether it should be moved. See
  // ui/base/hit_test.h for a concrete example with chromium symbolic names
  // defined. The |pointer_location_in_px| indicates the position of the button
  // press with respect to the platform window in screen pixel coordinates,
  // which is needed when sending a move/resize request in such backends as X11.
  // See _NET_WM_MOVERESIZE section in
  // https://specifications.freedesktop.org/wm-spec/1.4/ar01s04.html.
  //
  // There is no need to implement this by all the platforms except Ozone/X11
  // and Ozone/Wayland, compositors of which support interactive move/resize.
  //
  // This API must be used on mouse or touch events, which are targeted for
  // non-client components (check ui/base/hit_test.h again) except the ones
  // targeted for components like HTMAXBUTTON. In that case, the mouse events
  // are used to identify clicks on maximize/minimize/restore buttons located in
  // the top non-client area of the chromium window. See
  // WindowEventFilter::OnMouseEvent for a concrete example of how mouse events
  // are identified as client or non-client.
  //
  // When the API is called, there is no way to know that the call was
  // successful or not. The browser continues performing as usual except that a
  // system compositor does not send any mouse/keyboard/etc events until user
  // releases a mouse button. Instead, the compositor sends new bounds, which a
  // client uses to recreate gpu buffers and redraw visual represantation of the
  // browser.
  virtual void DispatchHostWindowDragMovement(
      int hittest,
      const gfx::Point& pointer_location_in_px) = 0;

 protected:
  virtual ~WmMoveResizeHandler() {}
};

COMPONENT_EXPORT(WM)
void SetWmMoveResizeHandler(PlatformWindow* platform_window,
                            WmMoveResizeHandler* move_resize_handler);
COMPONENT_EXPORT(WM)
WmMoveResizeHandler* GetWmMoveResizeHandler(
    const PlatformWindow& platform_window);

}  // namespace ui

#endif  // UI_PLATFORM_WINDOW_WM_WM_MOVE_RESIZE_HANDLER_H_