mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
Add switches to KivyMD for disabling elevation shader on unsupported hardware
This commit is contained in:
parent
540a533900
commit
e72d0f892b
@ -1,4 +1,4 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
precision highp float;
|
precision highp float;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -379,6 +379,7 @@ from kivy.properties import (
|
|||||||
from kivy.uix.widget import Widget
|
from kivy.uix.widget import Widget
|
||||||
|
|
||||||
from kivymd import glsl_path
|
from kivymd import glsl_path
|
||||||
|
from kivymd.app import MDApp
|
||||||
|
|
||||||
|
|
||||||
# FIXME: Add shadow manipulation with canvas instructions such as
|
# FIXME: Add shadow manipulation with canvas instructions such as
|
||||||
@ -606,16 +607,26 @@ class CommonElevationBehavior(Widget):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
if hasattr(MDApp.get_running_app(), "shaders_disabled") and MDApp.get_running_app().shaders_disabled:
|
||||||
|
self.shaders_disabled = True
|
||||||
|
else:
|
||||||
|
self.shaders_disabled = False
|
||||||
|
|
||||||
with self.canvas.before:
|
with self.canvas.before:
|
||||||
self.context = RenderContext(use_parent_projection=True)
|
self.context = RenderContext(use_parent_projection=True)
|
||||||
with self.context:
|
with self.context:
|
||||||
self.rect = RoundedRectangle(pos=self.pos, size=self.size)
|
if self.shaders_disabled:
|
||||||
|
self.rect = None
|
||||||
|
del self.rect
|
||||||
|
else:
|
||||||
|
self.rect = RoundedRectangle(pos=self.pos, size=self.size)
|
||||||
|
|
||||||
self.after_init()
|
self.after_init()
|
||||||
|
|
||||||
def after_init(self, *args):
|
def after_init(self, *args):
|
||||||
Clock.schedule_once(self.check_for_relative_behavior)
|
Clock.schedule_once(self.check_for_relative_behavior)
|
||||||
Clock.schedule_once(self.set_shader_string)
|
if not self.shaders_disabled:
|
||||||
|
Clock.schedule_once(self.set_shader_string)
|
||||||
Clock.schedule_once(lambda x: self.on_elevation(self, self.elevation))
|
Clock.schedule_once(lambda x: self.on_elevation(self, self.elevation))
|
||||||
self.on_pos()
|
self.on_pos()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user