Skip to content

Commit

Permalink
remove usage of XEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
loc committed Aug 7, 2020
1 parent a5f8132 commit 26df6e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions shell/browser/ui/drag_util_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "ui/aura/window.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/file_info/file_info.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/point.h"
Expand Down Expand Up @@ -39,12 +40,12 @@ void DragFileItems(const std::vector<base::FilePath>& files,
return;

gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint();
// TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
// TODO(varunjain): Properly determine and send DragEventSource below.
aura::client::GetDragDropClient(root_window)
->StartDragAndDrop(
std::move(data), root_window, view, location,
ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK,
ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
ui::mojom::DragEventSource::kMouse);
}

} // namespace electron
3 changes: 2 additions & 1 deletion shell/browser/ui/file_dialog_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class FileChooserDialog {
// We need to call gtk_window_present after making the widgets visible to
// make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_), time);
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
}

void RunSaveAsynchronous(
Expand Down
3 changes: 2 additions & 1 deletion shell/browser/ui/message_box_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ class GtkMessageBox : public NativeWindowObserver {
// We need to call gtk_window_present after making the widgets visible to
// make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_), time);
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
}

int RunSynchronous() {
Expand Down
8 changes: 4 additions & 4 deletions shell/browser/ui/x/window_state_watcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ void WindowStateWatcher::DidProcessXEvent(x11::Event* x11_event) {
}

bool WindowStateWatcher::IsWindowStateEvent(x11::Event* x11_event) const {
XEvent* xev = &x11_event->xlib_event();
return (static_cast<x11::Atom>(xev->xproperty.atom) == window_state_atom_ &&
xev->type == PropertyNotify &&
xev->xproperty.window == static_cast<uint32_t>(widget_));
return (x11_event->As<x11::PropertyNotifyEvent>() &&
x11_event->As<x11::PropertyNotifyEvent>()->atom ==
window_state_atom_ &&
x11_event->As<x11::PropertyNotifyEvent>()->window == widget_);
}

} // namespace electron

0 comments on commit 26df6e0

Please sign in to comment.