Compare commits

..

9 commits

Author SHA1 Message Date
Robert Müller 39f063eeb0
Merge fe2f73b518 into 0f12044fcd 2024-09-15 20:32:46 +08:00
Dennis Felsing 0f12044fcd
Merge pull request #8956 from Robyt3/UI-Scrollbar-Rail-HotItem
Fix scrollbar rail clicking being active while popups open
2024-09-15 10:21:41 +00:00
Robert Müller 8f2c288698 Fix scrollbar rail clicking being active while popups open
Scrollbars are now also set as the hot item when the rail is hovered and the rail clicking function is now only enabled for the scrollbar that is the hot item.

Closes #8954.
2024-09-15 11:45:22 +02:00
Dennis Felsing 4b6f2e22a8
Merge pull request #8955 from furo321/url-master-parsing
Don't allow URLs without port from the masterserver
2024-09-15 09:28:43 +00:00
furo 7bbd51cf73 Don't allow URLs without port from the masterserver 2024-09-15 11:04:48 +02:00
Dennis Felsing dcd02b50bb
Merge pull request #8953 from ChillerDragon/pr_bind_null
Add BindNull to SQL api
2024-09-15 06:31:43 +00:00
Dennis Felsing 4fe956dffc
Merge pull request #8951 from furo321/fix-capture-count
Fix captures not being counted for certain names
2024-09-15 06:13:40 +00:00
ChillerDragon 7c2f058c40 Add BindNull to SQL api
Comes in handy in my downstream project
2024-09-15 09:14:00 +08:00
furo 6bf4a016ba Fix captures not being counted for certain names 2024-09-15 00:51:39 +02:00
6 changed files with 55 additions and 20 deletions

View file

@ -424,7 +424,10 @@ void CServerBrowserHttp::Refresh()
}
bool ServerbrowserParseUrl(NETADDR *pOut, const char *pUrl)
{
return net_addr_from_url(pOut, pUrl, nullptr, 0) != 0;
int Failure = net_addr_from_url(pOut, pUrl, nullptr, 0);
if(Failure || pOut->port == 0)
return true;
return false;
}
bool CServerBrowserHttp::Validate(json_value *pJson)
{

View file

@ -61,6 +61,7 @@ public:
virtual void BindInt(int Idx, int Value) = 0;
virtual void BindInt64(int Idx, int64_t Value) = 0;
virtual void BindFloat(int Idx, float Value) = 0;
virtual void BindNull(int Idx) = 0;
// Print expanded sql statement
virtual void Print() = 0;

View file

@ -89,6 +89,7 @@ public:
void BindInt(int Idx, int Value) override;
void BindInt64(int Idx, int64_t Value) override;
void BindFloat(int Idx, float Value) override;
void BindNull(int Idx) override;
void Print() override {}
bool Step(bool *pEnd, char *pError, int ErrorSize) override;
@ -421,6 +422,22 @@ void CMysqlConnection::BindFloat(int Idx, float Value)
pParam->error = nullptr;
}
void CMysqlConnection::BindNull(int Idx)
{
m_NewQuery = true;
Idx -= 1;
dbg_assert(0 <= Idx && Idx < (int)m_vStmtParameters.size(), "index out of bounds");
MYSQL_BIND *pParam = &m_vStmtParameters[Idx];
pParam->buffer_type = MYSQL_TYPE_NULL;
pParam->buffer = nullptr;
pParam->buffer_length = 0;
pParam->length = nullptr;
pParam->is_null = nullptr;
pParam->is_unsigned = false;
pParam->error = nullptr;
}
bool CMysqlConnection::Step(bool *pEnd, char *pError, int ErrorSize)
{
if(m_NewQuery)

View file

@ -37,6 +37,7 @@ public:
void BindInt(int Idx, int Value) override;
void BindInt64(int Idx, int64_t Value) override;
void BindFloat(int Idx, float Value) override;
void BindNull(int Idx) override;
void Print() override;
bool Step(bool *pEnd, char *pError, int ErrorSize) override;
@ -241,6 +242,13 @@ void CSqliteConnection::BindFloat(int Idx, float Value)
m_Done = false;
}
void CSqliteConnection::BindNull(int Idx)
{
int Result = sqlite3_bind_null(m_pStmt, Idx);
AssertNoError(Result);
m_Done = false;
}
// Keep support for SQLite < 3.14 on older Linux distributions. MinGW does not
// support __attribute__((weak)): https://sourceware.org/bugzilla/show_bug.cgi?id=9687
#if defined(__GNUC__) && !defined(__MINGW32__)

View file

@ -102,7 +102,7 @@ void CStatboard::OnMessage(int MsgType, void *pRawMsg)
if(t <= p)
return;
str_utf8_truncate(aName, sizeof(aName), p, t - p);
str_truncate(aName, sizeof(aName), p, t - p);
for(int i = 0; i < MAX_CLIENTS; i++)
{

View file

@ -1301,21 +1301,24 @@ float CUi::DoScrollbarV(const void *pId, const CUIRect *pRect, float Current)
}
else if(HotItem() == pId)
{
if(MouseButton(0))
if(InsideHandle)
{
if(MouseButton(0))
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = MouseY() - Handle.y;
Grabbed = true;
}
}
else if(MouseButtonClicked(0))
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = MouseY() - Handle.y;
m_ActiveScrollbarOffset = Handle.h / 2.0f;
Grabbed = true;
}
}
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail)
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = Handle.h / 2.0f;
Grabbed = true;
}
if(InsideHandle && !MouseButton(0))
if(InsideRail && !MouseButton(0))
{
SetHotItem(pId);
}
@ -1380,19 +1383,22 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
}
else if(HotItem() == pId)
{
if(MouseButton(0))
if(InsideHandle)
{
if(MouseButton(0))
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = MouseX() - Handle.x;
Grabbed = true;
}
}
else if(MouseButtonClicked(0))
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = MouseX() - Handle.x;
m_ActiveScrollbarOffset = Handle.w / 2.0f;
Grabbed = true;
}
}
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail)
{
SetActiveItem(pId);
m_ActiveScrollbarOffset = Handle.w / 2.0f;
Grabbed = true;
}
if(!pColorInner && (InsideHandle || Grabbed) && (CheckActiveItem(pId) || HotItem() == pId))
{
@ -1400,7 +1406,7 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
Handle.y -= 1.5f;
}
if(InsideHandle && !MouseButton(0))
if(InsideRail && !MouseButton(0))
{
SetHotItem(pId);
}