Hash :
ccbc9e9b
Author :
Date :
2025-08-20T05:28:12
Revert "Rename enums to fix GCC -Wchanges-meaning error" This reverts commit dc24ecca9ed920c0269e9d62dfcac4b3f3e5a4d4. Reason for revert: breaks ios-simulator build when rolled to Chromium https://chromium-review.googlesource.com/c/chromium/src/+/6863632 https://ci.chromium.org/ui/p/chromium/builders/try/ios-simulator/2446924/overview [10968/78005] OBJCXX obj/third_party/angle/util/angle_util_static/IOSWindow.o sdk/xcode_links/iPhoneSimulator18.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSDictionary.h:17:38: error: reference to 'KeyType' is ambiguous 17 | - (nullable ObjectType)objectForKey:(KeyType)aKey; BUG: angleproject:438226513 Original change's description: > Rename enums to fix GCC -Wchanges-meaning error > > Renamed enums Key and MouseButton to enum class KeyType and > MouseButtonType to avoid name conflicts with union members in > Event.h on GCC, and to follow the ANGLE style guide preference > for scoped enums. > > BUG: angleproject:438226513 > Change-Id: I8892b438b3b05a3ce4e14f8c0769b81722688da8 > Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6845484 > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:438226513 No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: Iff0d925b9fa608215cff0e472074a0315f14e861 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6863019 Auto-Submit: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WindowTest.cpp: Sample used to test various function of OSWindow
#include <algorithm>
#include <iostream>
#include "util/OSWindow.h"
#include "util/test_utils.h"
int main(int argc, char *argv[])
{
OSWindow *window = OSWindow::New();
int width = 400;
int height = 400;
int x = 0;
int y = 0;
if (!window->initialize("Window Test", width, height))
{
return -1;
}
window->setVisible(true);
window->setPosition(x, y);
bool running = true;
while (running)
{
Event event;
while (window->popEvent(&event))
{
if (event.Type == Event::EVENT_CLOSED)
{
running = false;
break;
}
if (event.Type == Event::EVENT_KEY_PRESSED)
{
int newWidth = width;
int newHeight = height;
int newX = x;
int newY = y;
switch (event.Key.Code)
{
case KEY_ESCAPE:
running = false;
break;
case KEY_W:
newWidth = std::max(0, width + (event.Key.Shift ? -20 : 20));
break;
case KEY_H:
newHeight = std::max(0, height + (event.Key.Shift ? -20 : 20));
break;
case KEY_LEFT:
newX = x - 20;
break;
case KEY_RIGHT:
newX = x + 20;
break;
case KEY_UP:
newY = y - 20;
break;
case KEY_DOWN:
newY = y + 20;
break;
case KEY_C:
window->setMousePosition(width / 2, height / 2);
break;
case KEY_T:
window->signalTestEvent();
window->messageLoop();
if (window->didTestEventFire())
{
std::cout << "Test event did fire" << std::endl;
}
else
{
std::cout << "Test event did not fire" << std::endl;
}
break;
case KEY_S:
window->setVisible(false);
window->messageLoop();
angle::Sleep(1000);
window->setVisible(true);
window->messageLoop();
break;
default:
break;
}
if (newWidth != width || newHeight != height)
{
width = newWidth;
height = newHeight;
window->resize(width, height);
}
if (newX != x || newY != y)
{
x = newX;
y = newY;
window->setPosition(x, y);
}
angle::Sleep(0);
window->messageLoop();
if (window->getWidth() != width || window->getHeight() != height)
{
std::cout << "Discrepancy between set dimensions and retrieved dimensions"
<< std::endl;
std::cout << "Width: " << width << " vs. " << window->getWidth() << std::endl;
std::cout << "Height: " << height << " vs. " << window->getHeight()
<< std::endl;
}
if (window->getX() != x || window->getY() != y)
{
std::cout << "Discrepancy between set position and retrieved position"
<< std::endl;
std::cout << "X: " << x << " vs. " << window->getX() << std::endl;
std::cout << "Y: " << y << " vs. " << window->getY() << std::endl;
}
}
}
angle::Sleep(0);
window->messageLoop();
}
window->destroy();
}