mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-06 13:22:36 +08:00
lib/platform: Use std::string directly instead of String typedef
This commit is contained in:
@@ -1294,7 +1294,7 @@ XWindowsUtil::KeySymMap XWindowsUtil::s_keySymToUCS4;
|
||||
|
||||
bool
|
||||
XWindowsUtil::getWindowProperty(Display* display, Window window,
|
||||
Atom property, String* data, Atom* type,
|
||||
Atom property, std::string* data, Atom* type,
|
||||
SInt32* format, bool deleteProperty)
|
||||
{
|
||||
assert(display != NULL);
|
||||
@@ -1608,8 +1608,7 @@ XWindowsUtil::getModifierBitForKeySym(KeySym keysym)
|
||||
}
|
||||
}
|
||||
|
||||
String
|
||||
XWindowsUtil::atomToString(Display* display, Atom atom)
|
||||
std::string XWindowsUtil::atomToString(Display* display, Atom atom)
|
||||
{
|
||||
if (atom == 0) {
|
||||
return "None";
|
||||
@@ -1622,20 +1621,19 @@ XWindowsUtil::atomToString(Display* display, Atom atom)
|
||||
return barrier::string::sprintf("<UNKNOWN> (%d)", (int)atom);
|
||||
}
|
||||
else {
|
||||
String msg = barrier::string::sprintf("%s (%d)", name, (int)atom);
|
||||
std::string msg = barrier::string::sprintf("%s (%d)", name, (int)atom);
|
||||
XFree(name);
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
String
|
||||
XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
|
||||
std::string XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
|
||||
{
|
||||
char** names = new char*[num];
|
||||
bool error = false;
|
||||
XWindowsUtil::ErrorLock lock(display, &error);
|
||||
XGetAtomNames(display, const_cast<Atom*>(atom), (int)num, names);
|
||||
String msg;
|
||||
std::string msg;
|
||||
if (error) {
|
||||
for (UInt32 i = 0; i < num; ++i) {
|
||||
msg += barrier::string::sprintf("<UNKNOWN> (%d), ", (int)atom[i]);
|
||||
@@ -1654,8 +1652,7 @@ XWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num)
|
||||
return msg;
|
||||
}
|
||||
|
||||
void
|
||||
XWindowsUtil::convertAtomProperty(String& data)
|
||||
void XWindowsUtil::convertAtomProperty(std::string& data)
|
||||
{
|
||||
// as best i can tell, 64-bit systems don't pack Atoms into properties
|
||||
// as 32-bit numbers but rather as the 64-bit numbers they are. that
|
||||
@@ -1669,22 +1666,19 @@ XWindowsUtil::convertAtomProperty(String& data)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XWindowsUtil::appendAtomData(String& data, Atom atom)
|
||||
void XWindowsUtil::appendAtomData(std::string& data, Atom atom)
|
||||
{
|
||||
data.append(reinterpret_cast<char*>(&atom), sizeof(Atom));
|
||||
}
|
||||
|
||||
void
|
||||
XWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom)
|
||||
void XWindowsUtil::replaceAtomData(std::string& data, UInt32 index, Atom atom)
|
||||
{
|
||||
data.replace(index * sizeof(Atom), sizeof(Atom),
|
||||
reinterpret_cast<const char*>(&atom),
|
||||
sizeof(Atom));
|
||||
}
|
||||
|
||||
void
|
||||
XWindowsUtil::appendTimeData(String& data, Time time)
|
||||
void XWindowsUtil::appendTimeData(std::string& data, Time time)
|
||||
{
|
||||
data.append(reinterpret_cast<char*>(&time), sizeof(Time));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user