merge: upstream/libcosmic a l'etat pinne par epoch-1.10.0 (7f715bc5d)
Cible : pin le plus recent des Cargo.lock amont d'epoch-1.10.0 (cosmic-osk, cosmic-viewer), pas master. Apporte la politique de selection du GPU (src/desktop/gpu.rs) et le correctif de double peinture des items de menu. Sous-module iced : merge de a31e6c6f8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
85e9321971
7 changed files with 97 additions and 18 deletions
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
|
@ -1,8 +1,10 @@
|
|||
- [ ] I have disclosed use of any AI generated code in my commit messages.
|
||||
- If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
|
||||
- In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
|
||||
- [ ] I understand these changes in full and will be able to respond to review comments.
|
||||
- [ ] My change is accurately described in the commit message.
|
||||
- [ ] My contribution is tested and working as described.
|
||||
- [ ] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
|
||||
Replace this text with a description of your changes, and why these changes are important. Read and acknowledge the list below. PRs without a completed checkbox will be closed.
|
||||
|
||||
---
|
||||
|
||||
- I have not included any LLM (also known as AI) generated content in this PR, including code, comments, and descriptions.
|
||||
- I understand these changes in full and will be able to respond to review comments.
|
||||
- My change is accurately described in the commit message.
|
||||
- My contribution is tested and working as described.
|
||||
- I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
|
||||
- [ ] I have read and followed all of the above requirements. For more information, see our [contributor guide](https://github.com/pop-os/pop/blob/master/CONTRIBUTING.md).
|
||||
|
|
|
|||
14
.github/workflows/require-checklist.yml
vendored
Normal file
14
.github/workflows/require-checklist.yml
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# From https://github.com/mheap/require-checklist-action, license MIT
|
||||
name: Require Checklist
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize]
|
||||
|
||||
jobs:
|
||||
job1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: mheap/require-checklist-action@v2
|
||||
with:
|
||||
requireChecklist: true
|
||||
|
|
@ -12,13 +12,13 @@ thursday = 星期四
|
|||
friday = 星期五
|
||||
saturday = 星期六
|
||||
sunday = 星期日
|
||||
mon = 週一
|
||||
tue = 週二
|
||||
wed = 週三
|
||||
thu = 週四
|
||||
fri = 週五
|
||||
sat = 週六
|
||||
sun = 週日
|
||||
mon = 星期一
|
||||
tue = 星期二
|
||||
wed = 星期三
|
||||
thu = 星期四
|
||||
fri = 星期五
|
||||
sat = 星期六
|
||||
sun = 星期日
|
||||
license = 授權
|
||||
links = 連結
|
||||
february = { $year } 年 2 月
|
||||
|
|
|
|||
2
iced
2
iced
|
|
@ -1 +1 @@
|
|||
Subproject commit 24da1dc0e4e5c1b7f803bf8584d10939fe5acdec
|
||||
Subproject commit f8ac890b9c0d52842a6434f4674e603ed7e67687
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
#[cfg(not(windows))]
|
||||
pub use freedesktop_desktop_entry as fde;
|
||||
#[cfg(not(windows))]
|
||||
pub mod gpu;
|
||||
#[cfg(not(windows))]
|
||||
pub use mime::Mime;
|
||||
use std::path::{Path, PathBuf};
|
||||
#[cfg(not(windows))]
|
||||
|
|
|
|||
56
src/desktop/gpu.rs
Normal file
56
src/desktop/gpu.rs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright 2026 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// An available GPU that can be selected by a launcher.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Descriptor {
|
||||
pub name: String,
|
||||
pub environment: HashMap<String, String>,
|
||||
pub default: bool,
|
||||
pub discrete: bool,
|
||||
}
|
||||
|
||||
/// A preference to use when choosing a GPU to launch with.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Preference {
|
||||
#[default]
|
||||
Default,
|
||||
NonDefault,
|
||||
}
|
||||
|
||||
impl Preference {
|
||||
/// Find the preferred default GPU for this preference.
|
||||
pub fn preferred(self, gpus: &[Descriptor]) -> Option<usize> {
|
||||
let default_idx = gpus.iter().position(|gpu| gpu.default);
|
||||
if matches!(self, Preference::Default) {
|
||||
return default_idx;
|
||||
}
|
||||
|
||||
let default_discrete = gpus.iter().position(|gpu| gpu.default && gpu.discrete);
|
||||
if default_discrete.is_some() {
|
||||
return default_discrete;
|
||||
}
|
||||
|
||||
let non_default_discrete = gpus.iter().position(|gpu| gpu.discrete);
|
||||
let non_default = || gpus.iter().position(|gpu| !gpu.default);
|
||||
non_default_discrete.or_else(non_default).or(default_idx)
|
||||
}
|
||||
|
||||
/// Select the GPU override to launch with.
|
||||
pub fn select(self, gpus: &[Descriptor]) -> Option<usize> {
|
||||
if matches!(self, Preference::Default) {
|
||||
return None;
|
||||
}
|
||||
|
||||
let default_discrete = gpus.iter().position(|gpu| gpu.default && gpu.discrete);
|
||||
if default_discrete.is_some() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let non_default_discrete = gpus.iter().position(|gpu| gpu.discrete);
|
||||
let non_default = || gpus.iter().position(|gpu| !gpu.default);
|
||||
non_default_discrete.or_else(non_default)
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,10 @@ pub enum Button {
|
|||
Transparent,
|
||||
}
|
||||
|
||||
fn menu_item_background(component: &Component, background: Color) -> Option<Background> {
|
||||
(background != Color::from(component.base)).then_some(Background::Color(background))
|
||||
}
|
||||
|
||||
pub fn appearance(
|
||||
theme: &crate::Theme,
|
||||
focused: bool,
|
||||
|
|
@ -149,7 +153,7 @@ pub fn appearance(
|
|||
// Menu folders cannot be disabled, ignore customized icon and text color
|
||||
let component = &cosmic.background(theme.transparent).component;
|
||||
let (background, _, _) = color(component);
|
||||
appearance.background = Some(Background::Color(background));
|
||||
appearance.background = menu_item_background(component, background);
|
||||
appearance.icon_color = Some(component.on.into());
|
||||
appearance.text_color = Some(component.on.into());
|
||||
corner_radii = &cosmic.corner_radii.radius_s;
|
||||
|
|
@ -171,8 +175,9 @@ pub fn appearance(
|
|||
}
|
||||
}
|
||||
Button::MenuItem => {
|
||||
let (background, text, icon) = color(&cosmic.background(theme.transparent).component);
|
||||
appearance.background = Some(Background::Color(background));
|
||||
let component = &cosmic.background(theme.transparent).component;
|
||||
let (background, text, icon) = color(component);
|
||||
appearance.background = menu_item_background(component, background);
|
||||
appearance.icon_color = icon;
|
||||
appearance.text_color = text;
|
||||
corner_radii = &cosmic.corner_radii.radius_s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue