Merge branch 'fix_zone_instead_of_ignore'

This commit is contained in:
Isaac Connor 2020-12-15 16:33:58 -05:00
commit 46bbbb7dff
7 changed files with 21 additions and 11 deletions

View File

@ -10,7 +10,7 @@ SET @s = (SELECT IF(
AND column_name = 'ParentId'
) > 0,
"SELECT 'Column GroupId exists in Groups'",
"ALTER TABLE Groups ADD `ParentId` int(10) unsigned AFTER `Name`"
"ALTER TABLE `Groups` ADD `ParentId` int(10) unsigned AFTER `Name`"
));
PREPARE stmt FROM @s;

View File

@ -3,7 +3,7 @@ SET @s = (SELECT IF(
AND table_name = 'Groups'
AND column_name = 'MonitorIds'
) > 0,
"ALTER TABLE Groups MODIFY `MonitorIds` text NOT NULL",
"ALTER TABLE `Groups` MODIFY `MonitorIds` text NOT NULL",
"SELECT 'Groups no longer has MonitorIds'"
));

View File

@ -47,10 +47,14 @@ public:
inline const Coord &Lo() const { return lo; }
inline int LoX() const { return lo.X(); }
inline int LoX(int p_lo_x) { return lo.X(p_lo_x); }
inline int LoY() const { return lo.Y(); }
inline int LoY(int p_lo_y) { return lo.Y(p_lo_y); }
inline const Coord &Hi() const { return hi; }
inline int HiX() const { return hi.X(); }
inline int HiX(int p_hi_x) { return hi.X(p_hi_x); }
inline int HiY() const { return hi.Y(); }
inline int HiY(int p_hi_y) { return hi.Y(p_hi_y); }
inline const Coord &Size() const { return size; }
inline int Width() const { return size.X(); }
inline int Height() const { return size.Y(); }

View File

@ -38,14 +38,14 @@ public:
y = coord.y;
return *this;
}
inline int &X() { return( x ); }
inline const int &X() const { return( x ); }
inline int &Y() { return( y ); }
inline const int &Y() const { return( y ); }
inline int &X(int p_x) { x=p_x; return x; }
inline const int &X() const { return x; }
inline int &Y(int p_y) { y=p_y; return y; }
inline const int &Y() const { return y; }
inline static Coord Range( const Coord &coord1, const Coord &coord2 ) {
Coord result( (coord1.x-coord2.x)+1, (coord1.y-coord2.y)+1 );
return( result );
return result;
}
inline bool operator==( const Coord &coord ) const { return( x == coord.x && y == coord.y ); }

View File

@ -555,7 +555,7 @@ bool Monitor::connect() {
Debug(3, "Connecting to monitor. Purpose is %d", purpose );
#if ZM_MEM_MAPPED
snprintf(mem_file, sizeof(mem_file), "%s/zm.mmap.%d", staticConfig.PATH_MAP.c_str(), id);
map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0600);
map_fd = open(mem_file, O_RDWR|O_CREAT, (mode_t)0660);
if ( map_fd < 0 ) {
Error("Can't open memory map file %s, probably not enough space free: %s", mem_file, strerror(errno));
return false;

View File

@ -100,9 +100,13 @@ public:
inline const Box &Extent() const { return extent; }
inline int LoX() const { return extent.LoX(); }
inline int LoX(int p_lo_x) { return extent.LoX(p_lo_x); }
inline int HiX() const { return extent.HiX(); }
inline int HiX(int p_hi_x) { return extent.HiX(p_hi_x); }
inline int LoY() const { return extent.LoY(); }
inline int LoY(int p_lo_y) { return extent.LoY(p_lo_y); }
inline int HiY() const { return extent.HiY(); }
inline int HiY(int p_hi_y) { return extent.HiY(p_hi_y); }
inline int Width() const { return extent.Width(); }
inline int Height() const { return extent.Height(); }

View File

@ -892,10 +892,12 @@ int Zone::Load(Monitor *monitor, Zone **&zones) {
if ( polygon.LoX() < 0 || polygon.HiX() >= (int)monitor->Width()
|| polygon.LoY() < 0 || polygon.HiY() >= (int)monitor->Height() ) {
Error("Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), ignoring",
Error("Zone %d/%s for monitor %s extends outside of image dimensions, (%d,%d), (%d,%d), fixing",
Id, Name, monitor->Name(), polygon.LoX(), polygon.LoY(), polygon.HiX(), polygon.HiY());
n_zones -= 1;
continue;
if ( polygon.LoX() < 0 ) polygon.LoX(0);
if ( polygon.HiX() >= (int)monitor->Width()) polygon.HiX((int)monitor->Width());
if ( polygon.LoY() < 0 ) polygon.LoY(0);
if ( polygon.HiY() >= (int)monitor->Height() ) polygon.HiY((int)monitor->Height());
}
if ( false && !strcmp( Units, "Percent" ) ) {