[pve-devel] [PATCH librados2-perl] Split method pve_rados_connect

2018-03-30 Thread Alwin Antreich
To be able to connect through librados2 without a config file, the
method pve_rados_connect is split up into pve_rados_connect and
pve_rados_conf_read_file.

Signed-off-by: Alwin Antreich 
---
 PVE/RADOS.pm |  9 -
 RADOS.xs | 26 +-
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/PVE/RADOS.pm b/PVE/RADOS.pm
index aa6a102..ad1c2db 100644
--- a/PVE/RADOS.pm
+++ b/PVE/RADOS.pm
@@ -1,6 +1,6 @@
 package PVE::RADOS;
 
-use 5.014002;
+use 5.014002; # FIXME: update version??
 use strict;
 use warnings;
 use Carp;
@@ -13,6 +13,7 @@ use PVE::RPCEnvironment;
 require Exporter;
 
 my $rados_default_timeout = 5;
+my $ceph_default_conf = '/etc/ceph/ceph.conf';
 
 
 our @ISA = qw(Exporter);
@@ -164,6 +165,12 @@ sub new {
$conn = pve_rados_create() ||
die "unable to create RADOS object\n";
 
+   my $ceph_conf = delete $params{ceph_conf} || $ceph_default_conf;
+
+   if (-e $ceph_conf) {
+   pve_rados_conf_read_file($conn, $ceph_conf);
+   }
+
pve_rados_conf_set($conn, 'client_mount_timeout', $timeout);
 
foreach my $k (keys %params) {
diff --git a/RADOS.xs b/RADOS.xs
index a9f6bc3..ad3cf96 100644
--- a/RADOS.xs
+++ b/RADOS.xs
@@ -47,19 +47,35 @@ CODE:
 }
 
 void
-pve_rados_connect(cluster) 
+pve_rados_conf_read_file(cluster, path)
 rados_t cluster
-PROTOTYPE: $
+SV *path
+PROTOTYPE: $$
 CODE:
 {
-DPRINTF("pve_rados_connect\n");
+char *p = NULL;
 
-int res = rados_conf_read_file(cluster, NULL);
+if (SvOK(path)) {
+   p = SvPV_nolen(path);
+}
+
+DPRINTF("pve_rados_conf_read_file %s\n", p);
+
+int res = rados_conf_read_file(cluster, p);
 if (res < 0) {
 die("rados_conf_read_file failed - %s\n", strerror(-res));
 }
+}
+
+void
+pve_rados_connect(cluster)
+rados_t cluster
+PROTOTYPE: $
+CODE:
+{
+DPRINTF("pve_rados_connect\n");
 
-res = rados_connect(cluster);
+int res = rados_connect(cluster);
 if (res < 0) {
 die("rados_connect failed - %s\n", strerror(-res));
 }
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] applied: [PATCH widget-toolkit] (partially) fix #1223: add touchscreen override for extjs

2018-03-30 Thread Dominik Csapak

On 03/30/2018 10:22 AM, Thomas Lamprecht wrote:

Am 03/30/2018 um 09:48 AM schrieb Dominik Csapak:

the combination of firefox, touchscreen, mouse input and extjs
prevents normal click/touch input for buttons, lists, etc.

the workaround on firefox was to set
dom.w3c_touch_events.enabled
to 0 (in about:config)

or to upgrade to extjs >= 6.5.1 (of which there is no gpl release as 
of now)




I guess you took a quick look at what they changed to address this in
6.5.1 and it is just to much change to backport a similar "full" 
solution to our available versions?


Anyway it looks OK, tested and applied.


AFAICS, the 'real' fix is during setting up the event handlers, which is 
a point we cannot override (since this happens during the setting up of 
extjs itself)





so we introduce that workaround as it seems to not disrupt 'normal'
browsers and non-touchscreen devices

we then still have an issue with scrolling though, since extjs
now expects the user to drag the content instead of using the wheel

but it is still better than a completely non working interface

Signed-off-by: Dominik Csapak 
---
  Toolkit.js | 43 +++
  1 file changed, 43 insertions(+)

diff --git a/Toolkit.js b/Toolkit.js
index 7e62e05..4f1b623 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -139,6 +139,49 @@ Ext.apply(Ext.form.field.VTypes, {
  passwordText: gettext('Passwords do not match')
  });
+// Firefox 52+ Touchscreen bug
+// see 
https://www.sencha.com/forum/showthread.php?336762-Examples-don-t-work-in-Firefox-52-touchscreen/page2 


+// and https://bugzilla.proxmox.com/show_bug.cgi?id=1223
+Ext.define('EXTJS_23846.Element', {
+    override: 'Ext.dom.Element'
+}, function(Element) {
+    var supports = Ext.supports,
+    proto = Element.prototype,
+    eventMap = proto.eventMap,
+    additiveEvents = proto.additiveEvents;
+
+    if (Ext.os.is.Desktop && supports.TouchEvents && 
!supports.PointerEvents) {

+    eventMap.touchstart = 'mousedown';
+    eventMap.touchmove = 'mousemove';
+    eventMap.touchend = 'mouseup';
+    eventMap.touchcancel = 'mouseup';
+
+    additiveEvents.mousedown = 'mousedown';
+    additiveEvents.mousemove = 'mousemove';
+    additiveEvents.mouseup = 'mouseup';
+    additiveEvents.touchstart = 'touchstart';
+    additiveEvents.touchmove = 'touchmove';
+    additiveEvents.touchend = 'touchend';
+    additiveEvents.touchcancel = 'touchcancel';
+
+    additiveEvents.pointerdown = 'mousedown';
+    additiveEvents.pointermove = 'mousemove';
+    additiveEvents.pointerup = 'mouseup';
+    additiveEvents.pointercancel = 'mouseup';
+    }
+});
+
+Ext.define('EXTJS_23846.Gesture', {
+    override: 'Ext.event.publisher.Gesture'
+}, function(Gesture) {
+    var me = Gesture.instance;
+
+    if (Ext.supports.TouchEvents && !Ext.isWebKit && 
Ext.os.is.Desktop) {

+    me.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
+    me.registerEvents();
+    }
+});
+
  // we always want the number in x.y format and never in, e.g., x,y
  Ext.define('PVE.form.field.Number', {
  override: 'Ext.form.field.Number',




___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] applied: [PATCH widget-toolkit] (partially) fix #1223: add touchscreen override for extjs

2018-03-30 Thread Thomas Lamprecht

Am 03/30/2018 um 09:48 AM schrieb Dominik Csapak:

the combination of firefox, touchscreen, mouse input and extjs
prevents normal click/touch input for buttons, lists, etc.

the workaround on firefox was to set
dom.w3c_touch_events.enabled
to 0 (in about:config)

or to upgrade to extjs >= 6.5.1 (of which there is no gpl release as of now)



I guess you took a quick look at what they changed to address this in
6.5.1 and it is just to much change to backport a similar "full" 
solution to our available versions?


Anyway it looks OK, tested and applied.


so we introduce that workaround as it seems to not disrupt 'normal'
browsers and non-touchscreen devices

we then still have an issue with scrolling though, since extjs
now expects the user to drag the content instead of using the wheel

but it is still better than a completely non working interface

Signed-off-by: Dominik Csapak 
---
  Toolkit.js | 43 +++
  1 file changed, 43 insertions(+)

diff --git a/Toolkit.js b/Toolkit.js
index 7e62e05..4f1b623 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -139,6 +139,49 @@ Ext.apply(Ext.form.field.VTypes, {
  passwordText: gettext('Passwords do not match')
  });
  
+// Firefox 52+ Touchscreen bug

+// see 
https://www.sencha.com/forum/showthread.php?336762-Examples-don-t-work-in-Firefox-52-touchscreen/page2
+// and https://bugzilla.proxmox.com/show_bug.cgi?id=1223
+Ext.define('EXTJS_23846.Element', {
+override: 'Ext.dom.Element'
+}, function(Element) {
+var supports = Ext.supports,
+proto = Element.prototype,
+eventMap = proto.eventMap,
+additiveEvents = proto.additiveEvents;
+
+if (Ext.os.is.Desktop && supports.TouchEvents && !supports.PointerEvents) {
+eventMap.touchstart = 'mousedown';
+eventMap.touchmove = 'mousemove';
+eventMap.touchend = 'mouseup';
+eventMap.touchcancel = 'mouseup';
+
+additiveEvents.mousedown = 'mousedown';
+additiveEvents.mousemove = 'mousemove';
+additiveEvents.mouseup = 'mouseup';
+additiveEvents.touchstart = 'touchstart';
+additiveEvents.touchmove = 'touchmove';
+additiveEvents.touchend = 'touchend';
+additiveEvents.touchcancel = 'touchcancel';
+
+additiveEvents.pointerdown = 'mousedown';
+additiveEvents.pointermove = 'mousemove';
+additiveEvents.pointerup = 'mouseup';
+additiveEvents.pointercancel = 'mouseup';
+}
+});
+
+Ext.define('EXTJS_23846.Gesture', {
+override: 'Ext.event.publisher.Gesture'
+}, function(Gesture) {
+var me = Gesture.instance;
+
+if (Ext.supports.TouchEvents && !Ext.isWebKit && Ext.os.is.Desktop) {
+me.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
+me.registerEvents();
+}
+});
+
  // we always want the number in x.y format and never in, e.g., x,y
  Ext.define('PVE.form.field.Number', {
  override: 'Ext.form.field.Number',



___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH widget-toolkit] (partially) fix #1223: add touchscreen override for extjs

2018-03-30 Thread Dominik Csapak
the combination of firefox, touchscreen, mouse input and extjs
prevents normal click/touch input for buttons, lists, etc.

the workaround on firefox was to set
dom.w3c_touch_events.enabled
to 0 (in about:config)

or to upgrade to extjs >= 6.5.1 (of which there is no gpl release as of now)

so we introduce that workaround as it seems to not disrupt 'normal'
browsers and non-touchscreen devices

we then still have an issue with scrolling though, since extjs
now expects the user to drag the content instead of using the wheel

but it is still better than a completely non working interface

Signed-off-by: Dominik Csapak 
---
 Toolkit.js | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/Toolkit.js b/Toolkit.js
index 7e62e05..4f1b623 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -139,6 +139,49 @@ Ext.apply(Ext.form.field.VTypes, {
 passwordText: gettext('Passwords do not match')
 });
 
+// Firefox 52+ Touchscreen bug
+// see 
https://www.sencha.com/forum/showthread.php?336762-Examples-don-t-work-in-Firefox-52-touchscreen/page2
+// and https://bugzilla.proxmox.com/show_bug.cgi?id=1223
+Ext.define('EXTJS_23846.Element', {
+override: 'Ext.dom.Element'
+}, function(Element) {
+var supports = Ext.supports,
+proto = Element.prototype,
+eventMap = proto.eventMap,
+additiveEvents = proto.additiveEvents;
+
+if (Ext.os.is.Desktop && supports.TouchEvents && !supports.PointerEvents) {
+eventMap.touchstart = 'mousedown';
+eventMap.touchmove = 'mousemove';
+eventMap.touchend = 'mouseup';
+eventMap.touchcancel = 'mouseup';
+
+additiveEvents.mousedown = 'mousedown';
+additiveEvents.mousemove = 'mousemove';
+additiveEvents.mouseup = 'mouseup';
+additiveEvents.touchstart = 'touchstart';
+additiveEvents.touchmove = 'touchmove';
+additiveEvents.touchend = 'touchend';
+additiveEvents.touchcancel = 'touchcancel';
+
+additiveEvents.pointerdown = 'mousedown';
+additiveEvents.pointermove = 'mousemove';
+additiveEvents.pointerup = 'mouseup';
+additiveEvents.pointercancel = 'mouseup';
+}
+});
+
+Ext.define('EXTJS_23846.Gesture', {
+override: 'Ext.event.publisher.Gesture'
+}, function(Gesture) {
+var me = Gesture.instance;
+
+if (Ext.supports.TouchEvents && !Ext.isWebKit && Ext.os.is.Desktop) {
+me.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
+me.registerEvents();
+}
+});
+
 // we always want the number in x.y format and never in, e.g., x,y
 Ext.define('PVE.form.field.Number', {
 override: 'Ext.form.field.Number',
-- 
2.11.0


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel